Relaysquid_breakfast_3_s_small
Reddit Twitter Digg Facebook Delicious Stumbleupon
8 images, 4 parts

RelaySquid and TouchShield make breakfast

I got really lazy, and decided to make a project that would fix breakfast for me. I’m usually running out the door in the morning, and I don’t have time to sit at the stove cooking a real meal and making watching the coffee maker for 15 minutes (that’s about how long it usually takes me). I hooked up a coffee maker, and two electric stove surfaces to the RelaySquid. Then I run the RelaySquid with a slightly modified version of the BitDJ code, which I edited to make it time the signals to the RelaySquid to turn on the bacon hotplate for 7 minutes, followed by coffee for 2 minutes, and then the egg for 7 minutes (the coffee and egg run in parallel to start). The end result is crispy bacon that’s had a chance to dry out a little, coffee that’s not too hot, and a fresh hot egg!

Parts for RelaySquid and TouchShield make breakfast:

To start out, I put together the device. I used a TouchShield on the top, with a small prototyping area so I could place down some LEDs (I’ll talk about those later). Then I put the Arduino on the back, and a Lithium backpack on the back too.

Here’s a picture of the controller, assembled:

The circuit is actually embarassingly basic… the TouchShield controls the Arduino, and tells it to turn on or off pins numbered 4, 5, 6, and 7. These pins are connected with wire to the RelaySquid. Arduino pin 4 is connected to the RelaySquid port 1, which is then connected to the coffee maker. Arduino pin 5 is connected to the RelaySquid’s port 2, which controls the egg hotplate, and pin 6 is connected to RelaySquid port 3, which controls the bacon hot plate. I had a toaster on the system for a while, but then I realized toasters are already easy enough to use!

I bought really low end coffee maker and hot plates from Home Depot:

That’s all… the rest is source code.

Here’s the code that runs on the Arduino. All it does is reads the serial port for commands it receives from the TouchShield, and then translates those into which digital IO pin it will toggle. If the TouchShield sends a P11, it turns the first pin on. P10 turns the pin off.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

#include "SoftwareSerial.h" 

#define rxPin 3
#define txPin 2

SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);

int pins[10];

char thebyte;

void setup()
{
  // define pin modes for tx, rx:

  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  mySerial.begin(9600);
  beginSerial(9600);

  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
}

int i,thepin;
char pin, status;
int printout;

void loop()
{
  printout = 0;

  thebyte = mySerial.read();
  Serial.print(thebyte);

  if (thebyte == 'P') {
    pin = mySerial.read();
    status = mySerial.read();
    thepin = pin - 48;
    if (status == '1') {
      pins[thepin] = 1;
    } else {
      pins[thepin] = 0;
    }
    printout = 1;
  } else if (thebyte == 'X') {
    for (i=0;i<10;i++){
      thebyte = mySerial.read();
      //Serial.print(thebyte);
      if (thebyte == '1') {
        pins[i] = 1;
      } else {
        pins[i] = 0;
      }
    }
    printout = 1;
  }

  if (printout) {
  for (i=0;i<10;i++) {

    Serial.print(pins[i]);
    if (pins[i]) {
      digitalWrite(4+i, HIGH);
    } else {
      digitalWrite(4+i, LOW);
    }
  }

  Serial.println();
  }

}

If you’ve seen the BitDJ code, you’ll recognize how to do the things below. Basically, I tweaked the BitDJ code a little to make a little interface for myself on the TouchShield. To do this, I had to write a new function that made vertical text buttons (which meant changing the data structure around a little bit), and I had to manually generate the BitDJ data structure, so I could just play it back.

I hard coded in the breakfast script in this order (using times I found by timing each one with a stopwatch):

-First start the bacon -Turn off the bacon after 7 minutes -Turn on the coffee and the egg hotplate -Turn off the coffee maker after 2 minutes, 15 seconds -Turn off the egg hot plate after 7 more minutes (egg total cook time, 9 minutes)

I’ve uploaded a file called TouchCode with the source code for the TouchShield.

If you’re familiar with the BitDJ code, you’ll appreciate this section, which initializes the buttons, main screen, and time script manually in the setup code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44


  setupButtons();
  setupPlayback();
  ResetDJ(); //this will likely be replaced with a load function, 
  //to load from the flash memory the playback array
  brightness = 10;
  fader = 0;

 setStop();

  MakeButton( 0, 3, 5, 28, 80, black, gray, orange, gray, white, 
black, "Coffee", 1, &makeCoffee);
  MakeButton( 1, 35, 5, 28, 80, black, gray, orange, gray, white, 
black, "Eggs", 1, &makeEggs);
  MakeButton( 2, 67, 5, 28, 80, black, gray, orange, gray, white, 
black, "Bacon", 1, &makeBacon);
  MakeButton( 3, 99, 5, 28, 80, black, gray, orange, gray, white, 
black, "Toast", 1, &toggle3);
    MakeButton( 4, 3, 90, 123, 28, red, gray, white, gray, white, 
black, "Make Breakfast !", 0, &setPlay);

 setupPlayback();
 allOff();
 flashAllPins();

 //Clear bits
 bitstatus[0]=0;bitstatus[1]=0;bitstatus[2]=0;bitstatus[3]=0;
bitstatus[4]=0;bitstatus[5]=0;bitstatus[6]=0;bitstatus[7]=0;
bitstatus[8]=0;
 SaveTimeState( 0);
 bitstatus[2]=1;
 SaveTimeState( 1000);//bacon on
 bitstatus[2]=0;
 SaveTimeState( 7*60000);//bacon off after 7 minutes
 bitstatus[1]=1; //egg on
 bitstatus[0]=1; //coffee on
 SaveTimeState( 7*60000+10000);// save state, off after 10 sec
 bitstatus[0]=0; //coffee off
 SaveTimeState( 9*60000+15000);// turn off coffee after 2:15 min
 bitstatus[1]=0; //egg off
 SaveTimeState( 16*60000+15000);// turn eff off
 SaveTimeState( 16*60000+15000+10000);

I’ve uploaded the rest of the TouchShield’s built-in commands are over at the function reference wiki.

0 Comments on RelaySquid and TouchShield make breakfast



Add A Comment: