btsimonh / hoverboard-firmware-hack

New Hoverboard Firmware Hack. Now written from scratch and generally much better.
GNU General Public License v3.0
22 stars 4 forks source link

ADC control: Best way to use speed and steer #14

Open bshowket opened 5 years ago

bshowket commented 5 years ago

I want to use pwm from Arduino due to control speed and digital IO to control direction for each wheel. I understand I have to modify the code to suits. But before jumping in to code, i was wondering if there any solution already implemented?

btsimonh commented 5 years ago

hi @bshowket, so, if i interpret correctly, you will use the arduino to interpret PWM (e.g. from a servo output of a remote control), and will generate commands from the arduino to the hoverboard controller in the form of the 'machine protocol'? It's worth looking through the original (and asking there) to see if PWM was supported directly - I don't recall. In terms of using THIS repo, you can implement the machine protocol on arduino; you may need to adjust the code here to get the exact type of control you want (add a command) - please do a PR if you do :). s

bshowket commented 5 years ago

You are right. I want to drive the wheel individually based on gyro, GPS and external encoder input for more precise control which all take place in Arduino due. My programming skill is not great but willing to give it a try on my spare time. as far as I understand it would be taken out calculation from the code and maybe use Rx1& rx2 for speed and tx1 for the direction. This how still be able to use serial debug on tx2 pin. Can you point me where the speed to output to wheel take place? Thanks anyway.

btsimonh commented 5 years ago

from the machine protocol, you should be able to read position to ~6mm (resolution of hall). But you may be better thinking about why we can't achieve this with the position drive. Also, be aware of the 'dead reckoning' code I added a few months back. may be useful. For serial, if you want sensors, use software serial.

sebastienvg commented 4 years ago

@btsimonh how does one use software serial, where to you wire it if you keep both sensor boards? I looked at the picture and I can't figure where you tap the software serial and also how to find out the pin number. If you can shade any light that would be appreciated.

btsimonh commented 4 years ago

I was lucky with my YST board, as some usable pins were obvious (see pictures ). It has been suggested that the buzzer and LED pins could be used on any board, as all boards have them... Apart from that, look at unused component sites, and use a meter to buzz back to CPU. If you find some, but they are very small, then glue a connector to the board firmly, and solder very fine wires between the component sites and the connector.