The Sain Smart v3 balance robot is an inverted pendulum. Technically, you can use the hardware from this robot, combined with ARC, to balance any robot - with enough patience to configure PID values. The kit includes an Arduino Mega with a shield for the MPU6050 IMU. The custom firmware below allows ARC to connect to this robot and control it via the Inverted Pendulum movement panel.
Setup
- Download EZ-Mega v1 Balance Robot Sourcecode (Feb 4, 2019)
- Tutorial to compile the source code and upload the firmware to the SainSmart Mega Arduino
- Add the ARC Inverted Pendulum Skill to your ARC project
Connection Types
The firmware can use either USB or Bluetooth, depending on the configuration. The top of the firmware has a configuration section that specifies the communication port and baud rate.
Example of configuration for USB
This configuration example is for USB at 115,200 baud.
// The communication baud rate #define _BAUD_RATE 115200 // The primary communication interface between ARC and this controller // Serial - USB (recommended 115200 baud) // Serial1 - 19(RX), 18(TX) <- do not use because pin 18 is used by wheel encoder // Serial2 - 16(RX), 17(TX) <- recommended for bluetooth dongle // Serial3 - 15(RX), 14(TX) #define COMMUNICATION_PORT Serial
Example of configuration for BlueTooth add-on
This configuration example is for a Bluetooth module connected to Serial port #2 at 9600 baud. In this case, the respective RX & TX wires would be connected from the MEGA to the Bluetooth module. Of course, the TX on MEGA would be connected to RX on Bluetooth. The same applies to the RX on MEGA connecting to TX on Bluetooth.
// The communication baud rate #define _BAUD_RATE 9600 // The primary communication interface between ARC and this controller // Serial - USB (recommended 115200 baud) // Serial1 - 19(RX), 18(TX) <- do not use because pin 18 is used by wheel encoder // Serial2 - 16(RX), 17(TX) <- recommended for bluetooth dongle // Serial3 - 15(RX), 14(TX) #define COMMUNICATION_PORT Serial2
I assume the communication is going through a ESP8266 on the bot? Contacted the company to purchase one of the shields (to build myself) but was told it was discontinued You must have to buy the whole bot from them now.
Thanks in advance.
Yeah - we should be able to recreate the same build with DIY parts. The shield is merely an HBridge, but you can use any hbridge (specifically the EZ-Robot one). The IMU it uses is the MPU6050.
As for wireless... I'm actually using a Bluetooth <-> UART module. The same ones that were on the EZ-B v3.
Can i use this for esp32