JJRobots COMMUNITY

Full Version: Only You, or ESP8266 Forever!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7
Ok!
MPU6050 can be powered by 5 or 3.3 volts.
How to convert sonar wrote in Russian here.
Servo operation from 3.3 V not tested - may need adjustment time intervals.
I include photos

for Komx,
The sonar module powered a 3v3 and changing the divider works well? It has the SAME accuracy?
regards
Hello,
I have a different sonar module, attached you will find the schematic. I always have to make changes?
Greetings
Hello, vlelectronic!

About HC-SR04:
Resistors R5 and R6 in my unit correspond to the resistors R16 and R10 in your module. Recommendations for replacement options are similar to the data for my unit.

About ESP-12:
Have you solved the problem with the programming module ESP-12?
Have you properly select the basic module firmware?
I did so:
[attachment=172]
Hello Komx,
I downloaded the files from github, and touch osc in Russian works but not the distance, I realized that the firmware you've put in your app is slide label instead.
The app does not work in English, the parameters are different, you have some change?
Esp about the form I solved the problem, but I had to do it to Rolfz scheme.
About the sonar I have not done anything
Greetings
Hello vlelectronic,
I used the standard commands "fader", "toggle", "push".
New command "ping" (activated in the menu), only requests battery parameters once per minute.
You can always create your own version of the screen, studying materials http://hexler.net/software/touchosc site.
Hello komx

I used your code..
I have the below setup.

Nema 17 1.8'
Wemos D1 R1
CNC Shield
MPU6050 break out board
Lipo 11.1v 1A

used 1/8 micro stepping.
(1/16 micro stepping is not working for me.. Motor buzzing and no movement if loaded)

Used GPIO16 for Xstep ( moved the sonar pins to 9 and 10 but not used)

Some modification to suit for CNC shield
////////////////////// X motor Step pin ////////////////////////////////////
#define PIN_LOW1(x) (GP16O &= ~1)
#define PIN_HIGH1(x) (GP16O |= 1)

PIN_LOW1(MOTOR1_STEP_PIN);
///////////////////////////////////////////////////////

After initial hiccups the robot started working ... it can balance now.. but the back and forth oscillation picks up occasionally and goes down.

TouchOSC getting connected but not working....

whether sonar detection will stop the movements for robot.?


Regards,
Shivakumar

for TouchOSC not working I have put a debug serial print.

throttle = (fadder[0] - 0.5) * max_throttle;
steering = fadder[1] - 0.5;
if (steering > 0)
steering = ( steering * steering + 0.5 * steering) * max_steering;
else
steering = (-steering * steering + 0.5 * steering) * max_steering;
Serial.print("throttle : ");
Serial.println(throttle);

Serial.print("steering : ");
Serial.println(steering);


When slider is changed i am getting only 0 for throttle & steering
throttle : 0.00
steering : 0.00
I think there is an error in eX_ESP_OSC.h

