Interactive Cow for MERL

The latest project I am working on with Kate is the interactive cow for MERL. As part of their rehang, they commissioned the building of an interactive cow which can be used by visitors. The cow will be capable of recording and playing back sounds, produces smells on demand and also will have removable textured ‘skins’ that can be attached to it.

The full-sized friesian cow arrived about 3 weeks ago, but we have yet to name her:


Perhaps we should hold a competition for a name?


Last week we started construction by cutting out part of the base that the cow will stand on, and also had to make a small hole in the belly to insert the magnets to hold the removable textures, and also to fit the electronics in when they are ready. We started by lying her on the sofa – perfect for minor operations:


Using a Dremel and a small cutting wheel, we cut out a small section – just large enough to get one’s arm inside! When the cow is upright you cannot see the hole.


The next job to do is to finish the base by adding braces, wheels and the sides, covering with faux grass and bolting on the cow. Once we have her rolling, then we’ll add some electronics.

Posted in Uncategorized | Leave a comment

Flickering lamp

This example shows how to control a mains lamp using a 240V relay board and an Arduino Uno. The idea is to randomly flicker the light on and off, similar to an old strip light when it becomes a bit old, or the starter is failing.

WARNING: Don’t mess with mains electricity, unless you are very confident about what you are doing. Mains supply can kill. If in doubt, get a qualified electrician/engineer to assist you.

Controller Board

The controller board is a cheap off-the-shelf 4-port 240V, 10A relay module. For this example I have just used an Arduino UNO to control it, though I will eventually replace this with an ATTiny85 as I need only 4 ports. The relay module is similar to this:


4-port relay module

Originally, I powered the relay module through the Arduino using the 5V output, but this affected the operation of the relays, and led to erratic behaviour – the input lights for the relay would flash on and off, but the relay would not change state. So instead, the relay board is powered using a separate power supply, and is connected to the Arduino using only the inputs and a GND connection.

Arduino Sketch

The C code for controlling the is simple: generate a random integer between 8 and 11 (those are the port numbers on the Arduino that I have used) and use that generated number to toggle the state of a associated port. Do this over and over …

#define INTERVAL 50

#define RELAY1 8 // Relay 1 is on pin 8, etc.
#define RELAY2 9
#define RELAY3 10
#define RELAY4 11

int switchState[4] = {0, 0, 0, 0};
int randomNumber = 0;

void lightSwitch(int state, int lampNumber);

