Friday 4 October 2013

The Unnamed Electronic Systems

While I'm working on mechanical structure of The Unnamed I also need to consider how I will control the final robot. The rules state that there need to be 2 elements before my robot is allowed to enter:
  • Removable link
  • Powered indicator
Of course the robot will need other items to operate such as:
  • Battery
  • Motor Drivers
  • Radio Control Receiver

Removable Link

The idea behind requiring a removable link is simple, it provides a guaranteed way of cutting of the power in case of emergency. It must be located in an accessible place and may only be covered by a clearly marked, and easily moved cover. In many robots the removable link also does double duty as the master power switch.

They are commonly made out of a high power collector that has the male plug pins shorted together and the female receptacle pins in line with the battery power leads. The female connector is used in line with the main power wiring to reduce the chances of a short circuit activating the robot unexpectedly.

Powered Indicator

The powered indicator must be a steady indicator that is lit when the robot is powered, it cannot be a filament bulb. This gives a clear indication if the robot is powered.

As it cannot be a filament bulb LEDs are often used. It will need to be connected into the removable link side of the robot so that it will only light if the link is in place and the robot is active.

Motor Drivers

I'm planning to have 3 motors in my robot, 2 for drive and 1 for the weapon, in all 3 cases I will need to control the motors in both directions. As the motors I shall be using are powerful I will need motor drivers that can withstand high voltages and currents continuously as well as far higher peak currents. Of course despite these requirements they need to be compact but affordable as I don't want to spend all my money on awesome motor controller only to not have enough money for a weapon, or worse, no money for a chassis. One other important feature is reliability, often many robots lose a bout simply because their motor controller suffered a fault, burnt out or became disconnected, I do not want that to be the case for my robot.

For the moment I'm planning to use modified TZ-85A brushless speed controllers.

Movement

I will be using two Gimson GR02 18 Volt 1:24 motors to drive two wheels each via a High Torque Drive (HTD) belt. The motors will pull approximately 8 Amps under load but will pull up to 62 Amps when stalled which means I will ideally want a motor controller that can take 10 Amps continuously and withstand short spikes of up to 65 Amps.

As I shall be using differential steering to control my robot I will need some way of mixing a remote control channel with left and right signals with a remote control channel with forward and backwards signals. This can be done either with a suitably intelligent dual channel motor controller or by using a V-Tail mixer to combine the signals.

Weapon

My current plans for a weapon call for an electrically powered actuator as part of a four-bar-lifter. I'm expecting the actuator to be a Gimson GLA-S 100mm linear actuator. Gimson state that the expected stall current is 62 Amps and the expected load current is 23 Amps, this means ideally I want a motor controller than can survive 62 Amps peak but I'll definitely want to be able to manage 30 Amps continuously. This actuator should reach full extension (205mm to 305mm) in approximately 5 seconds under load which could be too slow however this will require further work before I am certain.

Linear actuators do not spin continuously and will reach a limit where they cannot travel any further without damaging the motor or the actuator, to signal when the actuator has hit these points limit switches are installed. While limit switches are built into the SLA-S actuator they are not connected to the motor directly as they would not be able to handle the current, this requires me to add a circuit to detect inputs from these switches and control the motor accordingly.

Battery

To power the motors in the robot a battery is needed, its characteristics such as voltage and capacity are defined by what I need it to power. The Unnamed has:

Qty 
Description 
Load Current (Amps)
Sub-Total (Amps)
Stall Current (Amps)
Sub-Total (Amps)
2
Gimson GR02
8
16
62
124
1
Gimson GLA-S
23
23
62
62
1
Misc Electronics 
0.2
0.2
0.2
0.2
Totals:
39.2
186.2

Assuming a bout lasts 10 minutes then I will need a battery capacity of 6.6 Amp hours (Ah) if all the motors are constantly operating, the absolute worst case suggests I'd need a 31 Ah battery if the motors were continuously stalled. Neither of these estimates are particularly realistic as I will not be driving at top speed for all of a bout, and nor will the lifter be constantly extending and retracting.

The 6.6 Ah figures is closer to being realistic so I will aim to have a battery that is close to this. Another consideration is the voltage of the battery, the GR02s and the GLA-S are both rated at 18 Volts however I'm planning to overvolt them by using a 5 cell Li-Poly battery at 18.5 Volt nominal.

Radio Control Receiver

To control the robot I am planning to use a DSM2 compatible transmitter and receiver set, DSM2 is a 2.4GHz standard that allows different receivers and transmitter from different manufacturers to work together. My robot will require a minimum of 3 channels, one for each drive motor and one for the weapon. I could use a further 4th channel to enable inverted control for when my robot is flipped over or to enable other functions remotely.

My Solution

With these considerations in mind I came up with the following circuit:


I've chosen a 5 cell 4.7 AmpHour 30C Lithium Polymer battery from OptiPower, this should provide enough power for long enough to last a bout. It will be capable of sourcing 141 Amps (30C × 4.7AHr) continuously with peaks of 376 Amps (80C × 4.7AHr).

To protect the motor drivers and RC electronics I've put a 100 Amp automotive Maxi Fuse. As it is a cartridge fuse it's easy to replace if it gets blown but is also robust enough to act as a removable link. By choosing an automotive fuse cartridge it should be easy to buy spares and even replacement fuses with smaller ratings.

I'm going to use a high power red LED to indicate that the robot is powered, this will be connected after the fuse such that if the fuse blows the LED will not light.

The terminal block is ideal for the central connection node of my electronics system. The screw clamps will allow me to easily make and remove connections whilst securely grabbing any cable and holding it tight. It should also allow me to keep the wiring neat and tidy which will help me in maintaining the robot.



I've omitted the connectors from this diagram to keep it simple, however I'm planning to use XT60 connectors like the ones above left to join the motors to the speed controllers. The battery will connect to the wire link with an XT90 connector, show above right, which is a the bigger brother of the XT60. By containerising these key parts of the system it enables me to quickly re-configure the robot for maintenance or debugging. They're polarised so I cannot plug things in backwards as well as gendered so I can ensure that the parts of the system that supply power have female plugs to reduce the chances of shorts.

