Category Archives: Stage 3

DAT301 – Fickleduino Technical

For Fickleduino we had to stretch our technical ability with the arduino. It was the first time any of us had used a LED display or ultrasonic rangefinder with one. I bought the display as part of a kit along with a number of sensors including the rangefinder, light dependent resistors(LDRs) and various other parts.

We found a simple wiring diagram for wiring the LCD in 4bit mode, in this mode it can only display ASCII characters but this was fine for our purposes. Wiring in 8bit mode would involve additional wires.

The diagram doesn’t show it but you also have to provide power to A – pin15 (positive) and K – pin16 (negative) on the display for the back light.

The Arduino website has these resources:
http://www.arduino.cc/en/Tutorial/LCDLibrary
http://arduino.cc/en/Reference/LiquidCrystal

In a simple Arduino program you may want something to happen at a regular interval like toggling a LED:

void loop() {
  digitalWrite(13, HIGH);
  delay(1000); // wait for a second
  digitalWrite(13, LOW);
  delay(1000); // wait for a second
}

As a single threaded device the Arduino completely freezes during these delays so if you wanted to have multiple things run at different intervals for example every 300ms and every 500ms, using delay is not practical.

unsigned long updateLastMillis = 0;
unsigned long scrollLastMillis = 0;

boolean cycleCheck(unsigned long *lastMillis, unsigned int cycle)
{
  unsigned long currentMillis = millis();
  if(currentMillis - *lastMillis >= cycle){
    *lastMillis = currentMillis;
    return true;
  }else{
    return false;
  }
}
void loop(){
  if(cycleCheck(&scrollLastMillis, 300)){
    // Do stuff
  }
  if(cycleCheck(&updateLastMillis, 500)){
    // Do stuff
  }
}

The cycleCheck function was written by dmesser and posted on the Arduino forum. This useful function allows you to create multiple timers and avoid using delay.

Combining the two of these together allowed us to marquee the text on the 16×2 LCD display with independent timings from the sensors collecting information.

Every 300ms the Arduino incremented a counter which served as the offset for a 16 character long substring of the output message.  The output message contained three dash separated copies of the actual message to be displayed so that when it reached the end of the message it would loop back around continuously.

Each sensor has it’s own class that encapsulated code specific to it and made it modular; each have a getValue() and complain() method which sets the currently displayed message to one of it’s pre-written complains based on whether it’s higher or lower than the middle value. The Light class made use of an adaptive middle value as different lighting environments give very different values despite appearing to be the same with human eyes.

DAT301 – Fickleduino

We were given a broad brief to play around with some Arduino boards and come up with an idea that made use of them to be presented 2 weeks later. Our group comprised of Simon Batty, Rachael Dalton and myself.

We took the first week coming up with various ideas for the project and ordered several components we could use with the Arduino Mega 2560 I had used for Weather Transplant. Playing with the components allowed us to think about how a user could interact with them and how they could be applied to demonstrate an interesting and fun concept.

We went through a number of different ideas including a runaway computer mouse, a camera trapped fridge and a censoring twitter viewer before settling on our final idea.

The final concept we arrived at was to create a machine that observed its surroundings and complained about them on a LCD display. The device would complain on both sides of a threshold value with no possible state of contentment.

Our demonstration featured two sensors, a Light Dependent Resistor (LDR) and an ultrasonic range finder. If a person or object was to get too close it would complain about its personal space being violated but if nothing was detected in its range it would complain of loneliness. Based on readings from the LDR the machine would complain about the light being too bright or too dim.

The code is designed in such a way that each sensor and its associated complaints are modular so that different sensors can be easily added.

DAT302 – Everyware

The ‘Everyware’ module looks at the trend towards creating an internet of things, how through the embedding of computers, sensors and electronics in materials and objects systems can be created between them. The name Everyware combines ‘ware’ as in hardware or software and the word everywhere.

The term ‘Internet of Things’ was coined by Kevin Ashton who co-founded the Auto-ID Center at MIT which created a global standard RFID system.