EFeru / hoverboard-firmware-hack-FOC

With Field Oriented Control (FOC)
GNU General Public License v3.0
1.12k stars 932 forks source link

E-bike single wheel and serial Feedback #370

Open GioeleM95 opened 1 year ago

GioeleM95 commented 1 year ago

Variant

USART

Control type

None

Control mode

None

Description

Hi! Congratulations for the excellent work!

I have a blocked e-bike project... please help! I'm using the VARIANT_USART with Arduino. I use a single motor (// MOTOR_LEFT_ENA) but the serial feedback doesn't seem to work if I use only one wheel, on the serial monitor it shows: "Non-valid data skipped".
With both wheels, the serial feedback works perfectly. Can it be the structured of the feedback from the firmware? Thanks so much!

Candas1 commented 1 year ago

Hi,

This works the same way with 1 or 2 motors. Data can be skipped if the checksum is not valid, which can happen if the signal is bad. What arduino are you using ? I think the initial arduino sketch is using software serial by default but using hardware serial is much better. https://github.com/EFeru/hoverboard-firmware-hack-FOC/blob/efb438bf514c9f8c80471f79ab87d2f7099746ea/Arduino/hoverserial/hoverserial.ino#L10

GioeleM95 commented 1 year ago

Mmmm🤔 I'm using Arduino nano with softwareserial the send() works and I can set the speed, I will also try to use the hardware serial, and I will also try another board (hoverboard and Arduino) to get rid of doubts about hardware malfunctions... it makes sense to try it too USART2 at 3.3v?

Candas1 commented 1 year ago

Check the wiki If you have a ftdi you can try the webtool from a computer If this works well, you have a problem with your arduino set up

RoboDurden commented 1 year ago

Arduino Nano and software serial need 19200 baud, 115200 is to much !! Better go with an esp32 S2 mini :-)

GioeleM95 commented 1 year ago

I used the hardware serial, everything seems to work fine, thanks for the tips. The software serial didn't make it, this is strange because with another board the software serial worked great 🤷🏻‍♂️. The only problem is that every time I have to update the Arduino sketch, I will have to disconnect TX and RX... do you know any solution to avoid disconnecting them as the software serial allowed?

RoboDurden commented 1 year ago

Better go with esp32 as it has three hardware serial ports. Arduino nano only has one and you have to disconnect when flashing Arduino. I drive my solar car with Arduino mini and software serial at 19200 baud.