Thursday 26 September 2013

Rules of Thumb for Designing 4-bar Lifters

The main weapon for The Unnamed is a 4-bar lifter. It takes its name from the Four-bar Linkage used to move the lifting arm

One of the most famous 4-bar lifter robots is the American Biohazard, it coupled a very low robot with the ability to lift the opponent very high. Below is a video of it defeating Greenspan in May 2002.


As I'm trying to emulate the weapon of Biohazard for The Unnamed I need design my own 4-bar lifter.

Design

While it is called a 4-bar linkage one of the bars is actually the robots chassis so this is fixed from a design point of view. The other 3 bars however are very much up to the designer, and because of this the number of variables it is very hard to work out the "best" design.

I began my design with a number of aims:

  • It needs to fit into an area roughly 300mm by 50mm to stay inside the robot
  • It needs to be reasonably fast, ~2 seconds to complete a lift


To do this I used SketchUp to position the bars which allowed me to easily get the lengths and angles. These lengths and angles where then inputted into "Four Bar", a 4-bar lifter calculated written by Adam Wrigley and available from here.

Note: This software is old and will need an older version of dotNet in order to install.

Rules of Thumb

After playing around with it a lot I've decided on these rules of thumb, I'm not a mechanical engineer so there is no theoretical justification, just what's happened when I've altered it.

  • The rear bar controls how far forwards or backwards the lifter throws
    • if it's at a 45° angle then you will have a vertical lift with little forward or backwards throw
    • if it's less than a 45° angle then the lifter blade will move forward during the lift
    • if it's more than a 45° angle then the lifter blade will move backwards during the lift
  • The forward bar controls the height the lifter reaches at the end of a throw
    • the longer the forward bar is, the higher the lifter will be able to reach
    • the shorter the forward bar is, the less height the lifter will be able to reach
 After spending quite some time playing around with the lengths and angles I finally came up with a design that produced a result I was happy with.


 Note: The calculator uses the units that you enter, in my case millimetres and kilograms.

The drawing on the left shows the lowered position in red and the raised position in blue. The tip of the lifter is traced through the entire range with the pink line. As you can see the lifter raises 22.5 centimetres and also moves forwards by 5.0 centimetres, this the advantage of using a 4-bar linkage compared to a simpler flipper.

The graph on the right shows that the front arm is originally 12° from horizontal and rotates until it is 58° from the horizontal. The height increases linearly with rotation which should help the control of the lifter. The torque curve is constant around 39 Newton Meters for the majority of the lifter's movement however for the last 7 centimetres the torque rises very sharply to 129 Newton Meters. The torque figures are calculated assuming a 15 kg weight (opponent) on the tip of the lifter however increases to this mass (multiple opponents, the arena wall) will cause the torque requirements to increase.

Powering the Lifter

Of course just having a mechanical design for the lifter bars is great, most of the work in fact, however I still need a way to power the lifter. Using the calculator above I need to provide more than 150 Newton metres of torque to the front arm of the lifter. Looking back to Biohazard it uses 2 electronic linear actuators to push against the front arms.

Pneumatics

One of the main advantages of lifters is that they are very similar to a flipper but without the high impulse power that can be provided by pneumatics. It would be possible to drive the 4-bar lifter with a pneumatic ram however I don't feel like I have enough knowledge and understanding of pneumatic systems to do this safely and will save this for a future robot.

Motors

An alternative to linear actuators is to have a very high torque motor to drive one of the linkages directly. This was the approach taken by Charles Guan with his Test Bot 4.5 MCE. This would be more difficult for me to implement as I do not have lots of space and I need to source or design a suitable gear box. I will probably avoid this approach.

Linear Actuators

These are a popular method of driving lifters, although they're much rarer in HeavyWeight robots, Biohazard was an exception rather than a rule. A recent featherweight combat robot that made use of a lifter powered by linear actuators was Loki who did quite well for themselves in the 2014 Featherweight Championships.

Looking on Gimson Robotics they have the GLA750-S which seems like exactly what I need. It is capable of 2300 Newtons of force, 50 millimetres of throw, and a top speed of 37 millimetres per second. However I will need more than just a motor controller to drive this as I need it to stop at the lower and upper end points else it will lock itself together.

Control

The GLA750-S uses the same motor (RS 550) as the GR02 gear motors, therefore it makes a bit of sense to use the same motor controller, the TZ-85A. However I need to add some way of stopping the linear actuator when it has reached the minimum and maximum lengths. Typically actuator have end stop switches built in which are connected as shown below in the image from Gimson Robotics:


However for the GLA750-S the motor current is too high and will cause the switches to fail, even under no load conditions. This means I'd have to construct my own limit switches, most likely due to the currents the limit switches would then operate relays or MOSFETs to limit the motor.

Another option is to further modify the TZ-85A but not re-programming with the stock brushed DC motor control firmware. Instead further modifying the firmware to accept an analogue input and connecting a variable resistor or potentiometer to it. The potentiometer would vary in relation to the position of the linear actuator and would be in effect be a super sized servo. The advantage of this is that the RC pulses no longer specify a speed but a position which the linear actuator will always try and match. This way should external forces move the actuator out of position, it would apply more power (if available) until it matched the requested position again. This would require understanding the current modified firmware as well as extensive testing. Any mistakes could cause the linear actuator to irreparably damage itself.

That would be bad.

Sunday 22 September 2013

Mini-Sumo Claymore

Whilst visiting the Birmingham TechFest in 2011 with a few classmates from university I saw people with small autonomous robots, the robots were attempting to push each other out of a black circle. It turned out that this was a mini-sumo competition. The robots had to be autonomous, weight less than 500 grams and must fit in a 100mm cube. This sounded like an interesting challenge so I have tried to make my own.

