-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UART Control Scheme and acceleration #75
Comments
I too am working on getting control of the driver via UART for a differential bot. A write-up, a ino, or samples of python script would be much appreciated! I bought the hoverboard-breakout board here: Thanks! |
Hey @wholepair , The interconnect matrix can be used for UART board to board communication. You can just connect RX to TX and TX to RX between to mainboards. But we've never used that feature, therefore we didn't write code for that. (Also I don't really know if somebody else did it) |
https://github.com/AntumArk/hoverboard-firmware-dual/tree/newprotocol/HoverSerial Here is Arduino code for communications. I used BluePill(STM32f103). And as @Jan--Henrik said, you just need to connect TX, RX and GND to your sender. You can also try using Bluetooth module for this communication, but just be careful to use 3.3v. |
Please be careful with the default UART implementation. There is no feature to validate the input, you can get really bad speed values when there are disturbances on the RX line (which are to be expected, in noisy motor control). As for the values -1000 to 1000: This is the duty cycle for the motors. -1000 represents 100.0% duty cycle (full speed) backwards. |
Thanks for the info @p-h-a-i-l |
So I took some time and modified serial communication code. As far from all of my tests it's smooth even for poorly connected data lines. Motors stops if data lines are disconnected You can find the code in my fork here: |
So I took some time and modified serial communication code on original NiklasFauth respository. As far from all of my tests it's smooth even for poorly connected data lines. Motors stops if data lines are disconnected. Reconnection also works well. You can find the code in my fork here: |
Hi there,
First off, your firmware is awesome! I have tried controlling using ADC inputs but I am wanting to just use UART control because ADC is only single directional. My question is what range of values do I send to the controller to control? I understand I have to use:
Serial.write((uint8_t *) &turn, sizeof(turn));
Serial.write((uint8_t *) &velocity, sizeof(velocity));
delay(10);
When controlling with arduino 3.3v but I do not understand what the "turn" and "velocity" values should be. Are they int's or bytes or char's or what? Also, what is the range of these values? Is it like -20 to 20 or -10000 to 10000? I cannot find in the config.h or in the other files I've read through what sort of values to send to the control board. Also, other than the bobbycar version, are there any acceleration settings built in or do I need to send increasing velocity values over a certain time frame, calculated by my arduino?
I really appreciate any input or info about the UART control input setup that anyone can give because currently I feel lost. Thank you
The text was updated successfully, but these errors were encountered: