eX-Robot. New Ideas and Solutions for Self Balancing Robot
|
06-11-2015, 10:53 AM
Post: #1
|
|||
|
|||
![]()
When opening a new topic, I want to tell here about their findings, the changes made and plans to expand the functionality of the B-Robot.
I'll start with the concept laid the basis for a rethinking of the basic version: - The robot must be relatively cheap; - Should be able to be upgraded in terms of both hardware and software. Following this concept, have been replaced with stepper motors (17HS2408), ultrasonic ranger (HC-SR04), Wi-Fi module (ESP8266) and battery (Li-Ion 5000mAh). Added logic levels converter bi-directional module, step-up voltage converters (DC-DC 3.7V to 12V) to power the stepper motors, two step-down voltage converter (DC-DC 12V to 5V and 12V to 3.3V) and charging module (TP4056x4 4.2V 3A) for Li-Ion battery. Today, the preamble is completed. In the next post I will discuss how to ensure the sonar and control two motors with a single timer. See you. |
|||
06-11-2015, 07:34 PM
(This post was last modified: 06-12-2015 03:36 PM by KomX.)
Post: #2
|
|||
|
|||
RE: eX-Robot. New Ideas and Solutions for Self Balancing Robot
In original sketch for motor control used two timers (Timer1, and Timer3) in CTC mode. These two timers, measure the period between two consecutive pulses of the STEP.
This approach is wasteful! So, start saving - use only Timer1 and laid on him to work with sonar. Analyzing the work Timer1, I chose a slightly different configuration of the base PinOut (reserved SPI pins for future use): Code: //Table PinOut Sparkfun Pro Micro: Adding new variables: Code: #define TIMING_TRIG_PULSE 20 // 10us Actual code work stepper motors and sonar: Code: void delay_1us() // !!!calibrated on an oscilloscope The original procedures set speed engine be changed: Replace the code in the procedure setMotorSpeedM1(int16_t tspeed) Code: OCR1A = timer_period; Code: period_M1 = timer_period; Replace the code in the procedure setMotorSpeedM2(int16_t tspeed) Code: OCR3A = timer_period; Code: period_M2 = timer_period; However, I replaced one of these two procedures: Code: void eX_Set_Motors_Speed(int16_t tspeed_M1, int16_t tspeed_M2) In it, I almost simultaneously set the direction and rotation period of the motors. Which option you choose is up to you ... enjoy! P.S. Claims on direct semantic nuances Google Russian-English translator. ![]() |
|||
06-12-2015, 12:30 PM
Post: #3
|
|||
|
|||
RE: eX-Robot. New Ideas and Solutions for Self Balancing Robot
Hi!
Under our future ideas need free memory and time for their execution. Now we will unleash 16 bytes of memory and a 100 microsecond time. So, we will upgrade the original procedure for measuring the battery voltage. The modernization will improve measurement accuracy and free up 16 bytes of memory and a 100 microsecond time. The original code (not the library version of the code): Code: #define BATT_VOLT_FACTOR 8 Replace a new code: Code: uint16_t tbattery = 0; NOTE: In the original code BATT_VOLT_FACTOR = 8 selected for maximum battery voltage (Vin) equal to 12.5 volts and a voltage reference source Vref = 5 volt. Using a resistive divider R3(33K) end R5(22K). The new code uses a built-in stabilized power supply with Vref = 2.56V. This limits the voltage at pin A5 and require different resistors R3, R5 and constant BATT_VOLT_FACTOR. Question developers: How to solve the problem of monitoring the battery on the board Pro Micro? In it there is no pin A5! |
|||
06-12-2015, 05:17 PM
Post: #4
|
|||
|
|||
RE: eX-Robot. New Ideas and Solutions for Self Balancing Robot
(06-11-2015 07:34 PM)KomX Wrote: Replace the code in the procedure setMotorSpeedM1(int16_t tspeed) Do you mean change these 4 lines to this 1 line or something different?? I tried make these changes, but unsuccefull ![]() |
|||
06-12-2015, 05:32 PM
Post: #5
|
|||
|
|||
RE: eX-Robot. New Ideas and Solutions for Self Balancing Robot
Replacement of which you asked, it is only required if you change the pinout connections of motors and use the program works only with Timer1. Then you can do the replacement or use a program at the end of the post you are interested in.
|
|||
06-16-2015, 09:51 AM
Post: #6
|
|||
|
|||
RE: eX-Robot. New Ideas and Solutions for Self Balancing Robot
We continue to analyze the code in order to optimize resources.
Analysis of motor control program demonstrates that the pulses on STEP motors Nicodemus different drivers do not come at the same time. The analysis of the work of the drivers said that the level of the signal DIR is important only at the time of arrival of a signal STEP. It can be concluded that for normal operation quite the same control signal STEP to service two drivers. Set free for future use pin D5! |
|||
10-14-2015, 10:54 AM
(This post was last modified: 10-14-2015 10:56 AM by Wampo.)
Post: #7
|
|||
|
|||
RE: eX-Robot. New Ideas and Solutions for Self Balancing Robot
Hy KomX,
are your Posted Codes are the Complete Code or it is just a Update, for better running? Lets Show us some Videos from your Robot or Pictures. Did you are running with a Pro Mini? Can you send me the Complete Code? Greetings from Germany Wampo |
|||
10-14-2015, 12:21 PM
(This post was last modified: 10-14-2015 12:27 PM by KomX.)
Post: #8
|
|||
|
|||
RE: eX-Robot. New Ideas and Solutions for Self Balancing Robot
(10-14-2015 10:54 AM)Wampo Wrote: are your Posted Codes are the Complete Code or it is just a Update, for better running? Placed in this topic codes only small routines and changes to the core code sketch version 1.2. You know, I tried to adapt the code for Pro Mini, making maximum use of hardware features and functionality inherent in the conclusions of the chip. So I still remains free SPI interface, for example. Additional analysis of the drivers of stepper motors allowed to carry out the direction of rotation control (DIR) one signal. Quote:Lets Show us some Videos from your Robot or Pictures. Unfortunately, the robot dismantled in anticipation of fundamental changes. Quote:Can you send me the Complete Code?Always! If it will help you ... PS. Added subroutine light status indication. PPS. Code of crude. Comments do not always correspond to the logic of the moment. PPPS. ".txt" Extension to remove |
|||
10-14-2015, 07:19 PM
Post: #9
|
|||
|
|||
RE: eX-Robot. New Ideas and Solutions for Self Balancing Robot
Hello KomX,
The "dir" link them together? How does a wheel to move forward and backward? Thank you greetings VL |
|||
10-14-2015, 08:14 PM
Post: #10
|
|||
|
|||
RE: eX-Robot. New Ideas and Solutions for Self Balancing Robot
(10-14-2015 07:19 PM)vlelectronic Wrote: Hello KomX, If you look at the documentation on the drivers of stepper motors, you will see that the signals "DIR" and "STEP" comes into the input register. And the logic of the scheme is run signal "STEP" and requires a steady level on the line "DIR" (0 or 1). After removal of the signal "STEP", you can arbitrarily change the signal "DIR" and this will not affect the driver of the motor. It is this behavior and was included in the program. Since the motor control signals generated in the interrupt routine, and by default Arduino nested interrupts are disabled, the interrupt routine for the left and right motors are processed sequentially, without affecting each other. Thus, if we require that the motors rotate in opposite directions, we expose one motor one signal "DIR" (the same signal is supplied and a second motor) and confirm its signal "STEP" for the engine (since the second motor signal "STEP" does not arrive, the driver of the motor does not "see" signal value "DIR" which it is not intended. Something like that ![]() |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)