Rules

The official rules are listed here in PDF however the important points are:

  • Matches take place in a Dohyo
    • This is a circular arena with a diameter of 77 centimetres painted black
    • It has a white line on the border 2.5 centimetres wide
    • There is nothing else surrounding the Dohyo for at least 50 centimetres
  • The robot must:
    • Fit in a box 10 centimetres wide and 10 centimetres deep, there is no height restriction
    • It must not weight more than 500 grams
    • Autonomous robots must begin a match 5 seconds after a button is pressed
    • No jammers or damaging weapons allowed
      • But a flipper is not ruled out...

Objectives

Like The Unnamed I've set down some initial starting goals:

  • It must weight 500 grams
  • Fit inside the 100 mm cube
  • Try and be less than 30mm high
  • I want to focus on intelligence rather than brute force
    • But it helps to have brute force too
  • Use 2 opponent sensors and 2 edge sensors
  • Use 'modern' construction methods
    • This includes 3D printers and laser cutters

Parts

I started by collecting some parts for the robot. Normally I try and fully design a robot before ordering parts, this stops me from wasting money on things that won't fit with the final design, however more often than now I find myself never quite finishing it. This time I decided that as the robot will be rather small I may as well buy parts that look like they'll fit and then design a chassis around them.

Drive System

I figured the first step would be to organise a decent drive system after all the point of this robot is to push other robots out of the ring, it needs to be a solid system as it is my only offensive weapon. I started by trying to find motors from Faulhaber or Maxxon, both very high quality, very high cost precision motors. Googling for Faulhaber lead me to a Robot Room post which then lead me to a surplus website selling them here. A couple of important things to note about these motors which made them ideal; they have pre-built right angle gearboxes already attached, they have encoders mounted on the rear to count rotations and while they're rated for 6 Volts they seem capable of handling ~12 Volts.

I'm planning to run the motors in a closed loop control system, this means that rather than setting a PWM value as is the standard I will instead set a counts per interval then the code will attempt to match that value by varying the speed of the motor. This means that should something slow me down, either battery levels draining or an opponent in front of me the controller will increase the PWM value until the counts per interval matches. The only downside to this method is that it is more complex and requires a decently powerful microcontroller, however I was planning to add one anyway so this is acceptable.

The motors at 6 Volts only rotate 80 times a minute or 1.3 times a second which is not very quick at all, if I instead run these motors at 12 Volts then I should get 170 Rotations per Minute (RPM) or 2.8 times a second. This is much better and coupled with the right wheels will make for a fast robot. To provide this 12 Volts I need a powerful but compact battery, I'm not too concerned about weight, but the smaller I can make my robot the harder it will be to sense. With that in mind I've chosen a Lithium Polymer (LiPoly) battery made up of 3 cells for a battery voltage of +11.1 Volts and a capacity of 800 milliamp hours, it measures 75mm x 23mm x 15mm and weights under 63 grams.

The final component of the drive system are the wheels. I want a robot that is around 30mm high so cannot choose wheels larger than that, they also need to maintain good grip on the floor to help push other robots around. I ended up buying a pair of Solarbotics RW2 wheels. These have a diameter of 31.2mm which translates to a top speed of 277 mm per second which would be fast enough for this purpose.

Sensors

The robot will require 2 types of sensors, one set to detect opponents and manoeuvre them off the edge of the Dohyo and another set to detect the edge of the Dohyo and avoid it.

The distance sensors should have a long range, but to avoid detecting things outside the Dohyo the maximum range must be limited to 50 centimetres + 2.5 centimetres = 52.5 centimetres but should be more than 77 centimetres  - 10 centimetres - 10 centimetres = 57 centimetres to ensure that the opponent can be sensed at all ranges. The minimum range should be as close to 0 centimetres as possible to avoid missing the opponent when it is directly in front. The (IR) distance sensors from Sharp are very popular as they fit nicely into this range bracket. I've chosen the GP2Y0D340K as it has a minimum range of 1.5 centimetres and a maximum range of 40-42.5 centimetres. The maximum range should be acceptable as the robot will be moving around as it scans for the opponent which will reduce the chances of the worst case scenario happening.

The edge detection sensors don't need quite so much range but they need to detect the change from the black Dohyo floor to the white edge border cleanly. The edge sensors I choose will need to sense the change quickly, if the robot is travelling at its top speed of 277 millimetres per second then the robot has 1.1 seconds to come to a halt to avoid driving off the edge. The popular sensors for this task are the TCRT1000 from Vishay. The TCRT1000 combines an Infra-Red (IR) transmitter receiver pair in a single package, correctly biased they be set up to give a digital output that ranges when the border is detected, this can then set off an interrupt to stop the robot.

Logic

To control the robot I will need some logic to receive inputs, process them and then act upon them, as I want the strength of my robot to be the processor this is where I need to choose a fast and powerful microcontroller. I will use the faster microcontroller to get inside my opponents Observe, Orientate, Decide, Act loop (OODA), this is done by cycling through the loop faster than the opponent, causing the opponent to act upon a situation that has already changed.

For fast powerful microcontrollers that are still compact the ARM architecture is the most prevalent and of these I have the most experience with the LPC1343. This will be a good choice as it has enough input/output pins for the robot and runs at 72 Megahertz which will allow it to react quickly to changes in its environment. Unfortunately it does not have any non-volatile memory so I may have to include an external EEPROM chip to provide the memory that will exist between power cycles.

The motors will require a specialised chip to drive them as the microcontroller outputs will not be sufficient. This chip will need to work with a +11.1 Volt supply from the battery for the motors and accept control signals  that are +3.3 Volts. The motors will pull approximately 0.4 Amps when stalled so the chip ideally needs to be able to handle approximately 1 Amp of current to be safe. There are a few available chips such as the TB6612FNG or the A4950 I will choose a suitable one as the space constraints are discovered.

