Xinchejian Shanghai Hackerspace AFRON $10 Competition submission

From XinCheJian
Jump to navigation Jump to search

All Swarm Robot wiki pages are here Swarm Robot pages and recent meeting notes.

Update:- Winner of 2nd place traditional roaming category!!!

Just announced at World Maker Faire New York 2012 are the winners of the AFRON $10 robot challenge. There were three categories: Tethered, Traditional (Roaming), All-in-One (Self-Contained).

The winners Traditional (Roaming) Category, which Xinchejian entered it’s SwarmRobots in are:

   1. Kilobot: Harvard, USA
   2. SwarmRobot: China
   3. SEG: MIT, USA
   4. DiscBot: USA 

That’s Xinchejian in second place, behind Harvard University’s funded research group and ahead of the MIT University!

XinCheJian Swarmrobots are fully self contained and do not rely upon any external systems for operation, once programmed.

Since entering the competition SwarmRobots we have been adding more capability including object detection, communication and wireless charging. If you would like to be part of Xinchejian or the SwarmRobots team, come to Xinchejian’s free Open Night, every Wednesday at 7:30PM to find out more or start with these Photos and Videos!

Stories discussing the competition: AFRON Wired Slashdot IEEE

ps - Wired have now corrected their post to show our 2nd placing!

1 Xinchejian Shanghai Hackerspace AFRON Competition Submission 2012

This page is Xinchejian's entry for the AFRON Competition 2012, category 2 Traditional: Computing on-board, and programming off-board.

SwarmRobot with InfraRed Sensors
SwarmRobot with new PCB InfraRed Sensor Shield

Xinchejian presents a complete SwarmRobot platform with sensors and sample code so the robot can interact with the environment.

The SwarmRobot is easily hand assembled on the PCB or on protoboard and uses a few easily obtained parts. Most of these parts can be substituted for a wide range of other parts, although this may require redesign of the PCB, or simply build on protoboard is seen here.

The cost of the SwarmRobot including the four IR sensor LEDs, fully optioned cost with all parts, programmer, battery and charger is $US 9.51.

This cost is easily reduced further if several parts are salvaged and by sharing a programmer among several SwarmRobots.

The SwarmRobot is expandable using different plugable shields. This provides an easy way for users to expand the SwarmRobot and also greatly simplifies the design and build effort. Additional shields have been designed and documented in the project.

The flexibility and expandability of the SwarmRobot hardware and software environments is highlighted by the SwarmRobots variations that have been created using a custom ATMEGA328 PCB and using an Arduino UNO.

The wiki pages linked to this submission contain documentation, photos and videos on SwarmRobot assembly, parts sourcing, and experimental use. Some links are to external sites for the source control of the hardware and software files and to a video hosting site.


In April 2012 a member of the Xinchejian hackerspace had a vision to create a team project that enabled members to learn and improve different kinds of skills through designing and creating a swarm of small robots that individually have little capability, but through collective swarm collaboration, can achieve more complex goals.

More information on the original vision can be seen at Origanl SwarmRobot Project and several more wiki pages containing information on the progress of the design and making of the Xinchejian SwarmRobots.

The discovery of the AFRON project was a very pleasant surprise as the core goals are a close match to the Xinchejian SwarmRobot project.

The educational nature of the Xinchejian SwarmRobot project is already getting unsolicited attention with two educational organisations making enquiries about workshops and use of the ideas in the last week!

During Xinchejians' SwarmRobot display Barcamp Fall 2012 Shanghai on 8th September, the minimal nature of of the SwarmRobots triggered a lot of discussion on how to implement many different behaviours or to improve existing ones. It seems that this minimal starting point triggers a lot more interest and involvement than presenting a more functional system, where many or most of the challenges have been already overcome!

This observation mirrors that of team members as they are continually challenged by the design boundaries of the SwarmRobot project.

These boundaries have continued to encourage creative ways to do things within the limited cost, physical space and processing/memory/IO. In recent weeks activity has peaked with interesting experiments, design discussions, and design and delivery of commercially manufactured printed circuit boards, the creation of a second sensor shield and two more versions of the main controller.

Xinchejians' entry in the AFRON competition is for the SwarmRobot AtTiny2313 and four InfraRed sensors documented in the pages linked to this submission. Additional SwarmRobot variations and shields are included to demonstrate the flexibility of the SwarmRobot solution.

High-level description of robot design

Three SwarmRobots

The Xinchejian SwarmRobot ATTiny2313 consists of a simple main controller PCB that contains all electronics, battery and motors and allows for direct connection of sensors, or connection via stackable shields.

The main controller PCB includes an AtTiny 2313 microprocessor (a close relative of processors used in the Arduino boards) a simple H-bridge controller to drive the two motors, a rechargable battery and optional LED indicators. The power LED is also used as the front 'wheel', but stiff wire can also be used in it's place!