void setup() {
// Relays are on pins 8 - 11
pinMode(RELAY1, OUTPUT);
pinMode(RELAY2, OUTPUT);
pinMode(RELAY3, OUTPUT);
pinMode(RELAY4, OUTPUT);

// The relays are active low, so pull them low to close the switch
digitalWrite(RELAY1, LOW);
digitalWrite(RELAY2, LOW);
digitalWrite(RELAY3, LOW);
digitalWrite(RELAY4, LOW);

void loop() {
// Randonly switch on and off a set of 4 lights

// On this cycle generate a lamp number
int randomNumber = random(20);

// Now toggle that lamp
if (randomNumber >= 8 && randomNumber <= 11) {


void toggleSwitch(int switchNumber) {

if (switchState[switchNumber - 8] = ~switchState[switchNumber - 8]) {
digitalWrite(switchNumber, HIGH);
} else {
digitalWrite(switchNumber, LOW);


Here’s a video of the lamp controller:

You can hear all four relays switching on and off, which adds to the effect.

To Do

  1. Test this on the strip lights.
  2. Make board with ATTiny85 and voltage regulator.
  3. Place relay module and controller into an enclosure.
  4. Find cheap 240V – 12V power supply to power the relay module and ATTiny.
Posted in Uncategorized | Leave a comment

ATTiny85 Programmer

The other project for this weekend was a really simple ATTiny85 programmer ‘shield’ for an Arduino Uno. This board fits on top of the Uno and effectively turns the Uno into a programmer for the ATTiny chip. The programmer takes about 20 minutes to assemble, and requires nothing more than a piece of stripboard, a dip socket and a 10μF capacitor. I have also added an LED (+ 220Ω resistor) to the board so that I can test the ATTiny by uploading a blink sketch.

Stripboard View

I have used a 9 x 25 stripboard (a standard size you can by cheap off ebay), as it was what I had to hand. Of course, you could use a dedicated Arduino proto shield, which would look a lot neater and fit better.


Side views:


Fritzing View

Below are the Fritzing diagram for the programmer. On the left is the topside to show the placement of the components (note that the top of the stripboard has no strips on it – they are shown here for guidance only). The right view shows the reverse of the board, where the strips have been cut. I have a little tool for doing this, but a 4mm drill bit would work just as well.



9 x 25 single-sided stripboard
8 pin DIL socket to fit the ATTiny
1 x 10μF capacitor
1 x 220Ω resistor
1 x 3mm LED
single core wire
1 x 9 pin male header, 1 x 7 pin male header
1 x ATTiny85 to program


Start by soldering the resistor to the board, followed by the jumper wires. Then add the DIL socket.

Before soldering the headers, place the headers into the stripboard , and then onto the socket on the Arduino and push them into place. Using a flat metal object (such as the side of a pair of tweezers) press on top of the headers to push the pins down so that they are flush with the plastic body. This helps to extend the pins, so they fit better into the sockets on the Uno. Now go ahead and solder the headers onto the stripboard.

Add the LED – don’t forget to get this the right way round : the longer leg (anode) goes next to the resistor.  Finally add the capacitor.

When you have finished soldering the stripboard, fit it on top of the Uno, making sure that the right hand side pin of the 7 pin header fits into the right hand GND socket on the Uno, and the  right hand side pin of the 9 pin header fits into socket 8 of the Uno. See image above.

Below is an image of the programmer with teh ATTiny in place. Note the location of the dot. I have coloured this in white to highlight it, bt on the chip itself it will be black.


Using the programmer

  1. Before you can program the ATTiny with the Arduino IDE, you will need to add ATTiny hardware profile to the Arduino IDE. With version 1.6.4 you can use the tools > boards > boards manager to add the ATTiny. With older version you will need to manually download and install the profile. I would suggest you go here, as this is a good explanation of how to set it up.
  2. Place the programmer onto the Uno as described above. Plug the Uno into your computer using the USB cable.
  3. Open the Arduino programming IDE and open the sketch Examples > ArduinoISP. Compile and upload this sketch to the Uno. This temporarily converts the Uno into a programmer for the ATTiny.
  4. Make sure your ATTiny85 is in the socket on the programmer, and that it is the right way around. See image above for correct orientation.
  5. Open the standard blink sketch and change it to the following:


void setup() {
// put your setup code here, to run once:
pinMode(3, OUTPUT);

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(3, HIGH);
digitalWrite(3, LOW);

  1. Change the board type in the Arduino IDE to ATTiny85 (how to do this will depend upon which version IDE you have) and select 8MHz internal clock. The COM port will be the one that the Uno is connected to.
  2. Compile and then upload the ATTiny sketch. You should see the LED blinking.


Posted in Uncategorized | Leave a comment

Digital battery tester for 9 V battery

This weekend’s programme consisted of several new projects (battery tester, switching mains lights using a microcontroller, an ATTiny programmer and a touch-based instrument), but this post is just about the battery tester. Having worked with schools over the summer using the littleBits modules, it became clear that we needed a simple device to check the state of the 9V batteries used to power the littleBits, as it was difficult to determine which ones were still useful and which should be binned. The problem is that batteries which would still illuminate the LED on the power module were not necessarily usable, as they might not have enough energy left in them to drive a motor or servo. Hence, we need a device to check the state of the charge, with a simple indicator that would show whether the battery was new, usable or dead.


The device constructed over the weekend is based upon an ATTiny85, and uses a simple (minded, as I’m not an engineer) circuit that puts the battery under load and checks the voltage across the load – the ‘load’ being a 100Ω resistor. A voltage divider is used to bring the voltage down from 9V to below 5V which the ADC on the ATTiny can read without killing it, and a diode is placed inline with the positive terminal so that accidental reverse polarity won’t wreck the microcontroller. Output is via three LEDs to show the battery state. Obviously, as battery is not required to power it!


Here’s the schematic for the circuit. I drew it up in about 5 minutes, which is why it is not the most optimal (some components are upside down) … but I can understand it, and it works. I’m sure some of you clever engineers out there can make this a lot neater, but hey ho.


Here’s the component list:

R1 : 100Ω
R2, R3: 10kΩ
R4, R5, R6: 220Ω
R7: 10k trimmer (a 1k will work also)
D1: 1N4001
C1, C2: 10μF, 16V
U1: L7805CV
LEDs: 5mm, red, green, amber
IC1: Atmel ATTiny85
25 x 9 stripboard or equivalent

Notes: All resistors are 1//4W. The 7805 is overkill, but all I had.


Construction is fairly easy … unless you are prone to cockups like me. I had spent most of the day soldering, and was tired. So accidentally soldered the Voltage reg into the wrong place and had to cut it free and resolder.

Here’s the breadboard and a picture of the completed stripboard. Note that I had to change the location of the load resistor on the stripboard as I didn’t leave enough space on the board beneath the IC when I soldered the other components into place. Did I say that I was prone to cockups?


Photos of the completed board (LED on wires, out of shot):



The code for the tester is equally as simple minded as the circuit, and uses clunky Arduino-esque C. Here it is. Use it at your peril.

// Kingarthursdog 06-12-2015

// Simple battery tester based upon an Atmel ATTiny85. Circuit is a simple voltage divider and load for the
// battery (100 ohm). When the battery measures more than a threshold value it is considered good, inbetween an
// upper and lower limit it is considered usable but nearing the end of its life, and below the threshold, it needs
// replacing. Uses red, amber and green LEDs for output. A trimmer is added to slide the scale to adjust the lower
// and middle limits.

#define UPPERLIMIT 78
#define LOWERLIMIT 68

#define VINPUT A2
#define TINPUT A3
#define ROUT 0
#define YOUT 1
#define GOUT 2

void setup() {
// Set up inputs for battery input, and for the trimmer

// LED outputs
pinMode(ROUT, OUTPUT);
pinMode(YOUT, OUTPUT);
pinMode(GOUT, OUTPUT);

// Set the LEDs off to begin with
digitalWrite(ROUT, LOW);
digitalWrite(YOUT, LOW);
digitalWrite(GOUT, LOW);

// Serial port for test output

void loop() {
// Scale the input from the battery pin to a range between 0 and 99 (just for simplicity)
double val = map(analogRead(VINPUT), 0, 1023, 0, 99);
int trimmer = map(analogRead(TINPUT), 0, 1023, -50, 50);
int lower = LOWERLIMIT + trimmer;

if (val > 0) {
if (val >= UPPERLIMIT) {
// Display green
digitalWrite(GOUT, HIGH);
digitalWrite(ROUT, LOW);
digitalWrite(YOUT, LOW);
} else if (val < UPPERLIMIT && val >= lower) {
// Display amber
digitalWrite(YOUT, HIGH);
digitalWrite(ROUT, LOW);
digitalWrite(GOUT, LOW);
} else {
// Display red
digitalWrite(ROUT, HIGH);
digitalWrite(YOUT, LOW);
digitalWrite(GOUT, LOW);
} else {
digitalWrite(ROUT, LOW);
digitalWrite(YOUT, LOW);
digitalWrite(GOUT, LOW);

Serial.print(", ");

The Box

The tester works as it is, but needs a container. I’ll post that when I have (laser) cut it out and assembled it.

Posted in Uncategorized | Leave a comment

Driving a stepper motor with an ATTiny85

Tim Sunerton is currently a student in the Art Dept at The University of Reading and wanted to power a number of roller blinds with motors so that they would move up and down. He had already produced one which moved the blind down into a trough of paint and then lifted this back up again and smeared the paint onto a canvas (see Tim’s Blind). The blind was powered by a NEMA17 type stepper motor, a motor driver and an Arduino Uno. To attach the motor to the blind, a coupling was fabricated using the 3D printer.

For the current project (four blinds) and as an exercise in making things smaller I suggested that the blinds could be powered by ATTiny85 microcontrollers, as we don’t need all of the ports that the Uno offers. I built a test rig using some stripboard, a voltage regulator (plus a few capacitors) and an ATTiny85. The first image shows the ATTiny85 on the stripboard:

ATTiny85 with voltage regulator

ATTiny85 with voltage regulator

The two wires coming out of the left side of the board connect it to the power supply (in this case a bench power supply @ 12V); the wires at the right power the stepper driver and provide the pulses to drive the motor:

Stepper motor driven by an ATTiny85

Stepper motor driven by an ATTiny85

The ATTiny85 was programmed by piggy-backing on an Uno, which I have to say is very easy, although I eventually decided to make a programmer shield for the Uno so that you can just plug in the ATTiny85 directly into the shield and program it without needing to connect any wires. (Note: the stepper motor above was not used for Tim’s blind project – just for testing. He used much larger motors for his project).

I made three of these boards and Tim used them in his project. We also had to fabricate 4 new adapters for the blinds. One of the blinds was quite big, and even though Tim used a higher torque motor, the weight of the canvas on the blind pulled the blind down against the force of the motor. This was a bit of a problem, and the solution seemed to be in gearing the motor in some way to increase the torque. After a little thought, I came up with this:

Worm gear

Worm gear

A worm gear that would increase the torque by an order of magnitude, and stop the blind from pulling down. Here’s the work in progress as we tested out the motor driver (and killed it, though fortunately had a spare) and programmed the microcontroller for speed and the correct number of rotations:

Worm gear and Uno

Worm gear and Uno

We used the Uno for this particular arrangement after having blown the original driver. The motor was later attached to the frame using the bracket that we fabricated with the Cube:

Stepper motor bracket printed using the Cube

Stepper motor bracket printed using the Cube

Note the lack of hole in the centre of the front mount. Whoops. We later drilled a hole using a pillar drill.

Posted in Uncategorized | Leave a comment

Visual Programming for Arduino

ModKit have produced a visual programming environment for Arduino devices, based heavily upon the Scratch project at MIT. The ModKit Micro IDE uses the Scratch drag and drop interface for assembling simple programs which can be directly uploaded to the Arduino device, simplifying the process of writing Arduino sketches. I tried creating the basic ‘blink’ sketch using ModKit and it took less than a minute (about 30 seconds) to figure out. It uploaded without problem and worked just fine. Here is the blink sketch in ModKit:

ModKit interface showing the basic 'blink' sketch

ModKit interface showing the basic ‘blink’ sketch

Unlike the standard Arduino IDE, the program is not logically separated into setup and loop, but is all in one location. This was a bit puzzling at first, but doesn’t make a difference to the functioning of the code. The first block in the window shown above is the set up for the pinMode, that instructs the Arduino device to make pin 13 an output (rather than an input). The larger block underneath the pinMode is the loop structure, called ‘forever’, and takes the place of the loop function in Arduino. Inside the forever block are the two instructions that switch the LED on and off, and two delays. At the top of the window there is a ‘play’ button which compiles and uploads the program to the Arduino. It’s that easy.

There is a facility to observe the generated code, although this (at present) does not translate into C, but something in between. For instance, the forever block represents while(true) {}, so (like the rest of the Scratch/ModKit language) is basically a syntactic sugaring to remove the complexities of C programming.

I am looking forward to trying this out with some groups of students and some of my colleagues (Kate!) to see how well it works in the wild. For simple programs it seems to be a great way to get to grips with writing sketches for the Arduino, bringing programming to a wider audience.

Posted in Uncategorized | Leave a comment

Sensory Labels

We had our showcase events last week at the British Museum in London, where our group of co-researchers from the Tower Project demonstrated their multisensory ‘labels’ to the public. The response from the public was excellent, and the group did a fine job of explaining what they had created and why.

Below are the multisensory labels (twelve small sensory labels, plus the larger ‘chocolate box’) and some images taken at the event. You can see more of the event photos at the sister site SensoryObjects.

The twelve sensory labels created by the Tower Group

The twelve sensory labels created by the Tower Group

Designed by Adelana, and based upon a diamond ring she saw in the Enlightenment Gallery

Designed by Adelana, and based upon a diamond ring she saw in the Enlightenment Gallery

Sensory Label designed by Judith

Sensory Label designed by Judith. She wanted the sound to be triggered by bending the leather sandal that she made. The sound also triggers using a touch sensor on top of the box.

Sensory label designed by Tim

This sensory label is based upon objects from Egypt that are in the Enlightenment Gallery. The engraved design resembles Hieroglyphics, and the soundtrack tells a story about a trip to Egypt, from the designer’s perspective.

Sensory label designed by Michael

This sensory label is based upon a plate in the Enlightenment Gallery which originated in China. The soundtrack plays a collection of sounds relating to food (that could be placed onto the plate, and music related to China.


Julie's Heron

This sensory label has an engraving which was designed to resemble a heron that is in the Enlightenment Gallery.


Sensory label designed by Justin

This sensory label was inspired by the Warwick Vase. It reminded him of a football cup …

Sensory label design by Kelly

This sensory label was inspired by the statue of Paris in the Enlightenment Gallery.

Sensory label designed by Ryan

Sensory label designed by Ryan


Posted in Uncategorized | 2 Comments