I'm working on a self balancing unicycle using this
http://www.instructables.com/id/Easy-build-self-balancing-skateboardrobotsegway-/ instructable as a guide and using a Syren 25a motor controller
http://www.dimensionengineering.com/SyRen25.htm. When I finally wired everything up and tested my modified version of his code the motor went crazy and didn't do anything I expected. I tried various stuff to get some decent result out of the motor controller and failed.
So I tried to write a code to check the Syren is functioning properly and the motor was still not behaving as I expected. so I tried to most basic code I can think of to get the Syren to do as it is told.
From the Syren instructions it says
"Simplified serial mode uses TTL level RS-232 serial data to set the speed and direction of the
motor. This is used to interface the SyRen to a PC or microcontroller. If using a PC, a level
converter such as a MAX232 chip must be used. The baud rate is set via DIP switches.
Commands are single-byte, with 0 representing full reverse and 255 representing full forward.
There is also a Slave Select mode which allows the use of multiple motors from a single
microcontroller serial port."
Im using a Seeeduino V2.21 (
http://www.seeedstudio.com/depot/seeeduino-v221-atmega-328p-p-669.html?cPath=132_133)
The Syren s1 is connected to TX on the seeeduino
and Syren 0c is connected to Gnd on the Seeeduino
Battery's and motor are connected as instructed and DIP switches have been double triple and quadruple checked.
I'm trying to control the Syren in simplified serial mode.
The seeeduino is not showing any signs of being sick .. it output's to the serial window perfectly and apart from the Syren problem does everything I ask it to do.
Here is my sketch
Ive tried
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.print(200); // forward
delay (10000);
Serial.print(127); // idle
delay (10000);
Serial.print(50); // reverse
delay (10000)
}
and Ive tried
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.write(200); // forward
delay (10000);
Serial.write(127); // idle
delay (10000);
Serial.write(50); // reverse
delay (10000)
}
Neither had the effect I was expecting .. the motor sped up and slowed down (almost but not completely to a stop) but didn't change direction and didn't appear to do whatever it was doing every 10 seconds.
I've distilled the code down to the bare minimum needed to test the hardware. I just need someone to confirm that I'm not doing something basically wrong. or connecting something wrong somewhere.
I'm tearing my hair out here. I'm so close to testing and I feel like either a stupidly simple coding error or a silly hardware problem is holding me back.
If I'm having this much trouble just getting to motor to do as it's told then I dont stand a chance getting everything else working.
I've sent an email to dimension engineering and they sent me a simple test to do involving setting all the DIP switches to the ON position and using a piece of wire to jump s1-5v and s1-0v and I havn't heard anything back since I replied with the results.
Thanks for any help you guys might be able to offer.