Saturday 1 October 2016

I'm not dead yet!

Just a quick update today. The StIRLing Project is still in progress, I just haven't had time to work on it for a while.

I've decided to design and manufacture a custom circuit board, as I don't really trust the wiring on the PCB I put together last year (too many loose/exposed wires).  This has taken much longer than expected, so I've had to put this element on hold for the past nine months or so.  When I have more time, I will complete the circuit board and begin testing.

On the programming side, I have been conducting some research and experimentation.  Over the past several months, I have learned a lot about Python's OpenCV library, experimenting with webcam-based gesture recognition in the process.  Additionally, I have been looking for ways to implement Reinforcement Learning (RL) in Pybrain using a neural network.  No success yet, but I haven't given up!

I have exams right now, so I will not have time to work on the StIRLing Project until afterwards.  However, these will be over in a month or two, so I should have more time available.  I am still keen to finish this project, I just haven't had time to work on it.

Tuesday 22 December 2015

Board Construction (Almost) Complete!

Over the past few days, I've spent a fair amount of time assembling the circuit boards for the StIRLing test bed.  I now have a complete sensor shield and an almost complete power and control board.  The next steps involve testing the boards and mounting them to the robot.

Sensor Shield
The sensor shield (shown the with accelerometer,
gyro sensor, and magnetometer installed)
The sensor shield mounts on top of the Arduino Mega, providing connections to all of the various sensors and electrical equipment on the robot.  This shield includes headers for an accelerometer, gyro sensor, magnetometer, force sensitive resistors (FSRs), and ambient light sensors.  The shield also includes ports for the jumper wires between the sensor shield and the power and control board.

This board took around three hours to solder together.  It is simply an Arduino Mega prototyping shield with all of the necessary headers soldered on, with the idea of providing an easier method of (dis)connecting sensors and other equipment.  The board also has built in resistors for the headlights and  FSRs, simplifying the wiring process.

Despite the utility provided by this design, there are a few significant issues.  One of which is the large amount of exposed wiring on the underside of the shield.  This was necessary in order to provide power to all of the components attached to the shield.  The original prototype shield lacked power busses, and my solution involved stripping a length of wire and soldering it to the +5v (or GND) terminals and another, unallocated, location on the shield.  This works (I haven't had any issues so far), but it seems like a really primitive solution.

Another issue is the difficulty in producing this board, this board took about three hours to solder and some creative wiring solutions were required in order to make all the necessary connections.  One of these wiring solutions involves having wire stick out the side of the shield, being routed around the pins the shield uses to attach to the Arduino Mega.  This has the effect of making the shield fit somewhat poorly.  I plan to avoid these issues by creating my own circuit board layout and making a custom board, but this will take time that I currently lack.  Future versions of the StIRLing Platform will include custom sensor shields.

Power and Control Board
The Power and Control Board (shown with the servo
controllers, relay and USB power adapter installed)
The power and control board handles all of the power supply and servo control needs of the StIRLing platform test bed's electronics.  It is almost complete, but lacks a few parts that I didn't own when I soldered the board together.  This board provides connections to a tether and battery as well as a voltage regulator on 5v USB power adapter.  These components are wired up in order to supply the Raspberry Pi with 5v (through a USB adapter with the aim of stabilizing the power output) and supply the Arduino with 7.2-7.5v (depending on the power supply in use).


This board is simply a prototype board with all of the components soldered in a very compact fashion.  I originally intended for the this board to mount on top of the sensor shield, but I decided against this for a number of reasons (the prototype board I had on hand was too small to function as a shield, a lacked right-angled headers, etc.).  Instead, this board will likely be mounted on its side, next to the Arduino.

This board took about three hours to solder together, with some of the soldering proving to be more difficult than it was on the sensor shield.  As I had a relatively small prototype board, I had to be very efficient when packing the board.  The result is a very densely-packed circuit board with more than a few soldering mistakes on the other side.

In future versions of the StIRLing Platform, this board will definitely be replaced by a custom circuit board, likely in the form of a shield.  This board was assembled with a fair amount of difficulty, as it was not assembled in ideal conditions (small prototype board, missing parts, etc.).  So far, this board looks okay (no accidental connections), but it has not been fully tested yet.

Overall
The StIRLing test bed so far, with electronics in position.
Both boards will work for now, but should be replaced by custom-etched PCBs in future versions of the StIRLing platform.  In their current configuration, the boards take up a fair amount of space on the robot, but future versions will likely improve this.  For now, these boards will suffice, allowing testing and software production to proceed, after a few more tests and improvements.

Friday 18 December 2015

Body Assembly Complete

I have completed assembly of the main body of the test bed.  All of the legs are attached to the central platform.  The central platform is made up of six wedges and a locking ring, allowing it to be printed by smaller 3D printers.  
The Assembled Body
So far, no electronics have been installed.

The Wedges
The main body is made up of six wedges (each takes about 2.5 - 3 hours to print on my 3D printer).  These are locked together by a locking ring in the center of the platform.  The wedges are attached to this locking ring with 15mm M3 nuts and bolts with M4 washers to protect the 3D printed parts.

The Servo Mounts
Each base servo is attached to a wedge by three screws, despite the servos having four mounting holes.  I had to exclude the fourth screw in order to make room for the servo's cabling.

Next to each servo mount is a small, rectangular platform with two screw holes.  These platforms are for the electrical connections that provide a simple interface between the electronics mounted on each leg (three servos and one Force Sensitive Resistor) and the control electronics in the center of the body.  I will cover these in greater detail later.

Known Issues
With it's current design, the main body is susceptible to flexing along the lines between each wedge, as a result of the locking mechanism.  At the moment, this problem is being solved by using binder clips (not shown in the image) in the midpoints between each servo mount.  This works, but is only a temporary solution.  The next version of the body should address this issue (I'm aiming to have a top plate to connect all of the servos together, if possible).  Another solution to this issue would be to glue the wedges together, but I have not tested this.

