Category Archives: Uncategorized

Shonkbot

It was the journey home from MakerFaire UK, and Matt Venn, Richard Sewell and Anton Bowers were plotting about cheap robots, that were easy and cheap to build but also could do something interesting.

Richard has since made a shonky robot, designed to be made for as little money as possible. It writes its own name using a pen, and currently costs about £7 – we’re hoping to reduce that.

He donated a couple of stepper motors to me so I could try and make one myself. It was easy…esque. I don’t have a gluegun and that seems to have given it an extra level of shonkiness. But it’s a start. So here are some notes for later.

shonky1

shonky2

bot2

Step 1: Assemble the components

components

  • An arduino nano or clone
  • Some 20cm cable ties
  • A three x ‘AA’ battery box like this one
  • On old CD
  • A little breadboard
  • 2 stepper motors like these
  • wheels to fit the motors
  • O-rings or elastic bands to fit the wheels
  • glue (not UHU though. a gluegun works best, or failing that, some superglue)
  • 14 male to female jumper wires
  • 3 ‘AA’ batteries
  • A sharpie

You’ll also need a laptop and a mini (not micro) USB cable to connect the nano.

Step 2: Glue the wheels onto the CD

wheels

The wheels need to have some sort of grip on them. 50mm length rubber bands (measured like this) would work for these ones.

Step 3: Glue the supports onto the CD

Richard’s top tip: bend the cable tie a little about an inch from the latch. Mine: make the loop as big as you can.

loops

My pen-holder cable ties just wouldn’t stick (with superglue), so I tried something else (see later). The loops were ok though.

Step 4: Programme the Arduino and try the stepper motors powered from the USB

Here’s Richard’s code. You need this stepper motor library from here on github.

Connecting it up is easy:

  • board 1: wire arduino pin D2 to driver board IN1, D3 to IN2, D4 to IN3, D5 to IN4
  • board 2: wire arduino pin D6 to driver board IN1, D7 to IN2, D8 to IN3, D9 to IN4

Then you just add ground and 5v from the arduino to the motor boards, and then connect up the battery pack to the mini breadboard.

wiring

I had to get new drivers for the cheapo Arduino clone (CH340G chip) I was using.

On Mac Yosemite, I had to use the Arduino IDE 1.6 rather than the old 1.0 I had installed.

Step 5: Glue or fasten the boards, breadboard and battery pack onto the top of the CD

Gluedots seem to work well. Or even rubber bands – they don’t need to be very firmly stuck. If you put the stepper boards at the front the LEDs will light up satisfyingly. The battery pack is relatively heavy so needs to be more or less centred to stop it falling backwards. Make sure you leave the CD hole free for the pen.

Step 6: Add the sharpie

final

Here I connected my sharpie to two cable ties with a rubber band, pushed through the underside of the CD and then wrapped a bit of wire round it to secure it – ideally it should stay as vertical as possible. Richard did it differently:

richard_bot

Step 7: Connect up the batteries and place on A3 paper

Place about half way up the short side of the piece of paper, with the front facing towards the centre of the paper.

This is the best I’ve managed:

shonky_word

Mine is a bit weird because its wheels are slightly too big because of the velcro padding I needed to attach my too-big rubber bands – this can be fixed as a parameter in the code though.

Here’s what it ought to look like:

shonky_writing_better

Of course there’s lots of other things that could be done with it.

Guest blog: David Miller – A solar-powered glitter ball rotator

My Dad’s always had an interest in tinkering with electronics and the like. Recently he made an interesting thing so I asked him to write it up, and here it is:

A few weeks ago my wife and I were invited to join four friends for Sunday lunch. Our host has a south-facing dining room with a glitter ball sitting in the window. We were all entertained by the light beams gradually moving around the walls and ceiling. I suggested that a small solar cell and motor attached to the glitterball might improve the entertainment.

I bought these parts from Maplin soon after at a cost of £3.60. I glued the motor and cell to a spare ruler to which I also glued a strong copper wire to attach all to the ceiling. I have this running in our garden room.

SolarMotor

It rotates too fast and I need to add a resistor. Whether our friend will want this clutter with her glitter ball I have yet to find out. I await her next visit here before further changes.

Glitterball

Walls Have Eyes goes to the Design Museum

We made this initially as a post for a presentation at work, but it doesn’t seem quite right for a work blogpost (though we will do one for that too) but it seems a shame for it not to be public.

The context is this: a fairly quick hack Andrew Nicolaou, Jasmine Cox and I made for Mozfest got nominated for Design of the Year 2015, and so we redesigned it so that it would last five months in place at the museum as part of their exhibition (we hoped; we’ve had some teething problems).

This was something that’s completely new to me and Andrew, though Jasmine is much more experienced at making these kinds of things.

This is the story of us setting it all up.

Jasmine took most of the photos.

As Andrew pointed out, it’s come out a bit like a Peter and Jane book.

We initially made Walls Have Eyes very quickly as part of Ian and Jasmine’s Ethical Dilemma Cafe
WallsHaveEyes5

The combination of electronics in innocuous frames

WallsHaveEyes6


and an extremely noisy dot matrix printer

WallsHaveEyes2


and an updating html output from the cameras, meant that it got the message across quite well

mozfest_image


Then we were unexpectedly nominated for the Designs of the Year, which meant we had to build something that lasts 5 months.


So we needed to redesign it a bit and improve the code

plan

It was going to be on a wall rather than in an ambient cafe environment, so it needed a trigger, to make the experience more immediate, like this ultrasonic sensor
proximity_sensor


It needed wired networking rather than wifi for reliability, and we needed to test it intensively

in_kitchen