The LPC1343 requires a +3.3 Volt power supply, the sensors require a +5 Volt power supply, I have a +11.1 Volts battery on my robot, this means I will need to include 2 stages of regulation, one to +5V and another to +3V3. The best way to drop the +11.1 Volts down to +5 Volts is to use a Switch Mode Power Supply (SMPS), these are typically very efficient and generate very little heat. I will then use a linear regulator to drop from +5 Volts down to +3.3 Volts this will give me a very stable, noise free supply for the sensitive microcontroller.

Chassis

These disparate parts require a chassis to act as glue holding them together. As none of the robots opponents will be able to cause physical damage there is no need to armour my robot however the chassis will need to be stiff enough to withstand pushing and being pushed by other robots. By making at low as possible I reduce the cross sectional area that an opponent can detect, depending on my opponents sensors I can also construct my robot to further reduce my chances of being detected. For robots that use sonar sensors I can either deflect the ultrasound or absorb it to reduce the returned ultrasound levels, for IR sensors I can do the same but with different materials. I however will not construct my robot to take advantage of this in the first mini-sumo, however for my next robot I may look into "stealth" techniques.

The minimum height I can build my robot is set by my wheels, 31.2mm, the minimum width of my robot is set by the width of 2 wheels, 2 motors and the battery, 87mm, the minimum length of my robot is set by the length of the motors, 72mm. The total weight of those 5 components is ~200 grams. This means I have approximately 300 grams to fit the logic circuitry, sensors and chassis in. To accurately plan how I would do this I used SketchUp as a Computer Aided Design (CAD) program, it's not as functional as Solidworks or AutoCAD but it is far easier to use.

After many design ideas and tweaks I came up with an idea:

It was to be built out of laser cut 6mm plastic, ideally Delrin, Acetal, or Polycarbonate (preferably not acrylic) using Pettis joints to hold it together with hex cap screw and square nuts. These joins have proven them selves to be very rigid and very easy to cut out with a laser cutter.



The motors, not having any mounting attachments, would be zip-tied in custom 3D printed motor clips which had nut traps so they could be bolted onto the top plate of the chassis. This would form a monocoque structure which would be easy to fabricate, construct and dismantle for repairs/upgrades.



To aid in the pushing of opponents a metal plate was added, this had a lip on the front that would protrude out and down. The idea being that as an opponent was found, engaged and pushed the lip would get underneath the opponent and raise their wheels reducing the contact with the ground degrading the grip.

Testing

Once version 1 of the chassis was laser cut and the parts installed the first problem was noted, the chassis was in fact cut out of 5mm acrylic, the design was for 6mm plastic. This difference was enough to completely ruin the strength of the structure however it was acceptable enough for testing. Another initial problem was that I was already using my LPC1343 development board in another project and could not remove it however I had recently bought a Teensy 3 from the Kickstarter. To control the motors I use a TB6612FNG breakout board I had available.



I connected everything up, wrote a quick program to control the motors and loaded it onto the Teensy 3. The first problem was the amount of noise that came from the motors, I thought something had gone horribly wrong, they shouldn't be that loud! Looking at the information on the Teensy 3's PWM it turns out the default frequency is 488.28 Hertz, this is far too slow and is well with in the human audible range. I changed the frequency to 18 kilohertz this is at the very top end of the audible frequency range and reduced the noise completely.
I've started to implement the code to read the number of counts per interval however I've yet to verify the numbers nor do anything useful with them.

/* Pin Map */
#define MOTOR_L_IN_1    16
#define MOTOR_L_IN_2    15
#define MOTOR_L_PWM     22
#define MOTOR_STBY      14
#define MOTOR_R_IN_1    17
#define MOTOR_R_IN_2    18
#define MOTOR_R_PWM     23
#define MOTOR_L_A       11
#define MOTOR_L_B       12
#define MOTOR_R_A       2
#define MOTOR_R_B       3
#define LED_STATUS      13
#define SENSOR_OPP_L    0
#define SENSOR_OPP_R    0
#define SENSOR_FLR_L    0
#define SENSOR_FLR_R    0
#define RUN             0

/* Global Variables */
volatile unsigned long leftCounter = 0x00000000UL;
volatile unsigned long rightCounter = 0x00000000UL;
volatile char oldLeft, oldRight, newLeft = 0, newRight = 0;
static char encoderQuadrature[16] = {0,-1,1,2,1,0,2,-1,-1,2,0,1,2,1,-1,0};

/* Global Functions */
void leftMotorA(void) {
  oldLeft = newLeft;
  newLeft = (digitalRead(MOTOR_L_A) * 2) + digitalRead(MOTOR_L_B);
  leftCounter += encoderQuadrature[(oldLeft * 4) + newLeft];
}

void leftMotorB(void) {
  oldLeft = newLeft;
  newLeft = (digitalRead(MOTOR_L_A) * 2) + digitalRead(MOTOR_L_B);
  leftCounter += encoderQuadrature[(oldLeft * 4) + newLeft];
}

void rightMotorA(void) {
  oldRight = newRight;
  newRight = (digitalRead(MOTOR_R_A) * 2) + digitalRead(MOTOR_R_B);
  rightCounter += encoderQuadrature[(oldRight * 4) + newRight];
}
void rightMotorB(void) {
  oldRight = newRight;
  newRight = (digitalRead(MOTOR_R_A) * 2) + digitalRead(MOTOR_R_B);
  rightCounter += encoderQuadrature[(oldRight * 4) + newRight];
}

void getMotorSpeed(int &leftSpeed, int &rightSpeed) {
  static unsigned long elapsed = 0x00000000UL;
  unsigned int localLeftCounter = leftCounter;
  unsigned int localRightCounter = rightCounter;
  leftCounter = 0x00UL;
  rightCounter = 0x00UL;
  elapsed = micros() - elapsed;
  leftSpeed = (localLeftCounter * 60000000)/elapsed;
  rightSpeed = (localRightCounter * 60000000)/elapsed;
  return;
}

