Preamble: Arduino MEGA board is the best board to use - it has more memory, hardware serial ports and general IO ports than an UNO. A Mega clone can be bought on eBay for less than $17, so there is really no reason to get use an UNO unless you already have one.
If you want to use Roboclaw or Sabertooth and bluetooth for the CloneConsole Android application, then you must use the MEGA because two software serial ports cannot operate reliably on the Arduino.
================================================== ================================================== ==================
I have started a new thread to make it easy to find the latest release of my Segway Clone code. I intend to edit this post with each new release. Mizplix' original Segway Clone build thread is here
This compiles on Arduino IDE v1.0.2 or later. Older versions may not work.
You MUST read the README file for instructions.
Segway Clone for Arduino version history:
Fixed a few bugs with communication interface to CloneConsole Android app. Fixed intermittent "Error 11" on I2C bus.
Added new configuration parameters BOARD_OFFSET_DIVIDER and STEER_OFFSET_DIVIDER which specify remote control sensitivity.
Fixed compile error when using Bluetooth with non-MEGA boards. Added MOTOR_LR_RATIO (defined in Motors.h) to adjust power output between left and right motors.
Disabled alarm if voltage is below 5V (powered by USB). Added INVERT_STEERING option to swap left and right steering. Added FAN_PIN option to turn on fan output when temperature goes above TEMP_FAN_ON.
Added support for PWM dual-channel motor shield from Elechouse - select #define PWM_SHIELD_CONTROLLER in SegwayClone.h
Changed to inverse PWM for PWM_SHIELD_CONTROLLER. Added LOCKED_BY_DEFAULT option - unlock using CloneConsole Android app.
Fixed LOCK bug. Added ALARM_LOCKED beeper indicator.
Fixed FAN output bug. Added ROBOCLAW_ENCODER_CONTROLLER to support a Roboclaw with quadrature encoders.
Fixed compile error and multiplied Pf & Df by 10 when using ROBOCLAW_ENCODER_CONTROLLER.
Fixed compile error when BLUETOOTH is defined but not TEMPERATURE_SENSORS.
Fixed compile error when MIN_BATTERY_4 is decimal.
Added alarm for I2C error - long beep, short beep, long beep.
"Calibrate" via CloneConsole is now allowed regardless of motor speed when using USB power only (must have voltage sensor).
Fixed compile error when using ROBOCLAW_CONTROLLER or SABERTOOTH_CONTROLLER.
Changed serial baud rate from 38400 to 9600 for SABERTOOTH_CONTROLLER.
Bluetooth module is now supported with UNO + PWM controllers - connect bluetooth HC-06 TX to pin 5 and RX to pin 6. You can't enable VOLTAGE_LED with this configuration.
Added support for RIDER_SENSOR. Define the RIDER_SENSOR digital input pin, KP_OFF and KD_OFF for your controller in SegwayClone.h. Define MOTOR_MAX_OFF for your controller in Motors.h. Sensor must pull RIDER_SENSOR pin HIGH when rider is ON and pull it LOW when the rider is OFF.
Added support for low power L298N motor controller - select #define L298N_CONTROLLER in SegwayClone.h
Added option for INVERT_RIDER_SENSOR. This inverts the logic of the RIDER_SENSOR pin.
Fixed L298N motor controller code by removing "setPwmFrequency(HZ_3906)" during initialization.
Changed bluetooth baud rate to 19200 for non-Mega boards. Non-Mega users must first switch to CALIBRATE_MODE to re-program the HC-06 module.
Added software low-pass filter for voltage sensor.
Added support for HX711 weight sensor.
Added RIDER_SENSOR to telemetry sent to CloneConsole.
Added baud rate detection with bluetooth module.
Added internal pull-up of RIDER_SENSOR pin. This has the effect of inverting the RIDER_SENSOR logic.
Sensor must now pull pin to GND if rider is ON and leave it open or HIGH if rider is OFF.
Added internal pull-up of RX3 pin on MEGA board when using bluetooth module.
Fixed MAX_MOTOR for Roboclaw with encoder. Added support for forward/backward tilt control by defining POT_TILT_PIN.
Added center adjustment for POT_STEERING.
Added voltage and temperature sensing through Roboclaw serial commands.
Replaced standard blocking Wire library with non-blocking I2C module. Hopefully, this fixes locking of the Arduino!!!
Added timeout when waiting for data from Bluetooth interface.
Added support for WTV020 Voice module on Serial port #2.
Gyro and accelerometer are now both used to compute steering angle (more stable at high speed).
Added SUBTRACT_BANK_ANGLE option to compensate for terrain banking (available only if using MPU6050_X2_STEERING).
Fixed inverted steering angle gyro and bank angle gyro.
Added support for OSMC (Open Source Motor Controller) without MOB (Modular OSMC Brain) - #define OSMC_CONTROLLER.
Added option for exponential steering response - #define EXPONENTIAL_STEER_DIVIDER
Get the latest SegwayClone source from Github:
Sensors must be aligned such that the X axis is level and pointing to the front of the vehicle.
First schematic is for the Mega with 2 X BTN7960 controllers and 2 X MPU6050. Second schematic is for the UNO with Roboclaw and 2 X MPU6050.
CloneConsole for Android version history:
Improved GUI appearance.
Changed tilt and steer indicator to aircraft-style attitude indicator.
Added remote control option. Press the option menu to switch between "telemetry" and "remote control" screens.
Added "*" buton to swap between "telemetry" and "remote control" screens because option menu doesn't work as expected on some phones.
Fixed bug where P and D values can become negative. Increased P and D range by using exponential range, however, resolution decreases exponentially too.
Added scaling to fit the screen size.
Fixed scaling of remote control view.
Added Calibrate view. Fixed saving of P and D. Revamped remote control for more resolution and configurable sensitivity. Added "ACK"s to improve synch between Android and Arduino.
Added LOCK/UNLOCK feature.
Added RIDER_SENSOR support - screen is GRAY when rider is OFF and WHITE when rider is ON. P and D will be updated to OFF and ON values.
Fixed scaling for Calibrate & Lock view.