Ada loves wall-e, and whilst repeatedly watching the film asked if we could make a wall-e robot. I’d never made anything that complicated so I looked online to see what others had done.
There are lots of cardboard wall-e robots and some plastic and metal ones (https://sennaswalle.blogspot.com/ ). To an inexperienced person like me it all looked too complicated.
While researching Ada had seen other styles of robot made out of cardboard and she liked them as much as wall-e. These robots seemed easier to build out of cardboard boxes.
We’d seen from our research that some wall-e robots could move around and so I thought we could make our robot do this (https://youtu.be/6VqS8c_eC0U). It didn’t seem unrealistic as I had started to remember my school A-level lessons in “Design & Technology” from the 1990’s.
Some research on the internet and some previous discussions with my friend Steve Holmes about his use of programmable microprocessors in art galleries and installations , he told me about Ardiuno as the go to product for “makers”.
A bit of googling I found a robot chassis with an Ardiuno clone, motor shield and other bits-and-bobs that look related and all for £12.58 from eBay. So on 25th October 2018 I placed my order in China and awaited the delivery (https://www.youtube.com/watch?v=eKcKdMb_nkQ and https://www.youtube.com/watch?v=autM98m5fwY)
I had backed a kickstarter project in 2016 called Bolt IoT (https://www.boltiot.com/) , I had planned to monitor the water level in our garden , but I just couldn’t get it to work with the sensor I had bought. So I knew I had connectivity through the Bolt board , so this seemed like a good way to get the project working.
8th November and the chassis arrived and Ada and I spent an hour assembling the board , she’s only three and loves getting involved. The chassis was cracked so I super glued the battery holder and motors on to keep it rigid.
I wrote a Postman script (https://www.getpostman.com/) to send commands to the Bolt board and using supplied H-Bridge motor driver supplied (took some time to read the manuals) and I could control a wheel forwards and backwards (https://youtu.be/DOWgpgBM1eU)
I built a small HTML5 page to send commands to the Bolt IOT cloud
9th November - I discovered the W3C Gamepad API (https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API/Using_the_Gamepad_API and https://hacks.mozilla.org/2013/12/the-gamepad-api/) which allows xbox controllers plugged into my laptop to drive an HTML5 website.
I wrote some basic code to test this (https://github.com/targetarchitecture/zebra-robot/blob/master/First%20Gamepad%20API%20HTML%20page.html)
This leads to an architecture as follows:
10th November - The chassis could drive around for a few minutes and then it would stop (https://youtu.be/oaiXitDjybw). Control was using the xbox 360 controllers triggers - do it was driven like a tank. After a bit of Googling I discovered that the Bolt IoT platform was throttling the requests to one every three seconds and anymore than that and the account usage is suspended for six hours , this was not ideal as the Xbox controller was sending hundreds of commands a second.
11th November - So I looked for something which could act as a web-server to receive the commands locally from the HTML5 page. I bought a Raspberry Pi 3, and after a bit of research I discovered Node-RED (https://nodered.org/) - a graphical interface for controlling things. This led to the following architecture where everything is received and controlled locally on the chassis:
The code that was running on the Pi is here.
12th November - First test drive! (https://youtu.be/YKVmp-HMKFw)
13th November - I had revelation....I had built something that worked but had too many dependencies and at was a relatively high cost. I realised that the destruction of the robot was inevitable and at around £50 per build and could get costly.
I knew that the robot chassis kit had an Ardunio clone in it and I started to think about using it instead of the Bolt and remove the laptop completely from the design.
14th November - I few hours later , I had a servo and a motor controller using a mouse (https://youtu.be/ge6qSBylkrc) . So with Node-RED on the laptop sending USB commands to the Arduino with Standard Firmata installed. This then controlled the H-Bridge and a servo.
Another realisation , was that I couldn't have the robot dependant on the laptop, and so I did some more research to find a “USB Host Shield” as the Arduino is only a USB Client and so cannot accept peripherals plugged into it.
16th November - USB Host Shield arrived, and I wrote code to use the USB xbox receiver when plugged into the shield. My code is based on the example sketch Xbox Wireless Receiver library developed by Kristian Lauszus (http://blog.tkjelectronics.dk/2012/12/xbox-360-receiver-added-to-the-usb-host-library/) .
17th November - Chassis reassembled with battery and arduino. The neighbours children came around to have a drive.
Ada and I started to build the robot head using a small box and foil, Ada choose the robot eye colour and helped glue the foil on to the head. Ada glued in the LEDs in place. I soldered the servo and LEDs together with (what I now know as dupont cables). I then wrote the code to control the eyes and make the head look left and right.
I built a “kill switch” scenario that turns everything off if you press the “xbox” button on the controller.
19th November - Ada decorated the robots head with ears , a smile and lots of pipe cleaners antenna.
Ada also decorated the kitchen roll arms with “washi” tape.
20th November - Robot was assembled with more glue and arms attached with Split Pins Butterfly Clip
21st November - Initial testing decapitated the robot as the servos move so fast, lock-to-lock in less than one second. This seems a common problem and I had to write code to slow down the servo , this is based on the “blink without delay” example.
22nd November - Robot now moves head slowly. I also bought a box of quality street sweets for my work colleagues. https://youtu.be/ZGvjm90Zj_M
23rd November - It’s Friday night and Ada decorated the robots front with playdoh lids, coffee jar lids and spares from Cbeebies Arts magazine.
24th November - Trip to B&Q to get plastic primer paint (note from the future - this didn’t work and the paint peeled). The quality street box is glued and ready for painting.
Ada had a little drive to check out the handling
27th November - Borrowed a glue gun and attached the quality street box to the chassis. Attached servos and strain relief to the cables. A lot of mess in the kitchen! Changed the H-Bridge from L298N (https://cdn.instructables.com/FRJ/7W76/HZDYE1YD/FRJ7W76HZDYE1YD.LARGE.jpg?auto=webp) to L9110S (https://robu.in/wp-content/uploads/2018/05/datasheet-l9110.pdf). These have a lot less pins and I was starting to run out of PWM pins on the Arduino.
I found some sample code at https://www.bananarobotics.com/shop/How-to-use-the-HG7881-(L9110)-Dual-Channel-Motor-Driver-Module
28th November - People had commented that the robot needed the arms to move. The arduino Uno doesn’t have enough PWM (https://www.arduino.cc/en/Tutorial/PWM) pins as the USB host shield uses two of them for signalling and not for PWM. So I had to move the Shield Select (SS) and interrupt (INT) pins on the USB host shield. There’s not enough a lot of information on the internet about this with comments around boards being broken or “it’s just not possible”. I found a good site (https://www.circuitsathome.com/mcu/arduino/usb-shield/troubleshooting-arduino-usb-host-shield/). Tried for the first time do this - I hate soldering small things.
29th November - Shield pin shift doesn’t look too bad and I had to make a code change in the USB.h header file wirth the library copied locally to the project to only make this change for this project. This is the first time I’ve programmed in C++ and there’s a lot to remember since University computing days.
I found a USB host board quality control script and uploaded to the Ardiuno https://github.com/targetarchitecture/zebra-robot/blob/master/USB%20Host%20Shield%202.0%20board%20quality%20control%20routine.ino
So after three days of research , I now have two additional PWM pins on the Arduino for the arm servos and the USB host shield is working after a lot of errors - until I made the USB library change, so SS = GPIO 8 and INT = GPIO 7. The USB host shield board was very cheap and needed the 3.3v and 5v pins connecting in order to provide power for USB connected device and the onboard electronics. Without these the board wasn’t actually powered on and so wasn’t responding to the library causing some wonderfully cryptic messages, when trying to upload the board test script.
I created a separate copy of the USB host shield library and modified the UsbCore.h file to change the pins for this project only.
/* shield pins. First parameter - SS pin, second parameter - INT pin */
typedef MAX3421e<P6, P3> MAX3421E; // Black Widow
#elif defined(CORE_TEENSY) && (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
typedef MAX3421e<P20, P7> MAX3421E; // Teensy++ 2.0 with XMEM2
typedef MAX3421e<P9, P8> MAX3421E; // Teensy++ 1.0 and 2.0
typedef MAX3421e<P53, P54> MAX3421E; // Arduino Mega ADK
typedef MAX3421e<P20, P19> MAX3421E; // Balanduino
#elif defined(__ARDUINO_X86__) && PLATFORM_ID == 0x06
typedef MAX3421e<P3, P2> MAX3421E; // The Intel Galileo supports much faster read and write speed at pin 2 and 3
typedef MAX3421e<P15, P5> MAX3421E; // ESP8266 boards
typedef MAX3421e<P5, P17> MAX3421E; // ESP32 boards
//typedef MAX3421e<P10, P9> MAX3421E; //Original before JJ altered
typedef MAX3421e<P8, P7> MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo, Due etc.), Intel Edison, Intel Galileo 2 or Teensy 2.0 and 3.x
The ardunio code can be found at https://github.com/targetarchitecture/zebra-robot/blob/master/Modified%20USB%20Host%20Library%20for%20Xbox360.ino
30th November - Ada painted the base of the robot.
I glued the servo arms to lollipop sticks ready for attachment.
The arms are now working, and the washi taped kitchen roll arms are going to be attached with rubber bands to allow some rough play.
2nd December - glued the H-bridge onto the chassis. At such low costs I’m not bothered about sacrificing small value components to the glue gun.
Glued the arduino to the top of the battery case. The arduino is now topped with a cheap sensor shield (it also came with the original eBay robot chassis kit).
Due to the USB host shield cables being rerouted I could attach the 3 servos and the 2 motor controls all on the 5 PWM pins.As I had used all of the GPIO digital pins I had to use the analog pins to drive the eye LEDs using analogWrite.
Added a power socket to allow battery pack with a switch to be externalised. Power from two 18650 3.7v batteries to generate 7.4v. Power is split to the H-bridge and the arduino.
Added strain relief to arm servos, cables routed out of the bottom of the shoe box, who cut out of the lid of quality street tin. I had concerns about the adhesive of the glue so I used tie wraps.
As usual full assembly takes place on the kitchen counter! You can see the three boards stacked together with the Arduino , USB Host controller, Sensor power distribution board
First test drive takes place and robot falls flat on its face as it’s top heavy and the acceleration and deceleration is too fast.
A Quick trip to Monk Bar models for some advice and they recommend another local shop that supplies modelling clay.
Ada helped pack out the robot base with 1Kg of clay to hopefully stop it toppling over.
Ada’s first test drive!
Almost immediately problems arise! With the robot spinning around and the microsoft usb receiver disconnecting. I have ordered a USb OTG cable to be able to see the debug details from the serial print statements in the code to diagnose.
Thinking it might be Xbox 360 controller I ordered on eBay a PS2 wireless controller and found some wiring diagrams and code - the “Super amazing PS2 controller Arduino Library v1.8” by Bill Porter (http://www.billporter.info/?p=240).
After wandering around the living room with my mobile phone using a serial monitor, it looked like the USB receiver would stop working, I put this down to battery power and had a change in plan, from xbox360 USB to an “playstation” RF receiver. This should draw less power, I also started to realise that power management with all of the sensor shield hat was not ideal.
The PS2 wireless controller code can be found here https://github.com/targetarchitecture/zebra-robot/blob/master/First%20attempt%20with%20PS2%20wireless%20controller.ino
So it is goodbye to all of these things below!
I had also purchased a DIY More “DM Strong Mini UNO R3 Board ATmega328 ATmega16U2 Microcontroller Module Micro USB Compatible for Arduino”
It is the same as an Arduino NANO but has the pins pre-wired up for servo dupont cables, this should lead to a simpler cabling layout, and less power draw than the full sized arduino. I’m learning fast that smaller boards use less power.
So with some code from the internet , I wired up a servo and the receiver to the new DIYmore NANO. All went well and I proceeded to wire up the servos and motor controllers as well. As the RF receiver used a lot less pins this meant there was plenty of space on the board.
The RF receiver only needs 3.3 volts and the DIYmore board conveniently outputs this so I used dupont wires (orange and blue) to power it.
Another test drive after a code rewrite to use the RF commands and not the USB Xbox360 commands.
After more coding Ada get another test drive
This code can be found here https://github.com/targetarchitecture/zebra-robot/blob/master/Complete%20Code.ino
It was all going well so it seemed as the robot worked...most of the time! Ada held a name my robot competition during her birthday party and then decided on the name “Zebra”.
Zebra worked well, but occasionally would just stop working and start spinning around - just like earlier in the build. Again I put this down to power. By the end of February I had learnt an important lesson that having seperate battery packs for motor load and processing load is sensible as motor load will drain batteries first and control via the processor won’t be lost.
I made space for two internal battery holders and wired up the NANO and the motor board input voltage separately. I also learnt about using a shared negative - after a great discussion with one of my electrical engineer friends - the shared negative is broken via a switch on the outside replacing the power jack I had previously fitted.
YouTube channel @ https://www.youtube.com/channel/UCYGqsl0rZpNkdK8ZrOUIPjQ
Light is a much loved font inspired by elements of Bauhaus design. Ideal for headlines, banners, logos & more, it will make your words stand out.