void setMotorSpeed(int leftSpeed, int rightSpeed) {
  if(leftSpeed > 0)
  {
    digitalWrite(MOTOR_L_IN_1, LOW);
    digitalWrite(MOTOR_L_IN_2, HIGH);
  }
  else if(leftSpeed < 0)
  {
    digitalWrite(MOTOR_L_IN_1, HIGH);
    digitalWrite(MOTOR_L_IN_2, LOW);
  }
  else
  {
    digitalWrite(MOTOR_L_IN_1, HIGH);
    digitalWrite(MOTOR_L_IN_2, HIGH);
  }
  analogWrite(MOTOR_L_PWM, leftSpeed);

  if(rightSpeed > 0)
  {
    digitalWrite(MOTOR_R_IN_1, LOW);
    digitalWrite(MOTOR_R_IN_2, HIGH);
  }
  else if(rightSpeed < 0)
  {
    digitalWrite(MOTOR_R_IN_1, HIGH);
    digitalWrite(MOTOR_R_IN_2, LOW);
  }
  else
  {
    digitalWrite(MOTOR_R_IN_1, HIGH);
    digitalWrite(MOTOR_R_IN_2, HIGH);
  }
  analogWrite(MOTOR_R_PWM, rightSpeed);

  return;
}

void setup(void) {

  Serial.begin(115200);

  pinMode(MOTOR_L_IN_1, OUTPUT);
  pinMode(MOTOR_L_IN_2, OUTPUT);
  pinMode(MOTOR_L_PWM, OUTPUT);
  pinMode(MOTOR_R_IN_1, OUTPUT);
  pinMode(MOTOR_R_IN_2, OUTPUT);
  pinMode(MOTOR_L_PWM, OUTPUT);
  pinMode(MOTOR_STBY, OUTPUT);
  pinMode(LED_STATUS, OUTPUT);
  pinMode(MOTOR_L_A, INPUT);
  pinMode(MOTOR_L_B, INPUT);
  pinMode(MOTOR_R_A, INPUT);
  pinMode(MOTOR_R_B, INPUT);
  pinMode(SENSOR_OPP_L, INPUT);
  pinMode(SENSOR_OPP_R, INPUT);
  pinMode(SENSOR_FLR_L, INPUT);
  pinMode(SENSOR_FLR_R, INPUT);
  pinMode(RUN, INPUT_PULLUP);

  digitalWrite(MOTOR_L_IN_1, LOW);
  digitalWrite(MOTOR_L_IN_2, LOW);
  digitalWrite(MOTOR_L_PWM, LOW);
  digitalWrite(MOTOR_R_IN_1, LOW);
  digitalWrite(MOTOR_R_IN_2, LOW);
  digitalWrite(MOTOR_R_PWM, LOW);
  digitalWrite(MOTOR_STBY, LOW);
  digitalWrite(LED_STATUS, LOW);

  attachInterrupt(MOTOR_L_A, leftMotorA, CHANGE);
  attachInterrupt(MOTOR_L_B, leftMotorB, CHANGE);
  attachInterrupt(MOTOR_R_A, rightMotorA, CHANGE);
  attachInterrupt(MOTOR_R_B, rightMotorB, CHANGE);

  analogWriteFrequency(MOTOR_L_PWM, 18000);

}

void loop(void) {
  int left, right;

  digitalWrite(MOTOR_STBY, HIGH); // enable motors
  setMotorSpeed(200, 200);

  while(1)
  {
    getMotorSpeed(left, right);
    Serial.print("\f\rCounts/minute is: ");
    Serial.print(right, DEC);
    digitalWrite(LED_STATUS, !digitalRead(LED_STATUS));
    delay(2000);
  }
}

Next Steps

The next steps forward from this point would be to sort out the chassis, either re-design it to take advantage of 5mm plastics or get it cut from 6mm plastic. Once I've finalised my chassis design and actually have it I then can finish the logic board layout and get it sent off to be manufactured. Another step I can take in parallel would be see about implementing the closed loop control in the Teensy 3 or using my LPC1343 development board. I'm planning on running this robot at the June 2014 Birmingham Tech Fest so I'll consider May 2014 to be my final deadline for a completed robot.

Friday 20 September 2013

Cupcake-o-Matic

This post is a copy of a log I wrote up here.

The Makerbot Cupcake CNC was Makerbot's first foray into the 3D printer kit market, and one of the first 3D printer kits on that market. The Cupcake CNC takes a lot of it's design cues from 2 sources, the initial reprap 3D printer, Darwin, and the other from the need to make it laser cut-able. It was followed by the Thing-o-Matic which fixed many of the problems associated with the Cupcake CNC.

The modified Cupcake

The Start

I bought a Cupcake CNC from Makerbot Industries in September 2009. I received Cupcake 224 from batch #6. I quickly assembled it and attempted a test print all in about 24 hours. It did not work. I could not get it to extrude plastic through the MK4 Plastruder reliably, when it did extrude I could then not get it to stick to the acrylic build platform. I left it be for a couple of years annoyed with what seemed a wasted purchase until January 2012 when I bought a MK5 drive gear from KD85 , the closest European distributor. I also added a heated build platform to my order to ensure the extrusion would stick to the bed.

These two upgrades allowed me to start printing reliably and I immediately started printing a new extruder to improve the MK4 plastruder. I was aiming to replace it with a stepper motor driven one so as to improve the build quality with a better model slicer such as Slic3r. I ended up printing out multiple extruder bodies as I repeatedly printed the wrong ones. One good side affect of this was that I also ended up printing out the rest of the Huxley Pro parts to match the NEMA14 stepper extruder body. A friend of mine has suggested he may find a use for it.

This vast amount of printing soon left me with very little of the 1lb natural ABS spool I received with the kit. I decided to buy some blue PLA as I thought it would be the ideal choice for future printing.

The Modifications

I have made the following modifications to my Cupcake CNC:

