Tuesday, May 7, 2013

Finally driving my robot, but it reboots the raspberry pi!

Finally driving, remote controlling the driving through serial commands over wireless network.

Tonight I started to work on code that is driving the H-bridge. The Arduino board is controlling the H-Bridge and I program the Arduino using the Arduino IDE remotely on the robot using VNC. The intended approach is that a program on the Raspberry Pi sends commands to the Arduino over the serial port.

I wrote a little sketch that receives "aswd" letters and drives the H-bridge. The letter 'a' results in 200 milliseconds of turning left, the letter 'd' results in similar time of turning right,'w' is forward, and 's' is backwards.

A first problem is that when I run the motors for a little time the RPi is rebooting, I guess it must be due to current drop or something. I do run the robot directly from the same battery pack as all the other components. Maybe a large cap can solve this? Another solution would be to have another battery just for the motors. For now it seems I can run the robot with lower PWM...

A second problem is that the motors seem to have uneven resistance, this results in the robot turning slightly. I can adjust this by giving the different engines different PWM signals but in order to get good results this must be tuned by experiments. The third wheel also interfers, its a turn-able wheel so when it is in the wrong direction it requires more resistance to turn.

For this project I use github repository, Im not very used to the shell commands so here they are for documentation
git repo https://github.com/dntoll/robot/tree/master/H_bridge
cd sketchbook
git add H_bridge/*
git commit -m "some comment"
git push origin master

No comments:

Post a Comment