/////////////////////////////////
if (PacketBuffer[3]=='f') // команда FADER
{
fadder[int(PacketBuffer[8] - 49)] = OSC_Extract_Param(PacketSize);
///////////////////////////////

it suppose to be....
fadder[int(PacketBuffer[8] - 48)] = OSC_Extract_Param(PacketSize);
---


Now the App is working .....

Running without any issue when doing manual controlling..
Pro mode works very well.



Remaining issues...

When no movement stand still only for about 20s to 30s... then all of a sudden losing balance and it is falling down.
when controlling with app occasionally..it is going out of balance...and it is falling down.
Left * right rotation is rock soilid but front and back is not very stable.. sudden change of direction makes it to falldown.
sometimes it seems to be error and stop balancing and falling down..

will come back with PICs and Videos.

Shivakumar

Special Thanks to citronium for his wonderful documentation on CNC shield wiring..saved me lots of time consuming work.
Hi, Shivakumar.

Quote:used 1/8 micro stepping.
(1/16 micro stepping is not working for me.. Motor buzzing and no movement if loaded)

The latest revisions of the frequent references to skip steps when starting motors I added zeroing variable PID_errorSum in this section of code eX_ESP_Robot.ino:
Code:
else   // Robot not ready (flat), angle > 70º => ROBOT OFF
    {
      PIN_HIGH(MOTORS_ENABLE_PIN);    // драйвера не активны
      PID_errorSum = 0;  // Reset PID I term
      control_output = 0;
      Kp = KP_RAISEUP;   // CONTROL GAINS FOR RAISE UP
      Kd = KD_RAISEUP;
      Kp_thr = KP_THROTTLE_RAISEUP;
      Ki_thr = KI_THROTTLE_RAISEUP;

      // if we pulse push1 button we raise up the robot with the servo arm
      if (push[0])
      {
        // Because we know the robot orientation (face down of face up), we move the servo in the appropiate direction for raise up
        if (angle_adjusted>0)
          te_SetServo(SERVO_MIN_PULSEWIDTH);
        else
          te_SetServo(SERVO_MAX_PULSEWIDTH);
      }
      else
        te_SetServo(SERVO_AUX_NEUTRO);

}

Can it comment out to restore the original reaction of the robot during its ascent ...

I can not give more detailed advice, so do not have information about the operating conditions of your motors.

Quote:Used GPIO16 for Xstep ( moved the sonar pins to 9 and 10 but not used)

Some modification to suit for CNC shield
/// X motor Step pin ///
#define PIN_LOW1(x) (GP16O &= ~1)
#define PIN_HIGH1(x) (GP16O |= 1)

PIN_LOW1(MOTOR1_STEP_PIN);

Replacement pins for alternative hard for me to comment because the choice of a pin, I shall be guided by the ESP capabilities and insufficiently documented its operating logic.
In particular, GPIO16 was put on the gate of the ultrasonic range finder due to the fact that the latter is not so important in the normal operation of the robot (many do not use it at all), and due to the fact that the module firmware uses for its work GPIO2 and GPIO16.

Quote:I think there is an error in eX_ESP_OSC.h

///////////////////////////////
if (PacketBuffer[3]=='f') // команда FADER
{
fadder[int(PacketBuffer[8] - 49)] = OSC_Extract_Param(PacketSize);
///////////////////////////////

it suppose to be....
fadder[int(PacketBuffer[8] - 48)] = OSC_Extract_Param(PacketSize);
---
Now the App is working .....

The resulting variables fadder[x] are stored in the four-dimensional arrays with indices 0 ... 3.
Because the OSC receives command "fader1", "fader2", "fader3" and "fader4" (On the one letter "d"!)
Therefore, to obtain the correct index is subtracted 49. You're subtracting 48, receive the wrong code and error execute commands on the second page of the control, where all four controls are used.
The error is not likely in the sketch and in the incorrect recording of names of commands used in your layout file.

Quote:When no movement stand still only for about 20s to 30s... then all of a sudden losing balance and it is falling down.
when controlling with app occasionally..it is going out of balance...and it is falling down.
Left * right rotation is rock soilid but front and back is not very stable.. sudden change of direction makes it to falldown.
sometimes it seems to be error and stop balancing and falling down..

Basically everywhere sketch (eX_ESP_Robot.ino) is processed fadder[0] as throttle and fadder[1] as steering. What happens to you after you replace 49 to 48 I do not presume to analyze.

Sincerely, KomX.
Forgive inadequate machine translation.
Dear Komx,

Tks for the reply.

you are right. the osc layout actually sending

fadder0 for forward/backward
fadder1 for left/right.

so for me it works good if i subtract 48.

i will comment out the PID_errorSum=0 in the sketch....will see how it works,
seems GP16O direct access as above works good so i leave and move on.

will update...

if you have any suggestion on the PI and PD coefficients pls let me know.
#define KP 0.19 // alternative values: 0.20, 0.22
#define KD 26 //28 //30 // 26 28
#define KP_THROTTLE 0.07 // 0.065, 0.08
#define KI_THROTTLE 0.04 // 0.05

Regards
shivakumar
Pages: 1 2 3 4 5 6 7
Reference URL's