Updating the Electronics

The Cupcake originally came with the RepRap Generation 3 Electronics set:


The idea was that as each board carried out a specific function it would be easy to design and easy to replace/fix. Unfortunately it wasn't ideal as everyone has 3 axes and an extruder and by separating the boards it took up a lot of space and required lots of messy connecting wires.

One problem is that the Motherboard could only support 3 stepper motors however most 3D printers started to use a fourth stepper motor to drive the extruder. This led to some interesting hacks to add another stepper control channel to the Motherboard, the most popular of these was the 3G 5D Shield. It took one of the end stops from each Stepper Motor Driver and used them to generate the Enable, Step and Direction signals for a fourth Stepper Motor Driver. I did in fact make the required modifications to my Motherboard, see here, but I never did get round to using it as I decided that I wanted to step away from having so many separate boards mounted on my Cupcake's chassis.

Whilst looking at alternatives for the electronics I came across the Sanguinololu controller board. Checking on eBay had a Sanguinololu v1.2+ listed, complete, for  £89.00 + P&P. I decided that it would be better to just buy these electronics which would allow me to simply drop in popular firmwares such as Sprinter, Marlin or something more esoteric without having to modify everything so that it would work with a RepRap Motherboard. I simply have to edit the configuration files to match my Cupcake. Of course it is not as simple as plug and play, the new firmwares allow for things like acceleration and software based end stops so will require some tweaking. Nor do many of the connectors match, the stepper motors had 0.156" pitch connector but needed 0.1" connectors, it also meant that I could not use a PC PSU for power any more.

Improving the Power Supply

The Cupcake electronics were designed to use a PC power supply as a cheap and readily available power source. A 300 Watt PSU costs very little and produces +12V and +5V directly, but due to the range of PC PSUs there is a lot of variation. Some PSUs needed a load on the +5V rail in order to produce voltages, even on the +12V rail, that were within tolerances. They also have to be enabled by connecting a pin on the large ATX connector to ground, otherwise only the standby +5V rail was powered. This mean that despite their initial attractiveness they caused a lot of problems, not to mention their large bulk.

Now most RepRaps use LED power supplies off of eBay, the typical standard is a +12V 30A model. This should be enough to power both the electronics and extruder but also a large 200x200mm heated print bed. It isn't quite as cheap as a PC PSU (about twice the price at £20) it's certainly more compact and easier to use. One of the advantages of having a single board 3D printer controller is that it allows you to use a single regulator to produce the +5V rail for the micro-controller and logic circuits. I began to use the +12V LED PSU with my Cupcake-o-Matic and it worked very well with the Sanguinololu. It freed up a lot of space in the PSU mounting area underneath the build mechanism.

I also came into possession of a old HP laptop power supply. This PSU was rated at 19.5 Volts and could supply 11.8 Amps, the higher volts would mean that the motors could run more efficiently and the heater and heated bed would warm up quicker. The decrease in total current doesn't affect the Cupcake-o-Matic as it only has a 100x100mm heated bed.

Adding a Cantilever Z Axis

In order to move the extruder up and down in the Z-axis the Cupcake CNC used a platform suspended on 4 M8 nuts on threaded rods. These threaded rods were linked together with a timing belt such that if the motor moved one step (1.8°) then all the threaded rods would rotate by the same amount. This meant you could get an accuracy of 0.00625mm per step. Unfortunately this was very slow and relied on the threaded rod being exactly straight which it rarely was. What would happen is as the Z platform rose during a build one or more of the threaded rods would move in the x or y axes there by throwing off any precise accuracy in these axes. Another serious problem with this arrangement was the assumption that the 4 M8 nuts would always remain level and wouldn't jam. As a result the Z axis platform would be wonky which didn't help when printing.

To first fix this I printed a Z-Wobble arrester without pin. It replaces a nut on the Z platform and allows the threaded rod to move back and forth without necessarily dragging the platform in that direction. This was fiddle to install as it required the removal of a nut trap on the platform and then the nut to be moved down a bit, whilst still levelling the bed. It was hard to tell how well this was working but I certainly felt my Cupcake CNC worked better when the arrester was installed on the wonkiest threaded rod. However this did not fix the problem of having to level the Z platform so I began to research on Thingiverse for a good solution to solve my troubles permanently.

The first solution I found was a middle point solution, the ACME rod upgrade for Makerbot Cupcake. You needed to replace the bent M8 threaded rods and nuts with an ACME screw thread on CNC machined rods, this would be both smooth and straight. This seems like a great idea but it requires purchasing $85 worth of ACME threaded rod from the USA, which would cost a ridiculous amount with overseas shipping. So I had to shelve this idea with some regret.

The Thing-o-Matic had come out for some time ago at this point and I was rather interested in the Z axis which was made up of a cantilevered platform which had 2 smooth rods for stability and a linear stepper motor for positioning. What with the Thing-o-Matic being rather similar to the Cupcake CNC I looked around for a way to add this cantilever in. The first examples I found require the back plate be removed and then the fitting of some large plastic parts to be fitted to accommodate the rods and motors. These struck me as being a little too focused on the need to be 3D printable to actually be usable. However I also found the Cantilevered Z-Stage for Cupcake which is a laser cut design in 5mm plywood. Unfortunately I've not been able to find anywhere in the UK that supplies, let alone cuts 5mm plywood, it seems to be a uniquely US thing. With that in mind I had to settle for acrylic which is available in a range of colours with a 5mm thickness.

A cantilever Z-axis in laser cut acrylic.

A Better Extruder

The Makerbot Cupcake CNCs from batch 6 came with a laser cut Plastruder MK4. To drive the filament a T2.5 timing belt gear was used, it had 17 teeth which would bite into the filament, however the teeth were blunt so could not get a good grip on the filament reliably. This lead to the extruder jamming mid way through a print. When the Plastruder MK4 came out it was a new design but it was quickly superseded by improvements from the RepRap project.

