NicHub / stewart-platform-esp32

https://ouilogique.com/plateforme-de-stewart-esp32/
GNU General Public License v3.0
40 stars 19 forks source link

Troubleshooting Stewart platform. #2

Closed Jesseforeman3825 closed 6 months ago

Jesseforeman3825 commented 6 months ago

Thanks for offering to help! I’ve been at this for days. I didn’t know if I would be able to reach you. I have been reading through the code and can’t for the life of me figure out what I’m doing wrong. Here is a picture of the lay out on the breadboard I tried to mimic what you setup as close a possible. I changed the colors of the nunchuck wires plugging into the board when I soldered on my leads for connecting to the breadboard. That way I was easier for me to tell where the wires needed to go. The only thing in the code that comes up highlighted in yellow after compiling is this MLPrintLog and a few things related to that. But it still uploads. When I power the esp32 with a usb cable and power the pwm driver (5v 10a) it doesn’t move or home. I’m so glad you reached back out to me. thank you so very much!! Maybe with your help I’ll be able to get this going. image image image image image ![Uploading image.jpg…]()

NicHub commented 6 months ago

Hi Jesse, nice job. In order to check your wiring, can you scan your i²c bus with this:

https://github.com/NicHub/i2c_scanner

The scanner should say:

Scanning I2C bus...
0x41
0x52
Number of I2C devices found: 2
Jesseforeman3825 commented 6 months ago

I’m new to platformio. I created a new workspace and uploaded the i2c scanner then went to the serial monitor and I got it to communicate back one time saying there wasn’t any i2c devices found trying to run it again and I’m not getting anything back at all like it’s hung up. I’m doing something wrong. image

Jesseforeman3825 commented 6 months ago

I had to hit the button on the esp32 for it to run.. had no idea. This is what came back tho. image

Jesseforeman3825 commented 6 months ago

I tested continuity between the sda/ scl pins and the pwm driver as well as the nunchuck everything is is connected the pwm driver is getting power from both 3v the esp32 and the 5v supply. The nunchuck is getting 3v power also. The nunchuck gets a little warm after a while of being plugged in idk if that’s normal or not. So strange I feel like it should work. Lol I designed and machined my platform in aluminum. I want to put interchangeable ball mazes on in. It looks like the 3rd button click on the nunchuck makes it pitch and roll like I would want. I really like how you set everything up. Everything seems so straight forward. I’ll keep playing around it seems like it must be a hardware issue.

NicHub commented 6 months ago

OK, I’ve checked your wiring and from what I can see, it’s correct. The only difference I can see is the white wire connected from IO4 to VCC, which is not necessary but shouldn’t do any harm either. For the time being, it’s best to remove it.

I searched the internet for the error you get [E][esp32-hal-i2c.c:1434] i2cCheckLineState(): Bus Invalid State, TwoWire() Can’t init sda=0, scl=0 Number of I2C devices found: 0 and I found this page: https://github.com/espressif/arduino-esp32/issues/3079 There seems to be an electrical problem.

You also said that your Nunchunk was heating up, and I think that this is not normal. The first thing to do is remove the Nunchunk, plug in the PCA9685 driver only and scan the I²C again. The scanner should find a device at 0x41. If it finds it at 0x40, this means you need to change the I²C of the PCA9685 driver. See:

https://github.com/NicHub/stewart-platform-esp32?tab=readme-ov-file#prerequisites

If the PCA9685 driver is found, you can connect the Nunchuck alone. If it can’t be found, consider buying a Breakout adapter: https://www.adafruit.com/product/4836

You can also improve the robustness of the wiring by grouping the Nunchuck pins together with a 5 or 6 pin housing connector: https://www.aliexpress.com/item/1005006051227218.html.

Jesseforeman3825 commented 6 months ago

I already had one of the Adafruit adapters for the nunchuck for the project so I plugged that in and the address showed up with one device. I then tried another pwm driver and I have that operational now also. I uploaded the sketch and now the steppers home. Progress!! But the nunchuck won’t operate. I’ve tried clicking all the buttons and moving the stick. Maybe there is something I need to uncomment? Also it appears there are 3 device addresses. I’m guessing the adafruit board for the nunchuck has an address of its own? We are getting there :)

On Sun, Apr 14, 2024 at 2:36 AM NicHub @.***> wrote:

OK, I’ve checked your wiring and from what I can see, it’s correct. The only difference I can see is the white wire connected from IO4 to VCC, which is not necessary but shouldn’t do any harm either. For the time being, it’s best to remove it.

I searched the internet for the error you get [E][esp32-hal-i2c.c:1434] i2cCheckLineState(): Bus Invalid State, TwoWire() Can’t init sda=0, scl=0 Number of I2C devices found: 0 and I found this page: espressif/arduino-esp32#3079 https://github.com/espressif/arduino-esp32/issues/3079 There seems to be an electrical problem.