For those with a more adventurous approach or maybe with more limited resources, the simple nature of the SwarmRobot means that it could even be assembled on a prototype board or even 'dead bug' style. Photos of breadboarded Xinchejian prototypes are included in the photo gallery.

The Xinchejian SwarmRobot is designed to be assembled by hand on a PCB, or prototype board, or even 'dead bug style'. It is also highly suitable for mass production and cost estimates for quantities of 100 and 1,000 have been included. Motors can be glued direct to the PCB, or in a more elaborate design, attached to a covering shell or body.

The hardware design is very flexible and allows a wide range of microprocessors to be used and even different motor controllers, or use of a scavenged motor controller. Versions have already been produced for an AtTiny2313, an Arduino UNO and an ATMEGA 328P on a custom Arduino board. The design information for these additional versions is included in the github source files, and here are some SwarmRobot Variations.

The modular nature of the physical, electronic, software and sensor environments provides a simple way to divide tasks to different team members or groups. Each group also needs to co-ordinate their overall activity as well as the key functions or behaviours that they desire their robots to have.

Another approach is to move team members from one skill area to another, providing both new learning opportunities as well as teaching and mentoring by those who have already gained skills in one area.

A simple ISP programmer is required to 'upload' programs from within the Arduino development environment. The programmer is cheap and can be shared amongst many team members. This also encourages careful programming by encouraging you to think ahead!

The battery charger can also be shared amongst several robots, as the suggested battery's 'life' is easily 15 minutes plus of active use and only takes five to ten minutes to charge.

Total cost for one prototype SwarmRobot

The full cost includes: One complete SwarmRobot, PCB, four IR sensor LEDs, battery, charger and programmer. The full cost excludes: Two bottle caps for the wheels and screws to attach.

All parts $US 9.51 $US 8.61
Without optional parts $US 9.31 n/a
Advanced config: $US 3.51 n/a see below for Sharing of parts and salvaging

Shields price estimates are provided for reference:

  • IR Object avoid $US 3.87 - using PCB, save a further 50cents if use breadboard
  • Simple IR $US 3.82 - does not include the object detection.
  • Mechanical Object avoid $US 2.71

The wiki page Making a SwarmRobot and it's linked pages contain the full parts list and prices, and also indicates which parts are optional and which can be obtained from recycling or salvaging.

To assist with calculation the pricing of the different configurations a spreadsheet has also been included. This spreadsheet also includes price estimates for manufacturing and the other types of SwarmRobots and shields and is located in the SwarmRobot GitHub repository.

When the SwarmRobot project commenced the majority of items were selected because they were already in the 'space'. This means that we do not have full records of the actual price and delivery fees. It also means that we did not choose the cheapest parts, but started with items that where already in the 'space'! So as discussed below, there are plenty of ways to make the SwarmRobot even cheaper!

Prices shown are using current prices of the same or similar shops and an estimate of delivery fees has been made as follows:

  • 1 Actual shipping cost is as unknown. Estimate provided is based on the following guess work
    • of 10 separate orders at 6Y, spread across 30 robots (just because 30 PCB!)
    • so per robot shipping = 2Y

Taobao is like Ebay - very dynamic - parts come and go quickly and prices change, so what you see now may not match what we purchased! The typical 6Y delivery price is combined into one single 6Y fee if you order many items from one shop and some shops even deliver for free!

There are opportunities to reduce costs even further:

  • scavenge battery and battery charger save (save $US1.58)
  • scavenge motor controller IC from a toy (save $US0.44)
  • scavenge motors (save $US0.95)
  • share programmer amongst several SwarmRobots (save $US2.25 per programmer)
  • use cheaper SMD devices, or there are other microprocessors in the Atmel atTiny and ATMEGA ranges that are cheaper than the AtTiny2313 that was used.
  • bulk purchasing of parts
  • mass production - discussed later.

A further 50cents or more could be saved purchasing the AtTiny2313 from TaoBao instead of the more expensive source that was used!

So a further $US5.50 can easily be saved, reducing the cost from $US9.51 to $US3.50 and further ways to reduce costs are available!

The prices quoted are for Shanghai China and delivery and possible import duties to other countries will affect the prices that you can achieve. Conversion rate used from on 9/9/2012 of 0.157637 RMB per US dollar/

Regardless, there are many ways that a 'compatible' SwarmRobot can be built very cheaply, using the parts that you have ready access to!

Educational applications and possible resources

The minimal nature of the AtTiny SwarmRobot with it's limits on size, cost, processing and IO ability, sensors and physical capability has shown that it immediately gets people involved in designing solutions and interacting with the SwarmRobots.

This immediately has people exploring the capability and limitations of across a range of topics including:

  • different sensors and how to use that within a program
  • how to communicate between robots
  • how to create co-operative swarm behaviour to achieve more complex goals
  • electronics
  • programming
  • design
  • soldering
  • fault finding and repair
  • recycling and scavenging