These improvements took the form of the Wade's Geared Extruder, a simplified version of Adrian's Geared Extruder. The Wade's extruder is notable for its use of a single mounting block, a stepper motor, two gears and an idler assembly. The gears drive a 'Hobbed' bolt, this is a bolt where a thread has been cut across the bolt's circumference. The thread grips the filament but does not cut into it unnecessarily.

When I managed to get my MK4 working I printed out, among others, a Greg's Hinged Accessible Extruder as I wanted the best extruder. I was unsure as to what hot end I would end up with so ended up removing that part of the SCAD code. This probably wasn't my best idea as it makes mounting the Cupcake hot end very difficult and I've had to use some long M4 bolts and a piece of laser cut 3mm MDF to clamp it in place. This bodge, to be kind, can be seen in the image to the right. I'm hoping this bodge will last long enough for me to print an improved extruder, perhaps the latest modified Greg's but with mounting options for the 16mm diameter Cupcake hot end.

The Gregs extruder setup.

I'd also like to alter my hot end, at the moment it consists of the MK4 hotend but instead of nichrome wire wrapped around the brass barrel/nozzle I've added an aluminium heater block. This is a 20x20x10mm block of milled aluminium with a 5.6 ohm 2 Watt vitreous enamel resistor mounted inside. The thermistor is trapped on the outside with a small M3 washer screw. I'd love to reduce the amount of metal on my hot end and just use a nozzle mounted directly into the PTFE heat barrier and go back to using nichrome wire. This would let it heat up much faster but it would mean that it would need to be carefully controlled whilst extruding as it would lose heat much more easily. However I could use a J-Head Nozzle hot end, these are popular due to their high reliability, unfortunately they can cost up to £50 which is a lot for something so small.

The Future

I'd like to add a few more upgrades to this "Cupcake-o-Matic" in the future namely:

  • Add an LED ring around the hot end so as to easily see what is happening.
  • Replace the hot end thermistor for a thermocouple to allow for a better control system.
  • Add a webcam mount for videos or remote printing.
  • Affix end stops to allow for automated homing.
  • Exchange the Z axis drive with a lead screw instead of M8 rod (possibly TR8x1.5).
  • Tune the whole 3D printer for quieter printing.

At the moment I view 3D printing akin to Linux. In order to be working on the cool parts you MUST have a rock solid back up machine so that you can rescue the cutting edge machine when needs be. I want my Cupcake-o-Matic to be my back-up machine.

Tuesday 17 September 2013

Speed Controllers

The Unnamed will be powered by 2 Gimson GR02s which drive a wheel and a pulley each, which turn another wheel and pulley combo. This gives me four wheeled drive which helps with acceleration and manoeuvrability. However I need something to take the servo signals (a period of 20 milliseconds with a high pulse between 1 millisecond to 2 milliseconds to determine speed and direction) and convert them into motor signals.

A GR02 will, when stalled, pull approximately 61.6 Amps according to the manufacturer. This means I need to find something that can withstand that much current for short moments of time. The best way to do this is to do some research and build up a table of options.

Channels 
2
1
1
2
Continuous Current 
30 Amps
85 Amps
85 Amps
25 Amps
Peak Current 
90 Amps
100 Amps
100 Amps
50 Amps
Min Voltage 
12 Volts
7.4 Volts
7.4 Volts
6 Volts
Max Voltage 
36 Volts
25.2 Volts
25.2 Volts
30 Volts
Dimensions 
?
?
?
?
Weight 
99.2 Grams
89 Grams
89 Grams
90 Grams
Price 
 £    116.16
 £    43.94
 £   28.22
 £      78.48


One thing to note about this comparison is that the TZ-85As are only single channel, I will need two to drive both my motors. I'm also not confident that they will withstand 85 Amps continuously. However there have been widely used without complaints in the Australian robot combat leagues. I've included the pre-programmed ones sold by BotBitz as well as un-programmed ones directly from HobbyKing.


Looking at that table the TZ-85As seem to be the best for current handling capabilities and their maximum voltage is greater than the motor can handle. They are also quite compact and if I buy them from HobbyKing and re-program them myself they work out to be much cheaper. The lower cost also means that I feel a lot better about modifying them as having spares around will not be expensive.

Monday 16 September 2013

Unnamed Design Revisions

After coming up with the first design I posted it on the Fighting Robot Association (FRA) forums to get some comments and suggestions. One of the worries was that it wouldn't be armoured enough to survive the spinners. Another concern raised was the need for a solid drive-train as the robot would need to be agile and fast to out manoeuvre opponents.

You can visit the forum post here.

What's Changed ?

All the internal UHMWPE support/structure is being replaced with 2"x1"x0.125" aluminium (6063 T3) channel. I'll be buying it from Aluminium Warehouse and they offer a cutting service which I'll use to get the lengths into ~500mm sections. This massively simplifies the mounting of the motors not to mention improving the rigidity of the robot. I'm going to keep the 20mm & 0.5mm tool steel composite armour for the moment however it can be changed out later.

  • I'll make nut strip using 12mmx12mm aluminium bar with M6 threads and use that to connect the aluminium channel together.
  • The front and rear armour has been upgraded to 4mm-6mm Hardox however this will need to be machined by someone with the tools.
  • The top and bottom armour/covers will also be upgraded to 5mm polycarbonate however I'm not too sure how to mount these.
  • The lifter will now be powered by 2 linear actuators from Gimson but the overall design & calculations are still in progress.
  • The wheels will be Banebots 2-7/8" Shure 50 tires with 3/4" hex mounting, I'll then use the 1/2" to 3/4" key way mount to affix these to the shafts. The gears will hopefully be attached to the wheels but I may get HPC to put a 1/2" key way mount on them too.

The revised total weight is 8.3kg minus lifting arm and revised total cost is £414.06.


Saturday 14 September 2013

The Unnamed

