From XinCheJian
Jump to navigation Jump to search

Assembly notes

Notes on assembling the motor driver PCB - Please help everyone by adding to this page as you build your SwarmRobot!

It is a really good idea to TEST parts before assembly, especially items that are awkward to remove AND have proven to have a high failure rate (from cheap suppliers) like the motors and IR Receiver LEDs!

Part identification

Here are some links to help you identify electronic components. [Wikibooks Component Identification] [Pksec Electronic Components] [uC Hobby Identifying Electronic Components]

The parts list below also has photos to help you identify parts.

Parts lists and photos

SwarmRobot parts

Parts lists for the different SwarmRobots and shields:

The schematic, PCB, pinout cross reference and sample code for the main controller and the two shields as well as the two other SwarmRobot versions are all included in the [Xinchejian SwarmRobot github repository].

The circuit schematics and PCB are included in native format that can be edited, and also in at lest two common formats that that are read only.

If you wish to edit the schematics or PCB, then you will need to use the appropriate software listed below and may wish to refer to one of the introductory tutorials listed.

[Kicad] (used on AtTiny2313 version)

[Eagle] (used on Atmeg328 version)

   Note Xinchejian members are still using an older versions of Eagle 5.x, so if you use version 6.x the schematic and PCB files will need to be converted!

NOTE: Using a 3.7V battery to directly power the SwarmRobt without using the 78L05 voltage regulator works nicely, even though L293D data sheet says the min logic Vss is 4.5V. The build in photo leaves the voltage regulator out, so a jumper is required in bottom right of PCB. Further work will try to determine suitable voltage range, use of brown out fuses etc.

How to solder (multi-languages)

[how to solder (English)] plus 16 translations at bottom of page - including by Xinchejian!

[Soldering is Easy (English)] [Soldering is Easy (French)] Want to translate? Here’s the original comic artwork without text, 26.6M: [soldercomic_artwork.tif]

[More nice soldering tutorials via LadyAda]

Assembly Guide

The steps you undertake to assemble your SwarmRobot may vary if you do not have some of the optional parts, or if any parts you purchase or recycle vary from those in the parts list.

Main controller PCB schematic Main controller PCB IR shield schematic IR shield PCB


It is recommended that you assemble in this order:

  • Main PCB - all components - EXCEPT power LED
  • Motors wire, but do not glue on yet!
  • Test motor direction and speed
  • glue motors
  • solder power LED and set it's height for it's use as teh front wheel.


Guide for soldering parts on PCB

Note mount power LED under the PCB AFTER the wheels have been mounted. This is allows for more convenient motor and wheel assembly and also to adjust the LED height for it's use as the front wheel.

  • General soldering rule is start with the shortest height components then proceed to the tallest as this usually makes physically holding the components while soldering easier.
  • All LEDs have longer lead (the positive anode = the 'bar' side) in hole nearest the resistor.
  • 2 motor connectors - you may find it better to just solder the motor wire directly to PCB - so exclude from shield (BEST), or solder to shield!
  • We have been using SwarmRobots without the 78L05 voltage regulator so a jumper is required in bottom right of PCB.
  • make motor wires about 90mm each
  • test motors both run in same direction (ie forwards) - you can use the MotorTest code for this
  • best to run motor wires inside the header, not outside as seen in photos
  • Do last (even after the motors glued on!): Power LED - mount UNDER board - it doubles as front wheel. Adjust height to match your wheel height!

Motor assembly

Motor mounted with screw holes aligned to rear edge of PCB to increase stability
Motor wiring - better to run wires inside each header over the PCB to reduce wheel interference
Motor wiring interfering with wheels. Instead Place wires through PCB holes!
first layer of glue applied to PCB
Excess glue that rubbed on wheel
Excess glue trimmed
  • hot glue - is HOT and can stay burning hot for some minutes!
  • Xinchejian used hot glue, but you may have a different glue that works just as well!
  • build up layer over header pins, let partly cool until farily solid
  • add another layer and hold motor in position until cooled
  • try not to move motor while the glue sets.
  • try not to glue your wheel, if you do, best to cut excess before fully solid
  • if required, remove wheel - but best to wait until glue is strong
  • add a fillet of glue - along inner edge, and at end from top of PCB, over the edge and along end of gearbox

see photo

  • take care not to let the motor wires jam the wheel

- see photo

  • make sure motor outer edge is IN LINE with board edge or a bit outside