You also said that your Nunchunk was heating up, and I think that this is not normal. The first thing to do is remove the Nunchunk, plug in the PCA9685 driver only and scan the I²C again. The scanner should find a device at 0x41. If it finds it at 0x40, this means you need to change the I²C of the PCA9685 driver. See:

https://github.com/NicHub/stewart-platform-esp32?tab=readme-ov-file#prerequisites

If the PCA9685 driver is found, you can connect the Nunchuck alone. If it can’t be found, consider buying a Breakout adapter: https://www.adafruit.com/product/4836

You can also improve the robustness of the wiring by grouping the Nunchuck pins together with a 5 or 6 pin housing connector: https://www.aliexpress.com/item/1005006051227218.html.

— Reply to this email directly, view it on GitHub https://github.com/NicHub/stewart-platform-esp32/issues/2#issuecomment-2053947264, or unsubscribe https://github.com/notifications/unsubscribe-auth/BHZXFOCZZNP5URXC6W5AKEDY5IWW7AVCNFSM6AAAAABGFXGM3WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJTHE2DOMRWGQ . You are receiving this because you authored the thread.Message ID: @.***>

NicHub commented 6 months ago

If you see 3 I²C addresses, that is probably because the scanner discovered the Nunchuck IMU (inertial measurement unit). In my case the scanner finds only the joystick part of the Nunchuck. I documented the addresses here:

https://github.com/NicHub/stewart-platform-esp32?tab=readme-ov-file#ic-addresses


In platformio.ini you can set SEND_NUNCHUCK_INFO_TO_SERIAL=true and check in the serial monitor if you get some outputs like below. Set back to SEND_NUNCHUCK_INFO_TO_SERIAL=false when you’re done, because this slows down the ESP.

joy_x = -0.09 | joy_y = 0.09 | btn_c = 0 | pitch_angle = 0.00 | roll_angle = -0.02 | joyMode = 0


In main.cpp, you can also add some demo at start below demoMov_circles:

    hx_demo.demoMov_circles(DEMO_CIRCLES_NB_TURN);
    hx_demo.demoMov_MinMaxAllAxis();
    hx_demo.demoMov_shakeHeave();

You can also test if the platform can be operated with gcode program. Change the settings in platformio.ini: ENABLE_SERIAL_READ=true then open a terminal, go to the gcode2serial directory and launch the python program that send the gcode commands to the platform. You’ll need to change <SERIAL PORT> with the ESP32 serial port, i.e. something like COMx, where x is a number.

cd <gcode2serial>
py gcode2serial.py -p <SERIAL PORT> -f demo_123.gcode
Jesseforeman3825 commented 6 months ago

I get a message in the serial monitor that says “NUNCHUCK NOT CONNECTED! ABORTING”

When I ran the i2c scanner again with it shows up with 2 addresses when using a non Nintendo nunchuck and 16 with a Nintendo original nunchuck. Both sticks give me the same serial monitor message saying nunchuck not connected…

On Sun, Apr 14, 2024 at 4:42 AM NicHub @.***> wrote:

If you see 3 I²C addresses, that is probably because the scanner discovered the Nunchuck IMU (inertial measurement unit). In my case the scanner finds only the joystick part of the Nunchuck. I documented the addresses here:

https://github.com/NicHub/stewart-platform-esp32?tab=readme-ov-file#ic-addresses

In platformio.ini you can set SEND_NUNCHUCK_INFO_TO_SERIAL=true and check in the serial monitor if you get some outputs like below. Set back to SEND_NUNCHUCK_INFO_TO_SERIAL=false when you’re done, because this slows down the ESP.

joy_x = -0.09 | joy_y = 0.09 | btn_c = 0 | pitch_angle = 0.00 | roll_angle = -0.02 | joyMode = 0

In main.cpp, you can also add some demo at start below demoMov_circles:

hx_demo.demoMov_circles(DEMO_CIRCLES_NB_TURN);
hx_demo.demoMov_MinMaxAllAxis();
hx_demo.demoMov_shakeHeave();

You can also test if the platform can be operated with gcode program. Change the settings in platformio.ini: ENABLE_SERIAL_READ=true then open a terminal, go to the gcode2serial directory and launch the python program that send the gcode commands to the platform. You’ll need to change <SERIAL PORT> with the ESP32 serial port, i.e. something like COMx, where x is a number.

cd py gcode2serial.py -p -f demo_123.gcode

— Reply to this email directly, view it on GitHub https://github.com/NicHub/stewart-platform-esp32/issues/2#issuecomment-2053986157, or unsubscribe https://github.com/notifications/unsubscribe-auth/BHZXFOH3KQGXMDJBGGAYTULY5JFPVAVCNFSM6AAAAABGFXGM3WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJTHE4DMMJVG4 . You are receiving this because you authored the thread.Message ID: @.***>