I've been a great fan of Robot Wars since 1998 leading to me running a robot club in secondary school. None of the featherweight robots that were built in the club really got anywhere, and considering they were largely built out of MDF they weren't going to be very robust. However this did plant a seed in my mind which has been constantly growing and nagging. The MDF robots hit the painful snag of not having a decent way to mount wheels to the windscreen wiper motors and attempts to use the Rex's Robot Challenge method of washers and wood never worked well enough.

Now I've moved on a little bit and got a proper job I think it's time to have another go with 15 years of added experience.

Scope

I've got an electronic engineering degree and if that and my work experience have taught me one thing, requirements are king. With that in mind here I go:


  • To design, build and compete with a 12-13.6kg robot
  • To spend less than £500 on parts
  • To increase my mechanical knowledge
  • To enjoy the fact my 100s of hours of work may well be destroyed in seconds by a full body spinner.

Description

Now in order to fulfil the compete part of that specification I want something that is reasonably simple and robust, no esoteric weapons. Cutting and impact weapons always seemed to lack any visible damage element (heavy weight Razor aside). This leaves spinners and flippers and I much prefer Chaos 2 to Hypnodisk...

I've been a great fan of Charles Guan's blog and I'm going to heavily plagiarise from his designs, after all he is a mechanical engineer from MIT who builds successful featherweights. Unfortunately I do not have access to quite his wealth of machine tools, I have access to a friend's combination lathe & mill, a few mechanical engineers to run ideas by and that's about it. I personally own a hacksaw, a 14V drill and 1 working 3D printer.

Pneumatics are something I'm totally unfamiliar with and so I feel for safety I will leave them well alone, instead I shall use a 4 bar lifter. Four bar lifters seem to be complicated to design but straightforward to construct which certainly fits my limitations. I'll couple that with some high power, high speed drill motors with gear boxes in an attempt to mix "Test Bot 4 SP1" and "Null Hypothesis" from Charles Guan.

The Ingredients


  • 20mm thick Ultra High Molecular Weight PolyEthylene (UHMWPE) for the chassis frame held together with M8 bolts and threaded inserts
  • 0.5mm tool steel (or better) side armour
  • 3mm steel (or better) armour for front and rear
  • 3mm polycarbonate for the top & bottom armour held with M5 bolts and threaded inserts
  • 2 off Gimson GR02 18V 24:1 motors for drive
  • 4 off ~75mmx20mm wheels, either 3" no names or Banebots 2-7/8"
  • 4 off 5mm pitch, 9mm HTD belt & pulleys to drive 2 wheels per motor
  • 1 off 6S1P 22.2V 5000mAh 35-70C Turnigy Nano-tech LiPoly battery pack
  • 1 off custom motor & weapon controller with magic
  • 1 off 2.4GHz RC set (suggestions welcome)
  • 1 off weapon, 4 bar lifter, tending towards a linear actuator from Gimson.

The Result

This is the work of a few nights of playing around in SketchUp:


The side armour will consist of 0.5mm of tool steel mounted to a 20mm thick panel of UHMWPE. I'm hoping that this composite armour should be capable of surviving spinner attacks because the tool steel should stop the teeth from biting very well and the UHMWPE will flex absorbing some of the spinners impact. Of course it's fairly replaceable and I may redesign it in future as I finalise it.

I've chosen poly-carbonate for the top and bottom as I think featureless steel boxes are pretty boring to look at even if they are painted amazingly. I may have to thicken up the poly-carbonate in a later redesign but it should be both strong and transparent enough for this robot.

The Gimson GR02 motors will be the 18 Volt version with a 24:1 gear ratio output. I chose this rather than the 36:1 as while a ratio of 36:1 gave me a faster top speed, it had slower acceleration, the 24:1 gives me a faster acceleration which I feel will be better suited to arena combat. With 75mm wheels I'm estimating a top speed of around 3.2 metres per second, the number will go down due to the motors being loaded, but at the same time I'll be over-volting them from 18 Volts to 22 Volts.

Hopefully once I get an idea of how I'm going to mount the wheels and the dimensions of the lifter I should be able to push forward and order the parts. The current running cost is an estimated £350 minus the cost of steel armour, the lifter and the electronics. The current running weight is 9.7kg all included however I expect that to creep up as the wheels and lifter arrangements are finalised.

Thursday 12 September 2013

*tock tock* Is this thing on?

I've decided to start a blog. I have lots of creative ideas and keep starting projects but never quite finish them. I'm hoping that by writing about them I'll end up finishing more of them, or at least getting them to a finished-ish state. So with out further ado...

Active projects

Makerbot Cupcake-o-Matic

This is my fairly successful attempt to convert my non-working Makerbot Cupcake into a working reliable 3D printer. I've largely finished this, it just needs the wires hiding to neaten the external appearance, of course it's not quite as simple as that but I'll save that for a subsequent post.

Prusa i3

Whilst the Cupcake-o-Matic works, and fairly reliable at that it does only have a 100mm x 100mm x 100mm build volume with a single extruder it's not very expandable. I do want to print large objects in multiple materials and so I began to construct a single sheet style Prusa i3. I have nearly all of the parts but I still need to print some and design some.

The Unnamed featherweight

I've been interested in combat robots since Robot Wars came out in 1998. I tried my hand at building a featherweight (12Kg max) class robot whilst at secondary school but it didn't work out at all. After reading Charles Guan's blog I've decided to have another go.

Powerbridge

Of course a 12kg combat robot will need some motor controllers, so I resurrected some designs I've been playing around and started to update them for the featherweight class of robots, it has the preliminary specs of 2x 20Amp 50Volt motor controller with easy firmware updates.

Claymore MiniSumo

Another combat robot I've been designing is a small autonomous 500gram sumo bot, I like the idea of robots that control themselves, the start of Skynet as it were.

That is it

I'm going to concentrate on these 4 projects until I complete as many of them as possible. My ideas for other projects like: a gokart, a home server, home automation, an updated Wave Bubble are all going on hiatus.