Thursday 3 December 2015

Leg Construction Complete and Printer Troubles

Since my last post, I have worked to print and put together all six legs for the first version of the StIRLing Platform.  I finally succeeded in this process, but it took longer than expected.

A Jammed Extruder
After the first test leg was tweaked and the design finalized, I decided to bulk print five of the first leg bracket.  This bracket connects the first servo (which provides allows the leg to move back and forth) to the second servo, which functions as a knee joint, allowing the leg to pivot up and down.  I set up a print in Repetier-Host made up of five of these brackets, a print that would take around 5-6 hours to complete.

A couple of hours in, the extruder jammed.  I stopped the print, removed the failed brackets and started to open the extruder.  I noticed that the extruder had managed to squeeze filament out through the threads between the barrel and the heater block, a defect called retrograde extrusion.  This, however, wasn't the biggest problem.  The main problem was a length of cold filament inside the barrel (the threaded tube that passes filament from the extruder motor to the hot end).

After much research, I found that I needed to isolate the barrel in order to remove this filament.  At first, this proved very difficult.  I spent hours with a couple sets of channel locks in an attempt to remove the barrel from the block with the heater (there may be a name for this, but I'll call it the heated block for now).  The retrograde extrusion had pushed filament through the threads connecting the barrel to the heated block, locking the two pieces together very firmly.  I eventually came up with the idea to heat the extruder to a low temperature (100 °C) in order to weaken the plastic, allowing me to unscrew the barrel.  I used two sets of channel locks (one set on the heated block and another set on the barrel).  After removing the heated block, I inserted a small 1.5mm drill bit into the barrel and hammered the two parts together, to push the filament out.

After clearing the barrel, I reassembled the extruder, almost.  The block of aluminum that holds the barrel under the extruder motor (I'm calling it the mounting block for now) has two holes in my case, one tapped (threaded) and one not tapped with a set screw.  I that the barrel was originally in the untapped barrel, but I lacked the screwdriver bit for the set screw (this later turned out not to be true), so I decided to put the barrel back into the tapped hole, assuming I could screw it in and reassemble the extruder.  After doing this, I realized that my barrel was on the wrong side of the extruder motor (in my defense, I was doing this at about 11:30 pm), something I hadn't anticipated when I decided to screw in the barrel.

Bearing this in mind, I took apart the extruder and began to unscrew the barrel.  Then, right as I was a few millimetres from freeing the barrel, it seized, having likely become cross-threaded.  Nothing I tried (heat treatment, channel locks, lubricant) could remove the barrel from the mounting block.  I was able to free it the next morning after C-clamping the barrel to a table and using channel locks to unscrew the mounting block.  When it finally came out, it was followed by a little sprinkle of metal dust, a testament to just how stuck the two parts were.

After I freed the barrel, I found the right screwdriver bit (a star-shaped bit works well in place of a small allen key) and put the barrel in the correct hole.  I reassembled the extruder and was just about ready to go back to printing.

Bed Leveling
Before I returned to printing, I had to level my print bed.  This is a key task in any 3D printer, one that must be completed after any major change to the structure (moved endstops, new printing surface, etc.).  I leveled the bed quickly, but was eager to return to printing.  The first thing I did was give my printer the exact same job as before, a five hour print containing all of the first brackets of my hexapod legs.  I later came back to find a jammed extruder.  This time, the cause was an un

Tuesday 6 October 2015

R & D Update (October 6, 2015)

As I have been on vacation for the past week or so, I have set myself the goal of completing the major hardware elements (3D printed body parts, possibly electronics) over the next two weeks.  I have focused primarily on leg designs, but I have done some quick research into electronics and the main body design.

Over the past week, I have been looking into different leg designs.  I started with a rather large, bulky design, but I moved on when I decided it was too complex to be reliably and quickly 3D printed.
This design involved placing a servo in every joint, as just about every other hexapod I have seen has done.  I didn't like this, and it proved very difficult to design, so I moved on to another idea.

The finger-inspired design in the up position
For the next design, I decided to draw inspiration from the human finger and create a system with two tendon-like wires.  The idea was that you could have a servo inside the body pull a wire and the leg would contract and move downwards.  The servo could also pull another wire to lift the leg above the body.  These wires would be wound around a spool inside the body, one wound clockwise, the other counter-clockwise.  This winding would ensure that I would be able to tighten one wire and loosen the other with a single servo.

The finger-inspired design in the down position
 When I first came up with this design, I thought it was the solution to all of my design problems, it didn't have complex joints, heavy servos on the leg, and the parts printed very quickly.  However, I soon found that, while these were acceptable as fingers, they were hopeless as legs.  Any load applied from the base would cause the leg to fold upwards, regardless of the tension in the wires.  Because this was a fundamental flaw in my design, I went back to the drawing board...

I had to return to my previous idea of a servo in each joint.  However, I didn't want to create the same heavy and complicated design that I started with, so I revisited the idea of an asymmetric leg.  This was an idea I had a while ago (I may also have seen this elsewhere on the internet) involving a mount to the servo's horn without a mount to the other side, a one-sided axle.  I didn't like this to start with, because I worried about the design resulting in an off-center load and too much weight on the servos' motors, causing damage.
The Asymmetric Leg Design from the front

Despite these worries, I decided that this was the best way forwards.  I created a new design that allowed my servos to be swapped out quickly and attempt to minimize the weight put on the servos' motors.  On the left is the resultant design.

The Asymmetric Leg Design from the back
 From these images, you can see the side-entry bracket style in use and the lack of pivots on the back of the servos (the other design would have included these).

The control board is also visible in these images.  This board is a mostly complete soft (still on the breadboard) mock-up of the StIRLing control system.  It consists of an Arduino Mega and two daisy-chained TCL5940 PWM controllers for servo control.  I'll explain the board more when I get a circuit diagram (and possibly board design) locked in.

Right now, I am just test driving this new design to ensure everything is ready before entering the next stage of the project, leg production and main body design.  To do this, I created a very basic Arduino script that allows me to set servo positions manually, allowing me to check joint limitations and stability.
The asymmetric leg design running a test script.

Wednesday 19 August 2015

An Introduction to The StIRLing Project



StIRLing - Self-contained Intelligent Robotic Learning


Artificial Intelligence is a very exciting prospect.  The idea that we may soon have thinking machines working for us (maybe even living among us) is amazing.  Those of us who are not on the frontier of AI research, however, are unable to participate significantly in the development of these intelligences.  At best, we are able to sign up to be part of global computing networks or interacting with publicly available projects such as Cleverbot and Wolfram Alpha.

The goal of The StIRLing Project is to create a basic, open-source intelligent agent that resides within a hexapod robot.  The system (known as the StIRLing Platform) would be able to navigate, learn and accept and process sensory data.  On this blog, I will post my progress, code, designs, and just about all of the material that I use to create the StIRLing Platform.

When the platform is complete, all of the materials required will be available on the project's GitHub page.  As many parts as possible will be designed to be 3D-printable and all other component lists and schematics will be available on this blog.  This will allow anybody to build a StIRLing platform of their own and modify it to fit their needs.

Disclaimer
As this is the very beginning of the project, it is likely that many design features or elements will be changed.  It is not advised to follow my progress until the platform is completed and is fairly reliable.  However, as I progress, if you see a potential for improvement in my code or designs, feel free to comment, so as to bring it to my attention.  I am sure that there will be plenty of areas to improve on, as I am learning about AI and robot design through this project.