NicHub commented 6 months ago

@VeridisQuo555 had the same problem. The solution is here:

https://github.com/NicHub/stewart-platform-esp32/commit/70c877b3a3799f55ff35377e91e9853d12088188#commitcomment-140810861

NicHub commented 6 months ago

I’ve updated the photos showing the wiring. I’ve removed the red wire that wasn’t serving any purpose and added a 10 µF capacitor. It allows the ESP to be flashed without having to press the BOOT button.

https://ouilogique.com/files/2019-03-27-plateforme-de-stewart-esp32/images/2024-04-14-proto-plateforme-de-stewart_001.jpg

https://ouilogique.com/files/2019-03-27-plateforme-de-stewart-esp32/images/2024-04-14-proto-plateforme-de-stewart_002.jpg

Jesseforeman3825 commented 6 months ago

I hooked up the 3v out on the nunchuck breakout to the IO4 and still get the same message.

On Sun, Apr 14, 2024 at 9:29 AM NicHub @.***> wrote:

I’ve updated the photos showing the wiring. I’ve removed the red wire that wasn’t serving any purpose and added a 10 µF capacitor. It allows the ESP to be flashed without having to press the BOOT button.

https://ouilogique.com/files/2019-03-27-plateforme-de-stewart-esp32/images/2024-04-14-proto-plateforme-de-stewart_001.jpg

https://ouilogique.com/files/2019-03-27-plateforme-de-stewart-esp32/images/2024-04-14-proto-plateforme-de-stewart_002.jpg

— Reply to this email directly, view it on GitHub https://github.com/NicHub/stewart-platform-esp32/issues/2#issuecomment-2054080125, or unsubscribe https://github.com/notifications/unsubscribe-auth/BHZXFOA7XC655BMY4ATEWOTY5KHEFAVCNFSM6AAAAABGFXGM3WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJUGA4DAMJSGU . You are receiving this because you authored the thread.Message ID: @.***>

NicHub commented 6 months ago

Then in Hexapod_Nunchuck.cpp add return; at the beginning of void Hexapod_Nunchuck::stopIfNotConnected(). This will disable the Nunchuck presence check.

Jesseforeman3825 commented 6 months ago

I hooked the 3v output pin on the nunchuck breakout to IO35 that’s how you have it configured in hexapod_nunchuck.cpp Now it’s working great!! Thanks so much for all the help. Do you have a PayPal account, or a way I can donate you some money for your work? On Sun, Apr 14, 2024 at 10:59 AM NicHub @.***> wrote:

Then in Hexapod_Nunchuck.cpp add return; at the beginning of void Hexapod_Nunchuck::stopIfNotConnected(). This will disable the Nunchuck presence check.

— Reply to this email directly, view it on GitHub https://github.com/NicHub/stewart-platform-esp32/issues/2#issuecomment-2054106170, or unsubscribe https://github.com/notifications/unsubscribe-auth/BHZXFOC6UQX6QRRDISI7ITLY5KRWBAVCNFSM6AAAAABGFXGM3WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJUGEYDMMJXGA . You are receiving this because you authored the thread.Message ID: @.***>

NicHub commented 6 months ago

Oops, I actually said it was pin IO4 when it’s actually pin IO35. Thanks for seeing the error. I modified the README file accordingly:

https://github.com/NicHub/stewart-platform-esp32/commit/465158052f087d228912452f70813cfca209f2d7?diff=unified&w=1

Thank you also for offering to give me a donation, it’s the first time it’s happened to me and it makes me super happy. Here’s the link to transfer money to my PayPal account:

https://paypal.me/NicolasJeanmonod

I am also glad to read that the project works for you. For the future, it would be great if you could fork the project so that the community can see how your version is evolving.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo

You could also set up a blog to publish photos and videos, like me on ouilogique.com.

https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll

As an example, you can read the translation of my page on the Stewart Platform here:

https://ouilogique-com.translate.goog/plateforme-de-stewart-esp32/?_x_tr_sl=fr&_x_tr_tl=en

Jesseforeman3825 commented 6 months ago

I sent you some money so check your PayPal. I really appreciate your hard work. This is a stellar project to share with the world expecting nothing in return. You should be rewarded for your skills , efforts, and generosity. I’ll definitely consider posting the platform in its final form once it’s all done. I’m going to make a pcb for it all and mount it onto my platform. Thanks so much again for the help. How would I go about inverting the forward backward movements? (So it’s not like flying a plane)

On Sun, Apr 14, 2024 at 12:24 PM NicHub @.***> wrote:

Oops, I actually said it was pin IO4 when it’s actually pin IO35. Thanks for seeing the error. I modified the README file accordingly:

4651580?diff=unified&w=1 https://github.com/NicHub/stewart-platform-esp32/commit/465158052f087d228912452f70813cfca209f2d7?diff=unified&w=1