so Andrew and Libby rewrote the code (mostly Andrew).

code

Andrew designed and laser cut some beautiful glowing fittings for the frames

closeup_frame

Andrew, Dan and Libby tested it at QCon, including creating a ‘surveillance owl’ fitting for the sensor

qcon

and working through a load of issues

issues

By thursday we had all the bits more or less working in the kitchen

at_work

On Friday morning we took it all to the Design Museum, realising in the process that we needed better bags

packed

At the muesum, this was the first time we’d put the Raspberry Pis in the frames

libby_brain

and consequently that took a while

andrew_libby_frames_baffled

jasmine

Then placement took even longer

drilled_holes

and involved drilling

drilling_jasmine

and pondering

libby_andrew_pondering

and threading wires through holes

threading

We didn’t quite get it ready by the end of friday and had a mad dash to get trains, punctuated by Libby taking pictures of Tower Bridge

tower_bridge

On Monday, Andrew did a very slow, stressful dash across London through the roadworks to pick up some postcards and sort out the networking so we could debug remotely.

Then on Tuesday we all went over to do some final tweaks

dusting

and debugging.

is_it_working

Then, finally, the party started.

serious_andrew_libby

and it was working!

man_looking

and people were looking at it!

three_looking

so we had a small beer.

laughing_libby_jasmine


and it works still…

near_complete


…although yesterday we had to do a little fix.

gluegun

A little stepper motor

I want to make a rotating 3D-printed head-on-a-spring for my podcast in a box (obviously). Last week I had a play with a tiny servo motor that Richard Sewell had given me ages ago, and discovered the difference between steppers, servos and DC motors. Servos can be modified to go all the way round – they don’t usually, as I found out last week – but modifying the 9g looked a bit hard. Meanwhile John Honniball kindly gave me a little Switec type stepper motor and some excellent links.

Getting it to work didn’t take too long – the code’s below, and there’s a simple Arduino library to make it work (on github) and some instructions to wire it up, including tips on getting the wires attached. I had to prise it apart to make it rotate continuously, but that was easy in this case (the one I had didn’t even have screws, just clips). I haven’t got a 3D-printed head yet, just a bit of wire, foil and foam sheet in its place (on a spring though).

Exciting video: https://www.flickr.com/photos/nicecupoftea/16759666917/

stepper

#include <SwitecX25.h>
 
// standard X25.168 range 315 degrees at 1/3 degree steps
#define STEPS (315*3)

SwitecX25 motor(STEPS, 4,5,6,7); 
int nLoops = 10;
int currentStep = 0;
int count = 0;
int state = 1;

void setup(void)
{
  Serial.begin(9600);
}
void loop() {
   char c = Serial.read();
   if(c == '0'){
     state = 0;
     Serial.println("stopped");
   }
   if(c == '1'){
     state = 1;
     Serial.println("started");
   }
   if(state == 1){
     motor.currentStep = 0;         // reset origin on each rotation 
     motor.setPosition(STEPS*2);    // set target to way past end of rotation
     while (motor.currentStep<STEPS-1){
       motor.update();  // turn until rotation is complete
     }
   }
}

Tiny micro servo 9g and Duemilanove w/ ATmega168

It’s eons since I messed with an Arduino, and I’ve forgotten it all. All I have handy is a Duemilanove with ATmega168 and the newish version of the Arduino IDE doesn’t have Duemilanove ATmega168 as an option. Following this otherwise perfect tutorial and with IDE 1.6.1 (which works even though it’s for Java 6 and I have Java 8 on this mac), you get this error if you choose just Duemilanove:

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
[...]
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

But it’s fine if you choose “Arduino NG or older” in tools > board, like this:

blog_arduino1

The other difference is that these days, you don’t have to reboot after installing the FTDI drivers.

Once I have blink worked, I moved to this servo tutorial, since I have a tiny micro servo 9g from somewhere (Richard?).

mystery

In that tutorial it says you need to download and add the servo library; in fact it’s already there in “sketch > import library”.

Initially I got

Arduino: 1.6.1 (Mac OS X), Board: "Arduino NG or older, ATmega168"

Build options changed, rebuilding all
servo1.ino: In function 'void loop()':
servo1.ino:46:3: error: 'refresh' is not a member of 'Servo'
Error compiling.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

The tutorial is evidently very out of date with respect to the servo library – this fixed it (and hi Anachrocomputer in that thread!)

From the processing code in that tutorial:

//Output the servo position ( from 0 to 180)
  port.write("s"+spos);

using the serial monitor (set to 19200 baud rate) I should be able to input “s100″ in the serial monitor and have the servo move. But nothing happened. So I put some more logging in, and saw garbled stuff or nothing, and I wondered if my arduino is too old to do that baud rate. Doing this it reverses “foo” to “oof” but who knows.

Anyway, a few things:
firstly the code refers to the second servo, so the pin needs to be in analogue 2 not 1?
secondly, the serial monitor seems happier with line endings enabled
thirdly, and the actual problem turns out I had the pin wrong – that tutorial is very out of date, or the library’s changed a lot, or something. What you need is one of these, e.g digital 9.

Here’s the way I got it going.

Use this code:

// Sweep
// by BARRAGAN 
// This example code is in the public domain.
#include 
 
Servo myservo;  // create servo object to control a servo
                // a maximum of eight servo objects can be created
int pos = 0;    // variable to store the servo position
void setup()
{
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop()
{
  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees
  {                                  // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees
  {
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}

and the digital 9 pin as in the diagram on that page. Arduino pin naming seems nearly as confusing as the Raspberry Pi’s.

I think this little servo might be a bit noisy for what I have in mind, but it’s nice to have it working.

beansy_servo