Some time ago my daughter and I built a robot based on Picaxe.
It got named HaloBOT and the build is here HaloBOT
Picaxe was chosen at the time to allow Hayley to use the Flowchart version of programming, and it was based ona single board, rather than a collection of bits.
It works and has demonstrated what it needed to, but to be honest it is limited, and now Arduino can do so much more at a lower price.
Enter HaloBOT ver 2.0
I decided that it was time to build a completely new robot, based on the same chassis style but with some hardware upgrades.
It is currently ver 2.0 because I have some extras to add, and like software it is only fair that each version gets another iteration.
(It will also help me keep track of the sketches)
I'm not sure how I will manage the version numbering as there is some additions, and there are some overall changes that I envisage.
Chassis
I found a motor gearbox lying around, but it is the Tamiya Double gearbox, and the dimensions were different (narrower).
Double Gearbox (Left/Right Independent 4-Speed)
So fire up CorelDraw (As luck would have it, it wouldn't run this time) and make the necessary changes to the width.
While I was there, a few options to reverse things was deleted, the battery mounting revised and the front castor reversed to allow the cover to be mounted.
- Printed it out (the revised plan is attached)
- Marked it out. Masking tape protects the surface while allowing easy marking.
- Cut it out. Jigsaw and metal blade ... a CNC would be great.
- Drilled and taped the holes. Holes were drilled 2.5mm and then taped M3.
The edges were cleaned up using simple hand tools and some sandpaper.
I prefer to use a battery drill to tap holes. I find it easier to keep at right angles and use the lowest setting on the clutch to ensure it stops if the tap binds.
You need to use a tapping lubricant that matches the material. For aluminium Meths works but Iso Alcohol is just as good.
It's a reasonable facsimile of the paper design, so I'm on the right track.
The chassis is 14mm from the surface with the choosen wheel combination.
I'm using the Tamiya 70144 ball castor Ball Caster Set
The lowest setting is 16mm, unless you remove some of the plastic which reduces it to 11mm.
https://www.pololu.com/picture/view/0J4507
So some filing might be required, or put up with a slight rake. (I'll worry about that later)
Bumper
The bumper is made from Acrylic just as it was in the first version.
The overall width has been reduced to suit the new chassis, and I altered the 45 deg angle to ensure the microswitches have the proper range.
Hand tools were used to smooth the front surface, and then it was sanded to remove the rough edges.
The slot was made by drilling three holes, then using a small round file to join them altogether.
I did use the Dremel but I found it wasn't as easy to get the control necesary.
You will notice the images above don't show the holes for the switches drilled ... yet.
I wait until I have the actual switches in hand before marking the holes.
These are left oversized to allow fine adjustment.
It is important to test the bumper and aluminium to ensure there is no sticking, and in my case some minor polishing was required.
I also found during the testing that the flat on the bottom of the triangular holes isn't flat and a direct sideways force will cause the bumper to stay to one side.
I'll sort this out later ....
Battery
I have a stock of these 11.1v Parrot Drone batteries that my son found on sale in a local retailer.
The price was too good to pass by, so he called me up and I brought 10 of them.
I'd almost forgotten I had them until this came up and it seemed an ideal size and shape to mount.
I discovered the motors are 3v, and while 6v might be okay, the 11.1v is close to 4 times their intended design.
The controller is able to be PWM, but that will simply reduce the overall power and it also means any speed adjustment is much coarser than it would be.
So I'm considering adding voltage reduction to the motor supply. It may not happen right away but it's being considered in the shield design.
As the picture shows, there is a single output and four smaller wires.
These are the charge controller and used to balance the charging, or supply the charge to each cell.
Without having these, you run the risk of overcharging one or more cells, which will damage them, but potentially results in a fire.
Controller
By now it must be obvious that I'm using an Arduino to run this bot.
The motor controller is a Pololu 2503 https://www.pololu.com/product/2503
This is a dual Freescale MC33926 https://www.pololu.com/file/0J233/MC33926.pdf with clever connections and motor current feedback to A0 and A1.
The description says it all
This shield makes it easy to control two brushed DC motors with your Arduino or Arduino-compatible board. Its dual MC33926 motor drivers operate from 5 to 28 V and can deliver a continuous 3 A per motor.
These great drivers also offer current-sense feedback and accept ultrasonic PWM frequencies for quieter operation.
The Arduino pin mappings can all be customized if the defaults are not convenient, and the motor driver control lines are broken out along the left side of the shield for general-purpose use without an Arduino.
Pololu have also provided a library, which I will be using ... because I can.
The suggested voltage for the Motor Controllers is 5-28v which suits the 11.1v battery I have.
Operation from 5-8 V reduces maximum continuous output current (driver performance is derated in this range).
When I look at the datasheet Page 8 Note 10 states
Device is operational down to 5.0 V, but below 8.0 V the output resistance may increase by 50 percent.
In reality if I reduce the voltage to suit the 3v motors, it will get warmer, and may not deliver the full current.
Assembly
I've run out of time to do everything I wanted.
Part of the design bloat was adding a LCD, and the mounting for that and the battery started to become a headache.
So until I resolve just where and how I intend to mount the LCD, I've opted for a cheap simple mount ... some double sided foam tape.
Some double sided tape holds the battery in place, and I've even left off the range finder.
Somehow I managed to overlook the battery connector.
I'd ordered some that fit the battery ... and then decided to use these batteries ... BUT I failed to notice it had a different connector.
One IDE drive power extension sacrificed it's life in the cause ...
As I said earlier the numbering will allow for ver 2.1
Software
This is a simple version and was copied from the Picaxe to Arduino, with the necessary changes made to make it run.
I indentified the spare pins (2, 3, 5, 6, 11 and A2, A3).
Pin 13 has the onboard LED, but I can always extend that, and A4 and A5 are reserved for I2C display and other items.
/* haloBOT ver2.0 Pin assignments Pin 0 Rx Pin 1 Tx Pin 2 BumpSwitch Right Pin 3 BumpSwitch Left Pin 4 Pin 5 Pin 6 Pin 7 Pin 8 Pin 9 Pin 10 Pin 11 Pin 13 Led Pin A0 M1 Current Sense Pin A1 M2 Current Sense Created 13 May 2018 by Mark Beckett Version 0.1 Initial Code started 13 May 2018 --------------------------------------------------- To Do : */ #include "DualMC33926MotorShield.h" int RightBump = 2; int LeftBump = 3; byte RightBumpState; byte LeftBumpState; byte RightCount; byte LeftCount; byte ForwardCount; byte CornerCount; byte BackCount; byte LastTurn; DualMC33926MotorShield md; // M1 equals Right Motor // M2 equals Left Motor void setup() { Serial.begin(115200); Serial.println("Dual MC33926 Motor Shield"); md.init(); pinMode (RightBump, INPUT); digitalWrite (RightBump, HIGH); // internal pull-up otherwise the pin floats. pinMode (LeftBump, INPUT); digitalWrite (LeftBump, HIGH); // internal pull-up otherwise the pin floats. /* In order to put the robot down, the motors should be off Press a bumper switch to start */ while ((digitalRead(RightBump) == 1) && (digitalRead(LeftBump) == 1)) { delay(100); } } void stopIfFault() { if (md.getFault()) { Serial.println("fault"); while(1); } } void loop() { md.setM1Speed(100); // forward half speed (Right) md.setM2Speed(100); // forward half speed (Left) ForwardCount = ForwardCount + 1; stopIfFault(); //Serial.print("M1 current: "); //Serial.println(md.getM1CurrentMilliamps()); //Serial.print("M2 current: "); //Serial.println(md.getM2CurrentMilliamps()); Check_BumpSwitches(); delay(50); if (ForwardCount == 200) { ForwardCount = 0; RightCount = 0; LeftCount =0; CornerCount =0; LastTurn=0; } } void Check_BumpSwitches() { RightBumpState = digitalRead(RightBump); LeftBumpState = digitalRead(LeftBump); // if ((RightBumpState == LOW) || (LeftBumpState == LOW)) // Both Bumpers clear // { // Serial.print("RightBumpState : "); // Serial.println(RightBumpState); // Serial.print("LeftBumpState : "); // Serial.println(LeftBumpState); // delay(100); // } if ((RightBumpState == HIGH) && (LeftBumpState == HIGH)) // Both Bumpers clear { return; // nothing to do } else { md.setM1Speed(0); // Stop md.setM2Speed(0); // Stop delay(50); md.setM1Speed(-100); // Reverse half speed (Right) md.setM2Speed(-100); // Reverse half speed (Left) delay(100); md.setM1Speed(0); // Stop md.setM2Speed(0); // Stop } if (CornerCount >3) { EvadeCorner(); return; } if ((RightBumpState == LOW) && (LeftBumpState == LOW)) // Both Bumpers has made contact { if (RightCount > LeftCount) { md.setM2Speed(100); // forward half speed (Left) delay(50); } else { md.setM1Speed(100); // forward half speed (Right) delay(50); } LastTurn = 0; ForwardCount = 0; return; } if (RightBumpState == LOW) // Right Bumper has made contact { if (LastTurn == 2) { CornerCount = 0; } else { CornerCount = CornerCount +1; } md.setM1Speed(100); // forward half speed (Right) delay(100); RightCount = RightCount +1; LastTurn = 2; ForwardCount = 0; return; // go back to loop with both motors forward } if (LeftBumpState == LOW) // Left Bumper has made contact { if (LastTurn == 1) { CornerCount = 0; } else { CornerCount = CornerCount +1; } md.setM2Speed(100); // forward half speed (Left) delay(100); LeftCount = LeftCount +1; LastTurn = 1; ForwardCount = 0; return; // go back to loop with both motors forward } } void EvadeCorner() { /* We have detected that we're stuck in a corner This needs a greater right or left turn to break out */ if (RightCount > LeftCount) { md.setM1Speed(100); // forward half speed (Right) delay(150); } else { md.setM2Speed(100); // forward half speed (Left) delay(150); } CornerCount = 0; return; }
Video
It's not pretty, but it shows what it does.
The motors are set at 25% (100 from a mximum of 400) as they are only 3.6v and the battery is 11.1v.
Some fine tuning required as it's not getting out of the corner.
Hopefully this will give someone some inspiration, and show it doesn't cost a lot.
Cheers
Mark