The Xinchejian wiki for the original SwarmRobot project has many such ideas and several discussions on how to implement various features, for example.

Two successful experiments are discussed on these pages Experiment-IR sensor object detection and SwarmRobot-Uno and Software Architecture and the early prototype work has resulted in three successful sensor shields that allow the SwarmRobot to interact with it's environment.

The SwarmRobot project builds upon the foundations and resources of the maker, hacker and open source communities including:

There are many web sites devoted to Sensors and robots, both non/commercial and in many languages!

Several resources to assist with making the SwarmRobot are linked in assembly instructions, including two that are available in several languages.


A complete list of parts, web sources and prices is included in the Making a SwarmRobot page.

The parts list also highlights which parts are optional, that is not critical to the main functions, and which items can be salvaged.

Not included in the parts list pricing are two bottle caps for the wheels and screws to attach and if using the IR shield, the cost of general purpose infrared remote control.

Making SwarmRobots

Step-by-step instructions and photos to help you make SwarmRobots and the tools and equipment required are described on this page Making a SwarmRobot.

Drawings and dimensions are contained in the PCB design files

Mass manufacture

Cost estimates for manufacture of "through hole" PTH versions (as submitted for the AFRON competition) and "surface mount" SMD versions of the SwarmRobot are listed below.

A spreadsheet showing detailed calculations is included in the SwarmRobot GitHub repository.

All the PCBA costs are based on estimates received from Taobao shop used by several Xinchejian members for PCB supply. No provision for any wages/costs associated with the effort of sourcing components, managing a PCBA process, delivery or duties have been included, only the estimated cost of parts and PCBA services.

For reference, the one off parts cost (without any assembly cost) is also shown in the table.

PTH Qty PTH Qty PTH Qty SMD Qty SMD Qty Notes
1 100 1000 100 1000
$US 9.51 $US 5.3 $US 4.89 $US 4.8 $US 4.43 "No allowance included for manufacturing loss QA yield and development spares."
$US 10.46 $US 5.83 $US 5.36 $US 5.29 $US 4.87 10% part loss allowance.

For all parts, including IR shield, except wheels and screws and for all assembly except motors (mounting and wiring), wheels and front skid which are left to the end user.


The SwarmRobot project builds upon the foundations and resources of the maker, hacker and open source communities.

Xinchejian has open sourced the software source and design files in this SwarmRobot GitHub repository using a CC BY SA licence.

The Arduino development environment and the additional AtTiny cores library are all open source. Instructions on installing and configuring the software are here.

Experiments conducted

The Xinchejian wiki for the SwarmRobot project has many such ideas and several discussions on how to implement various features, for example.

Two succesful experiments are discussed on these pages Experiment-IR sensor object detection SwarmRobot-Uno and Software Architecture and the early prototype work has resulted in two successful sensor shields that allow the SwarmRobot to interact with it's environment.

The Xinchejian display of SwarmRobots at Barcamp Fall Shanghai 2012 highlighted that SwarmRobots are:

  • fascinating - captivating - Wall follower (or avoid) in Bamboo ring
  • pretty kid proof - many times fall off table - motor attachment is strong
  • EXCEPT LED wheel - kids use one finger push on switch, instead of two finger squeeze!
  • InfraRed remote control - got a lot of discussion

The Barcamp display also had young and old interacting with the SwarmRobots and actively discussing how they worked and could be improved. One young girl return several times, each time clearly experimenting with different ways to interact and control the SwarmRobots and even twice taking a SwarmRobot away to a quiet area to conduct further exploration!

Workshop building SwarmRobots

A successful workshop to build SwarmRobots with ten attendees was held on 15th September 2012 (the closing date for the AFRON competition!) Some photos have been included. This workshop was open to members of the public who had no experience in electronics, soldering, or programming!

SwarmRobot workshop 2012-09-15
SwarmRobot with new PCB InfraRed Sensor Shield

Pictures and Videos

A Photo and Video gallery is also included. The videos show the SwarmRobots in action with the two different shields. The IR shields with the sample code makes the robots 'follow' the remote control. It was noted that most remote controls send strong signals that 'flood' an area with reflected IR light. So to avoid multiple IR sensors being triggered, and only trigger the one closest to the remote control, several layers of paper or similar means are required to reduce the strength of the signal. The effect of strong signals can be seen in the video through the SwarmRobots 'confusion' about which direction to move!

The wall follower-avoid shield can operate in either mode, simply by making minor code adjustments. Sample code has been provided for wall or obstacle avoidance and it is left as a simple exercise to change the code to follow the wall as seen in one video example. Hint: The video showing the SwarmRobot following the wall of the bamboo ring is using the wall avoid sample code without any changes! But the SwarmRobot had been running for a long time and the battery was getting flat.

Photos of the SwarmRobots and assembly and other types of SwarmRobots are distributed throughout this wiki.

All Xinchejian SwarmRobot AFRON wiki pages