My second rover is coming together. The advantage of a ground rover is that it cannot fall out of the sky, so one tends to get rather more hours of amusement out of it than from a helicopter or fixed wing toy aircraft.
The first rover worked, but it was too complicated. The problem with all toy projects is that I tend to forget what I was doing with it and I like to 'work' on multiple things at the same time. My shop currently has a glider, a valve guitar amplifier, a VU meter, multiple radio transceivers and this rover all in various stages of incompletion. Therefore any project needs to be modular and simple, so that I can see what is going on at a glance. Otherwise, it ends up in a corner, gathering dust, rather sooner than later.
Rover #2 uses the Sparkfun Arduino Redboard for its brains and it is meant to be completely autonomous. Addition of RC makes it too complicated and hard to maintain, so I ripped all that out (and it can now go back into the 2m electric glider!).
I re-used the Pololu 100:1 geared DC motors, enormous wheels and high power controllers, 7.8V
NiMH batteries, forward MaxSonar and Sharp IR range finder and a reverse Vishay IR Proximity sensor. The sensors all have analogue outputs, so they are easy to hook up to an Aurduino A0, A1 and A2. The motor controllers are serial and hooked together onto the same SW Serial Tx port used for the GPS Logger. I only use the serial Rx for the GPS, so I use the Tx for the two motor controllers on a free pin D7.
The two wheels on the right are on one controller and the two on the left on another. It simply turns with brute force - like a tank.
The chassis is my trademark olde skool wooden breadboard (It is rectangular, with rounded corners!) and the only parts that are screwed, wired and glued down with any sense of permanence are the 4 wheels, since having a wheel come off during a run, is disappointing. The motors and wheels are of course totally oversized for this little toy, but it sure looks cool, eh...
The batteries, electronics and sensors are simply stuck on with 'chewing gum' (blue Tack-It). Most wiring are plug in, using Berg 0.1" headers. Only the batteries have polarized connectors so I can't plug them in the wrong way around (well, I still managed to do something like that regardless).
This way, it is easy to reconfigure this hoosammawhatsit and pull it apart to reprogram or solder something, without having to break out a pile of tools.
Here is some example code to read the simple sensors:
// Sharp IR Range Finder
// MaxSonar Range Finder
// Vishay proximity sensor
// Herman Oosthuysen, 2016
// IR values range between about 0x0165 with wheels touching a wall, to 0x0003 to the end of the room.
// Sonar values range between about 0x000b with wheels touching a wall, to 0x0190 to the end of the room.
// The proximity sensor shows about 0x03c0 when there is nothing and 0x003c when there is something.
void setup()
{
Serial.begin(9600);
}
void loop()
{
int ir = 0;
int sonar = 0;
int prox = 0;
char res[5];
ir = analogRead(A0);
sonar = analogRead(A1);
prox = analogRead(A2);
sprintf(res, "%04x", ir);
Serial.print("ir=");
Serial.println(res);
sprintf(res, "%04x", sonar);
Serial.print("sonar=");
Serial.println(res);
sprintf(res, "%04x", prox);
Serial.print("prox=");
Serial.println(res);
delay(1000);
}
...and here is what the whole mess looks like once things are more or less connected:
Hmm, eye drops and non-alcoholic beer - both very important debug tools...
So I fired up my trusty WinXP virtual machine on Virtualbox. When plugging the USB cable in, it comes up as an unknown, so I created a USB port filter with only a Name: Pololu, Product: 0098 and Vendor: 1FFB, while ensuring everything else is completely blank. Then replug the cable and wind up the Windows. The Pololu program wants to run as administrator (unsurprisingly) and install a device driver twice, each time you plug the motor controller in. I guess regular users of Windows would be used to this nonsense.
These motors are powerful enough that the buggy could do a wheelie. I proved that with the first version. So I would like to add an accelerometer and get it to flip onto its hind legs.
For the Arduino interface I set it to Serial/USB, Fixed 9600 baud, Binary, No CRC and made sure that the ID for the two controllers are different (mine are 13 and 14). Save it and hope for the best.
Vroooom!
Well, for a moment there anyway. I plugged a motor controller in wrong and fed 7.8V into the 5V supply, blew the Arduino out of the water and it went to join the crowd in the great computer heaven in the sky. My Mac even rebooted - but is still working - fortunately.
This is why I like playing with thermionic valves - they can take a lot of abuse - little embedded processors not so much. So it looks like I'll be making the courier company rich, unless I order multiples of these things as spares, a handful of zener diodes and whatnot for protection, but that feels like planned waste - sigh...
The Monster Moto control is described in another post.
A0 - (EN1 Motor remove 810R); Sonar range
A1 - (EN2 Motor remove 810R); LED range
A2 - CS1 Motor
A3 - CS2 Motor
A4 - IR proximity
A5 -
D0 RX - USB Serial; (RX GPS switch to SW)
D1 TX - USB Serial; (TX GPS switch to SW)
D2 -
D3 -
D4 - INA2 Motor
D5 - PWM1 Motor
D6 - PWM2 Motor
D7 - INA1 Motor
D8 - INB1 Motor; (SW RX GPS cut track)
D9 - INB2 Motor; (SW TX GPS cut track)
D10 - (ICSP MISO GPS cut track); SW RX GPS
D11 - (ICSP SCK GPS cut track); SW TX GPS
D12 - (ICSP MOSI GPS cut track); SW RX 9DOF Sensor
D13 - SW TX 9DOF Sensor
RST - RST GPS
Items in brackets were cut or moved.
Wow, this toy is sure getting expensive...
Have fun,
Herman
The first rover worked, but it was too complicated. The problem with all toy projects is that I tend to forget what I was doing with it and I like to 'work' on multiple things at the same time. My shop currently has a glider, a valve guitar amplifier, a VU meter, multiple radio transceivers and this rover all in various stages of incompletion. Therefore any project needs to be modular and simple, so that I can see what is going on at a glance. Otherwise, it ends up in a corner, gathering dust, rather sooner than later.
Rover #2 uses the Sparkfun Arduino Redboard for its brains and it is meant to be completely autonomous. Addition of RC makes it too complicated and hard to maintain, so I ripped all that out (and it can now go back into the 2m electric glider!).
I re-used the Pololu 100:1 geared DC motors, enormous wheels and high power controllers, 7.8V
NiMH batteries, forward MaxSonar and Sharp IR range finder and a reverse Vishay IR Proximity sensor. The sensors all have analogue outputs, so they are easy to hook up to an Aurduino A0, A1 and A2. The motor controllers are serial and hooked together onto the same SW Serial Tx port used for the GPS Logger. I only use the serial Rx for the GPS, so I use the Tx for the two motor controllers on a free pin D7.
The two wheels on the right are on one controller and the two on the left on another. It simply turns with brute force - like a tank.
The chassis is my trademark olde skool wooden breadboard (It is rectangular, with rounded corners!) and the only parts that are screwed, wired and glued down with any sense of permanence are the 4 wheels, since having a wheel come off during a run, is disappointing. The motors and wheels are of course totally oversized for this little toy, but it sure looks cool, eh...
The batteries, electronics and sensors are simply stuck on with 'chewing gum' (blue Tack-It). Most wiring are plug in, using Berg 0.1" headers. Only the batteries have polarized connectors so I can't plug them in the wrong way around (well, I still managed to do something like that regardless).
This way, it is easy to reconfigure this hoosammawhatsit and pull it apart to reprogram or solder something, without having to break out a pile of tools.
Sensors
Three sensors should be enough for obstacle detection: IR Range finder, Sonar range finder and IR Proximity detector.Here is some example code to read the simple sensors:
// Sharp IR Range Finder
// MaxSonar Range Finder
// Vishay proximity sensor
// Herman Oosthuysen, 2016
// IR values range between about 0x0165 with wheels touching a wall, to 0x0003 to the end of the room.
// Sonar values range between about 0x000b with wheels touching a wall, to 0x0190 to the end of the room.
// The proximity sensor shows about 0x03c0 when there is nothing and 0x003c when there is something.
void setup()
{
Serial.begin(9600);
}
void loop()
{
int ir = 0;
int sonar = 0;
int prox = 0;
char res[5];
ir = analogRead(A0);
sonar = analogRead(A1);
prox = analogRead(A2);
sprintf(res, "%04x", ir);
Serial.print("ir=");
Serial.println(res);
sprintf(res, "%04x", sonar);
Serial.print("sonar=");
Serial.println(res);
sprintf(res, "%04x", prox);
Serial.print("prox=");
Serial.println(res);
delay(1000);
}
...and here is what the whole mess looks like once things are more or less connected:
Hmm, eye drops and non-alcoholic beer - both very important debug tools...
Pololu Motor Controller Setup
The motor controller needs to be configured (RC/Serial/Potentiometer control, ASCII/binary protocol and more). This requires special software, which of course is not available for a Mac. Curiously, they do have both Linux and Win32 versions of the control program.So I fired up my trusty WinXP virtual machine on Virtualbox. When plugging the USB cable in, it comes up as an unknown, so I created a USB port filter with only a Name: Pololu, Product: 0098 and Vendor: 1FFB, while ensuring everything else is completely blank. Then replug the cable and wind up the Windows. The Pololu program wants to run as administrator (unsurprisingly) and install a device driver twice, each time you plug the motor controller in. I guess regular users of Windows would be used to this nonsense.
These motors are powerful enough that the buggy could do a wheelie. I proved that with the first version. So I would like to add an accelerometer and get it to flip onto its hind legs.
For the Arduino interface I set it to Serial/USB, Fixed 9600 baud, Binary, No CRC and made sure that the ID for the two controllers are different (mine are 13 and 14). Save it and hope for the best.
Vroooom!
Well, for a moment there anyway. I plugged a motor controller in wrong and fed 7.8V into the 5V supply, blew the Arduino out of the water and it went to join the crowd in the great computer heaven in the sky. My Mac even rebooted - but is still working - fortunately.
This is why I like playing with thermionic valves - they can take a lot of abuse - little embedded processors not so much. So it looks like I'll be making the courier company rich, unless I order multiples of these things as spares, a handful of zener diodes and whatnot for protection, but that feels like planned waste - sigh...
Monster Moto
Eventually, I replaced the two Pololu controllers with a Monster Moto board from Sparkfun. This way, I just have three boards plugged together and one battery pack - simpler.The Monster Moto control is described in another post.
Arduino Rover Pins Used
The GPS board has a lot of breadboard space and places where tracks can be cut and reconnected. To get everything connected, I had to do a little surgery with a knife on the bottom of the GPS board, and remove two 810 Ohm SMD resistors from the top of the Monster Moto board, as explained below.A0 - (EN1 Motor remove 810R); Sonar range
A1 - (EN2 Motor remove 810R); LED range
A2 - CS1 Motor
A3 - CS2 Motor
A4 - IR proximity
A5 -
D0 RX - USB Serial; (RX GPS switch to SW)
D1 TX - USB Serial; (TX GPS switch to SW)
D2 -
D3 -
D4 - INA2 Motor
D5 - PWM1 Motor
D6 - PWM2 Motor
D7 - INA1 Motor
D8 - INB1 Motor; (SW RX GPS cut track)
D9 - INB2 Motor; (SW TX GPS cut track)
D10 - (ICSP MISO GPS cut track); SW RX GPS
D11 - (ICSP SCK GPS cut track); SW TX GPS
D12 - (ICSP MOSI GPS cut track); SW RX 9DOF Sensor
D13 - SW TX 9DOF Sensor
RST - RST GPS
Items in brackets were cut or moved.
A Friggen Laser Beam!
Just the day after I received my packet of spare Arduino Redboards, Sparkfun announced that the Garmin LIDAR is back - really bad timing, but I just have to have one. What is a Rover without a Friggen Laser Beam?Wow, this toy is sure getting expensive...
Have fun,
Herman
Comments
Post a Comment
On topic comments are welcome. Junk will be deleted.