see photo

  • To cut the female headers to the required length, use side cutters or a saw, BUT you need to destory the next pin!

Untested method: Try - add 1st layer glue, cool then SMALL AMOUNT 2nd layer AND quickly place PCB vertical on flat surface (qickly so the glue does not run down!) position motor and add more glue on inner side of motor-PCB let cool, then do end this should get motor straight and give wheel clearance

You could also cut/bend header pins before 1st layer of glue

Note motor is mounted so that wheel is positioned as far to the rear as possible, to reduce the chances of the robot tipping backwards! The screw hole is aligned with the rear of the PCB. You could also try:

  • mounting battery or other weight under front of PCB.
  • soldering wire to power LED (and/or something at sides of PCB), that extends in front of PCB, and can hold battery to help stability.

wheel assembly

SwarmRobot underside battery and wheel spacer
SwarmRobot Bottle cap wheel with hole.JPG

IMPORTANT - it is easy for the screws to penetrate inside the motor casing and slow or stop the motor working! So use shorter screws than we did, or use 2 or more washers!

  • small screw hole, try not to squash bottle cap or your wheels will wobble!
  • may need use larger drill to smooth hole
  • make sure screw is at right angles to surface
  • motors Xinchejian used have a locating lug, either cut it of, or cut matching hole in your wheel
  • can use small drill to start/mark lug cutout
  • you can use a washer - eg plastic to stop wheel rubbing on motor
  • two other small lugs on gear body - some people prefer to leave, some remove!
  • may need to roughen or cut off the outer edge if it has a smooth ridge to enable wheel to grip.
  • Alternatively:
  • can add padding/washer - even a small piece of breadboard works

Tools - will vary according to your construction method

   - sharp knife - to cut wheel lug holes
   - small screwdriver to mount wheel
   - hot glue gun
   - soldering iron, solder with flux, or seperate flux
   - small pliers, side cutters
   - ISP programmer (or use an Arduino as ISP prog) or make - eg LittleWire -> Attiny45, or AtTiny2313 USB ASP ISP.
       ... but still the first chicken & egg programmer!
       6 pin ISP programming cable
   - Multimeter - battery voltage, continuity
   - Note continuity tests - can do with battery, resistor & LED, or Battery & speaker
       eg to get ISP cable connections correct

Useful Information

  • Connector pin numbers - pin 1 towards SAME end as both ICs! - ie towards power switch & LEDs
  • M2 connector is adjacent to Attiny, M1 adjacent to L293D
  • Power connector - Ground is closest to the corner, 2nd pin is +5v, or 3.7V from battery.
  • Should the power switch be mounted on the BODY instead of the PCB for easy access?
  • Sudden change of light - especially fluorescent can trigger IR LEDs briefly (in the simple shield - no signal decoding!)
  • Wires connected to the motor or the other end on the motor PCB, may need to be swapped to get the correct wheel direction
    • or you can swap these pin definitions in the code!

Alternate way to test and set the motor directions

If your motor(s) are going in the wrong direction, then you can just swap the paired IO pin numbers for each motor in the code.

This method is fine if you only have one or two SwarmRobots and can adjust the code everytime you upload. If you have many SwarmRobots, it is much better to change the motor wires so the motors go in the correct direction without changing the code!

For example change:

#define M_LF 2               // Motor Left Front
#define M_LB 3               // Motor Left Back


#define M_LF 3               // Motor Left Front
#define M_LB 2               // Motor Left Back

or change

#define M_RF 4               // Motor Right Front
#define M_RB 5               // Motor Right Back


#define M_RF 5               // Motor Right Front
#define M_RB 4               // Motor Right Back

Then compile upload and test!

Suggested improvements for the PCB

  • connector labels there are 4xcon2 & 2xcon6!!!
  • at least for con P2 & P4 - add at least pin 1#!
  • LEDs - names pwr(right), Rx(middle), Tx (left) instead of LED1 etc
  • ICSP - label pin1# (closest to corner) at least
  • add XCJ logo
  • Label +/- on all 3 power connectors
  • Two or four holes on each side of PCB to allow wires to go around motor/gearbox and strengthen the attachment/glue.
  • Also nice would be flatter area to attach motors AND more holes so glue can penetrate and have a stronger bond.
  • Use brackets instead of glue, they aren't messy and will not come off. (will need holes for it.)

Coding and Programming

This has been described in detail on this [Programming AFRON page].

All Xinchejian SwarmRobot AFRON wiki pages