More Helpers

Posted by admin on April 18th, 2008 filed in I and I, art, openness

There are now five Little Helpers. Two are a bit buggy but I’m getting there. In the next few weeks I’ll have 10-15.
Here’s a few images and a video clip from some tests that I’ve been doing:

LittleHelperCupboard

LittleHelperFence


1.9MBReset buttons need adding to the circuit boards as occasionally there are issues starting them up, and the power cables keep getting ripped out so I need to find a way to stop that happening without having to resort to some awful maplins housing. The code also needs changing a little so the motors, when triggered, start slowly and then pick up speed reaching a maximum level and then slow down to a stopping point again, a kind of mechanical fade in and fade out rather than just turning on or off.

int incomingByte = 0; // for incoming serial data
int transistorPin = 2;
int ultraSoundSignal = 7; // Ultrasound signal pin
int val = 0;
int ultrasoundValue = 0;
int timecount = 0; // Echo counter
int ledPin = 13; // LED connected to digital pin 13
int waitTime;
void setup() {
//Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
pinMode(transistorPin, OUTPUT);
pinMode(ledPin, OUTPUT);
}

void loop() {
timecount = 0;
val = 0;
waitTime = 0;
pinMode(ultraSoundSignal, OUTPUT); // Switch signalpin to output

// Send low-high-low pulse to activate the trigger pulse of the sensor

digitalWrite(ultraSoundSignal, LOW); // Send low pulse
delayMicroseconds(2); // Wait for 2 microseconds
digitalWrite(ultraSoundSignal, HIGH); // Send high pulse
delayMicroseconds(5); // Wait for 5 microseconds
digitalWrite(ultraSoundSignal, LOW); // Holdoff

// Listening for echo pulse

pinMode(ultraSoundSignal, INPUT); // Switch signalpin to input
val = digitalRead(ultraSoundSignal); // Append signal value to val
while(val == LOW) { // Loop until pin reads a high value
val = digitalRead(ultraSoundSignal);
}

while(val == HIGH) { // Loop until pin reads a high value
val = digitalRead(ultraSoundSignal);
timecount = timecount +1; // Count echo pulse time
}

//Writing out values to the serial port:

ultrasoundValue = timecount; // Append echo pulse time to ultrasoundValue
/*
serialWrite(’A'); // Example identifier for the sensor
printInteger(ultrasoundValue);
serialWrite(10);
serialWrite(13);
*/

// ***** Motor Stuff *****

//digitalWrite(transistorPin, LOW); // turn motor off.
//digitalWrite(ledPin, LOW);

if (ultrasoundValue < 2600) { // Set activation threshold

/* for loop adds a “tail” to the motors activation, so that movement continues
for a short time after it has been activated.
remove for loop to have direct maping of ultrasoundValue onto motor speed. */

for (int i=0; i < random(60, 140); i++) {
digitalWrite(transistorPin, LOW); // turn motor off.
digitalWrite(ledPin, LOW);
delay(random(5, 25));
digitalWrite(transistorPin, HIGH); // turn motor on;
digitalWrite(ledPin, HIGH);
delay(10);
}
}

else {
digitalWrite(transistorPin, LOW); // turn motor off.
digitalWrite(ledPin, LOW);
delay(100);
}
}

As soon as the weather picks up I intend to try them out on a hedge in Fenham and on a few lamp posts, bus stops and railings around Newcastle. Documentation of the project will be periodically updated and made available here.

Leave a Comment