Thank you also for offering to give me a donation, it’s the first time it’s happened to me and it makes me super happy. Here’s the link to transfer money to my PayPal account:

https://paypal.me/NicolasJeanmonod

I am also glad to read that the project works for you. For the future, it would be great if you could fork the project so that the community can see how your version is evolving.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo

You could also set up a blog to publish photos and videos, like me on ouilogique.com.

https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll

As an example, you can read the translation of my page on the Stewart Platform here:

https://ouilogique-com.translate.goog/plateforme-de-stewart-esp32/?_x_tr_sl=fr&_x_tr_tl=en

— Reply to this email directly, view it on GitHub https://github.com/NicHub/stewart-platform-esp32/issues/2#issuecomment-2054127403, or unsubscribe https://github.com/notifications/unsubscribe-auth/BHZXFOEUNYYEZTROLE6DMG3Y5K3WNAVCNFSM6AAAAABGFXGM3WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJUGEZDONBQGM . You are receiving this because you authored the thread.Message ID: @.***>

Jesseforeman3825 commented 6 months ago

The pitch up and down is what I’d like to invert.

On Sun, Apr 14, 2024 at 12:24 PM NicHub @.***> wrote:

Oops, I actually said it was pin IO4 when it’s actually pin IO35. Thanks for seeing the error. I modified the README file accordingly:

4651580?diff=unified&w=1 https://github.com/NicHub/stewart-platform-esp32/commit/465158052f087d228912452f70813cfca209f2d7?diff=unified&w=1

Thank you also for offering to give me a donation, it’s the first time it’s happened to me and it makes me super happy. Here’s the link to transfer money to my PayPal account:

https://paypal.me/NicolasJeanmonod

I am also glad to read that the project works for you. For the future, it would be great if you could fork the project so that the community can see how your version is evolving.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo

You could also set up a blog to publish photos and videos, like me on ouilogique.com.

https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll

As an example, you can read the translation of my page on the Stewart Platform here:

https://ouilogique-com.translate.goog/plateforme-de-stewart-esp32/?_x_tr_sl=fr&_x_tr_tl=en

— Reply to this email directly, view it on GitHub https://github.com/NicHub/stewart-platform-esp32/issues/2#issuecomment-2054127403, or unsubscribe https://github.com/notifications/unsubscribe-auth/BHZXFOEUNYYEZTROLE6DMG3Y5K3WNAVCNFSM6AAAAABGFXGM3WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJUGEZDONBQGM . You are receiving this because you authored the thread.Message ID: @.***>

NicHub commented 6 months ago

You can invert the coordinates in Hexapod_KinematicsCalcServoAnglesAlgo3.cpp at the beginning of Hexapod_Kinematics::calcServoAngles. To make it like flying a plane, I guess you need to invert roll and pitch. Check it out.

int8_t Hexapod_Kinematics::calcServoAngles(platform_t coord, angle_t servo_angles[])
{
    // coord.hx_x = -coord.hx_x; // Invert Surge
    // coord.hx_y = -coord.hx_y; // Invert Sway
    // coord.hx_z = -coord.hx_z; // Invert Heave
    coord.hx_a = -coord.hx_a; // Invert Roll
    coord.hx_b = -coord.hx_b; // Invert Pitch
    // coord.hx_c = -coord.hx_c; // Invert Yaw

    ...
NicHub commented 6 months ago

@Jesseforeman3825 I’m closing this issue since it’s resolved. Thanks again for your gift, I still can’t believe it. Don’t hesitate to open new issues if you have any questions. I hope you’ll make a fork of the project and that we’ll soon be able to see your creations.

Jesseforeman3825 commented 6 months ago

Thank you so much for the help. I was stuck. I’ll be sure to reach out if I have questions. When I get further along on the project I’ll totally share it with you guys.

On Mon, Apr 15, 2024 at 10:10 AM NicHub @.***> wrote:

@Jesseforeman3825 https://github.com/Jesseforeman3825 I’m closing this issue since it’s resolved. Thanks again for your gift, I still can’t believe it. Don’t hesitate to open new issues if you have any questions. I hope you’ll make a fork of the project and that we’ll soon be able to see your creations.

— Reply to this email directly, view it on GitHub https://github.com/NicHub/stewart-platform-esp32/issues/2#issuecomment-2057095712, or unsubscribe https://github.com/notifications/unsubscribe-auth/BHZXFOHJA4X24VF52QNOEPTY5PUWPAVCNFSM6AAAAABGFXGM3WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJXGA4TKNZRGI . You are receiving this because you were mentioned.Message ID: @.***>

NicHub commented 6 months ago

@Jesseforeman3825, you might be interested in this issue :

https://github.com/NicHub/stewart-platform-esp32/issues/4