Difference between revisions of "Cheesoid"

From Nottinghack Wiki
Jump to navigation Jump to search
m
 
(18 intermediate revisions by 5 users not shown)
Line 1: Line 1:
A comedy robot with sensory and existential issues.
+
{{Project|image=File:Cheesoid_Project.jpg|created=2/5/2011|status=Complete|type=member|primary=[[User:Msemtd|Michael Erskine]]}}
 +
 
 +
A comedy robot with sensory and existential issues.  
  
 
''"Why Cheesoid exist?"''
 
''"Why Cheesoid exist?"''
Line 199: Line 201:
 
--[[User:Msemtd|Michael Erskine]] 15:26, 6 September 2011 (EST)
 
--[[User:Msemtd|Michael Erskine]] 15:26, 6 September 2011 (EST)
  
I've established that I want 160RPM 12V motors
+
I ordered a pair of 37mm 150RPM gearmotors from China and they're great little units.
 
 
The 25mm body motors like these ones...
 
* http://www.ebay.co.uk/itm/12V-DC-120RPM-Powerful-High-Torque-Gear-Box-Motor-New-/350451477979?pt=UK_BOI_Industrial_Automation_Control_ET&hash=item5198892ddb
 
* http://www.ebay.co.uk/itm/12V-DC-120RPM-Powerful-High-Torque-Gear-Box-Motor-/220848270436?pt=UK_BOI_Industrial_Automation_Control_ET&hash=item336b952c64
 
 
 
    Torque: 60 N*cm
 
    12V DC
 
    120RPM
 
    Diameter: 25mm
 
    Length (excluding shaft): 59mm
 
    Shaft length: 11mm
 
    Total length: 70mm
 
    Shaft diameter: 4mm
 
    Weight: 92g
 
  
OK, so 4mm shaft and a bit small perhaps. The 60Ncm is the decider I guess
+
For motor control I ordered some SN745110 H-Bridge ICs from Proto-Pic
 +
* http://www.sparkfun.com/datasheets/IC/SN754410.pdf
 +
* http://proto-pic.co.uk/products/H%252dBridge-Motor-Driver-1A.html
  
Ooh, this 25mm dia one is 90Ncm...
+
The first set of undercarriage I developed was with wheels made from CDs on M8 threaded rod axles and 608z skate bearings in oak blocks. The axles were driven from the D-shape shafts using connectors made from thermoplastic and PVC tubing but the motors just could not deal with the axle misalignment and the weight of the wheel/axle assembly (in conjunction with weak batteries!).
* http://www.ebay.co.uk/itm/12V-DC-100-RPM-High-Torque-Electric-Gear-Box-Motor-/150558661271?pt=UK_BOI_Industrial_Automation_Control_ET&hash=item230dfeda97
 
  
...but only 100RPM
+
Plan B: wheels directly connected to the motors using Pololu 6mm Universal Mounting Hubs (£5.50 + VAT + postage = £10.16). A smaller 80mm diameter laser-cut wheel is also planned.
 
 
This one is 37mm body 6mm shaft 120RPM 0.5A...
 
* http://www.ebay.co.uk/itm/120RPM-Output-Speed-12V-Rated-Voltage-DC-Geared-Motor-/160646764761?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item25674b18d9
 
 
 
Here's a $9 160RPM beast!
 
 
 
* http://www.ebay.co.uk/itm/New-160RPM-Gear-Torque-DC-12V-Motor-Driver-Control-/320749819445?pt=LH_DefaultDomain_0&hash=item4aae2dd635
 
* Voltage: DC 12V 900mA
 
* Torque Gear: 160RPM
 
* Size: 75mm x 32mm x 32mmL
 
 
 
Same one from another seller (maybe same seller!)...
 
* http://www.ebay.co.uk/itm/New-160RPM-Gear-Torque-DC-12V-Motor-Driver-Control-/250887708255?pt=LH_DefaultDomain_0&hash=item3a6a129e5f
 
 
 
Hmm, 150RPM 37mm Diameter...
 
* http://www.ebay.co.uk/itm/12V-DC-150RPM-High-Torque-Gear-Box-Electric-Motor-/220767701498?pt=UK_BOI_Industrial_Automation_Control_ET&hash=item3366c7c9fa#shId
 
Looks the same as...
 
* http://www.pololu.com/catalog/product/1105
 
 
 
OK, I've ordered a pair of 37mm 150RPM gearmotors from China - fingers crossed they're going to be suitable!
 
 
 
--[[User:Msemtd|Michael Erskine]] 9 September 2011 (EST)
 
  
 
== A new development: Aug 2011 - give Cheesoid a proper brain with an old eeePC ==
 
== A new development: Aug 2011 - give Cheesoid a proper brain with an old eeePC ==
Line 276: Line 243:
  
 
Using a simple counter for scheduling tasks that repeat at different rates. Serial input just echoes right now.  
 
Using a simple counter for scheduling tasks that repeat at different rates. Serial input just echoes right now.  
 
+
<div style ="height:200px;overflow-x:hidden;overflow-y:auto;border: 4px solid green;">
 
<syntaxhighlight lang="cpp" line="GESHI_FANCY_LINE_NUMBERS">
 
<syntaxhighlight lang="cpp" line="GESHI_FANCY_LINE_NUMBERS">
 
// Two LEDs are used for eyes on two digital pins...
 
// Two LEDs are used for eyes on two digital pins...
Line 283: Line 250:
 
// The mode switch is on a digital input...
 
// The mode switch is on a digital input...
 
const int switchpin = 7;
 
const int switchpin = 7;
 
+
// Built-in LED on pin 13 used for watchdog status...
 +
const int wdogled = 13;
 +
 
// main loop has 10ms sleeps...
 
// main loop has 10ms sleeps...
 
const int naptime = 10;
 
const int naptime = 10;
 
// the eyes flash every 60 loops = 600ms...
 
// the eyes flash every 60 loops = 600ms...
 
int eyefreq = 60;
 
int eyefreq = 60;
// info is sent out on the serial port every 100 loops = 1s...
+
// info is sent out on the serial port every 90 loops = 900ms...
int reportfreq = 100;
+
int reportfreq = 90;
// the mode switch is read every 10 loops = 100ms...
 
// TODO - using an experimental debounce instead
 
//int switchreadfreq = 10;
 
 
// a simple loop counter is used to decide what to do...
 
// a simple loop counter is used to decide what to do...
 
unsigned int loopcounter = 0;
 
unsigned int loopcounter = 0;
 
+
 
int mode = 0;
 
int mode = 0;
 
+
 
void setup() {
 
void setup() {
 
     Serial.begin(9600);
 
     Serial.begin(9600);
 
     pinMode(greeneye, OUTPUT);
 
     pinMode(greeneye, OUTPUT);
 
     pinMode(redeye, OUTPUT);
 
     pinMode(redeye, OUTPUT);
 +
    pinMode(wdogled, OUTPUT);
 
     pinMode(switchpin, INPUT);
 
     pinMode(switchpin, INPUT);
 +
   
 
     // announce startup...
 
     // announce startup...
     flasheyes();
+
     flasheyes(200);
 
     Serial.println("\n=== CHEESOID ===");
 
     Serial.println("\n=== CHEESOID ===");
 
     // TODO: piezo buzzer to play a tune
 
     // TODO: piezo buzzer to play a tune
 
     mode = digitalRead(switchpin);
 
     mode = digitalRead(switchpin);
 
}
 
}
 
+
void flasheyes() {
+
void flasheyes(int zeds) {
 
     for(int i=0;i<6;i++){
 
     for(int i=0;i<6;i++){
 
         int onoff = i % 2;
 
         int onoff = i % 2;
 
         digitalWrite(greeneye, onoff);
 
         digitalWrite(greeneye, onoff);
 
         digitalWrite(redeye, onoff);
 
         digitalWrite(redeye, onoff);
         delay(200);
+
         delay(zeds);
 
     }
 
     }
 
}
 
}
 
+
 
void loop() {
 
void loop() {
 
     do_switch();
 
     do_switch();
Line 327: Line 295:
 
     loopcounter++;
 
     loopcounter++;
 
}
 
}
 
+
 
void do_switch() {
 
void do_switch() {
 
     // button debounce: state must remain stable for N samples.
 
     // button debounce: state must remain stable for N samples.
Line 333: Line 301:
 
     // used if we want to avoid the more general purpose  
 
     // used if we want to avoid the more general purpose  
 
     // but heavyweight Bounce library.
 
     // but heavyweight Bounce library.
   
+
 
     const int debouncesamples = 5;
 
     const int debouncesamples = 5;
 
     static int lastsample = 0;
 
     static int lastsample = 0;
Line 354: Line 322:
 
     mode = debounced;
 
     mode = debounced;
 
}
 
}
 
+
 
void do_eyes() {
 
void do_eyes() {
 
     static int eyestate = 0;
 
     static int eyestate = 0;
Line 363: Line 331:
 
     digitalWrite(redeye, !eyestate);
 
     digitalWrite(redeye, !eyestate);
 
}
 
}
 
+
 
void do_report() {
 
void do_report() {
 
     if(loopcounter % reportfreq != 0)
 
     if(loopcounter % reportfreq != 0)
 
         return;
 
         return;
 
+
 
     Serial.print("CHEESOID: mode = ");
 
     Serial.print("CHEESOID: mode = ");
 
     Serial.print(mode);
 
     Serial.print(mode);
Line 380: Line 348:
 
     // Well, 9600 8-n-1 is 960 bytes per sec or 9.6 per 10ms
 
     // Well, 9600 8-n-1 is 960 bytes per sec or 9.6 per 10ms
 
     // The standard serial receive buffer holds 128 bytes so we're fine
 
     // The standard serial receive buffer holds 128 bytes so we're fine
 
+
 
     static int maxread = 0;
 
     static int maxread = 0;
 
     // any data waiting?
 
     // any data waiting?
Line 391: Line 359:
 
         int c = Serial.read();
 
         int c = Serial.read();
 
         Serial.println(c); // just echo for testing
 
         Serial.println(c); // just echo for testing
 +
        if(c == 'E'){
 +
          flasheyes(50);
 +
          Serial.println("I OBEY: FLASH EYES!");
 +
        }
 +
        // watchdog kick - proof that PC is alive
 +
        if(c == 'W'){
 +
          // LED on for a while (needs timeout)
 +
          // lastkick var
 +
        }
 
     }
 
     }
 
}
 
}
  
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
</div>
  
 
=== eeePC spares: keyboard and original PSU ===
 
=== eeePC spares: keyboard and original PSU ===
Line 424: Line 402:
 
15th Sept 2011 - pizzabox built - snug fit for eeePC (thanks to David Hayward for taking the picture).
 
15th Sept 2011 - pizzabox built - snug fit for eeePC (thanks to David Hayward for taking the picture).
 
[[File:cheesoid-eeepc-pizzabox.png|300px|thumb|left|Why Cheesoid Exist?]]
 
[[File:cheesoid-eeepc-pizzabox.png|300px|thumb|left|Why Cheesoid Exist?]]
 +
 +
I want to go for final boxing where we never need direct access the eeePC: -
 +
* power port extender for charging
 +
* speakers - borrow for now - need to be powered and amplified
 +
* vga output
 +
* usb kb and mouse
 +
* power switch
 +
* USB hub
 +
* mounting for UNO - outside the body cylinder?
 +
* lugs for mounting the cylinder
  
 
=== eeePC software ===
 
=== eeePC software ===
Line 433: Line 421:
 
* just a console app - no GUI - runs under screen
 
* just a console app - no GUI - runs under screen
 
** can SSH into the box over the wireless
 
** can SSH into the box over the wireless
*** I installed ssh-server  
+
*** I installed ssh-server
 
*** need a passworded account ("user" on eeePC has no password and I don't want to open it to the world!)
 
*** need a passworded account ("user" on eeePC has no password and I don't want to open it to the world!)
 +
*** OK, done but ssh then su gives us grief [http://www.noah.org/wiki/Screen_notes#ERROR:_Cannot_open_your_terminal_.27.2Fdev.2Fpts.2F1.27_-_please_check. solution here]
 +
*** use hack: script /dev/null
 
*** will no longer need to open the case to configure and test
 
*** will no longer need to open the case to configure and test
 
* main loop reads from standard input for direct commands
 
* main loop reads from standard input for direct commands
 
 
  
  
 
[[Category:Projects]]
 
[[Category:Projects]]
[[Category:Current Projects]]
+
[[Category:Featured]]

Latest revision as of 18:46, 24 April 2019

Cheesoid
Cheesoid Project.jpg
Primary Contact Michael Erskine
Created 2/5/2011
Completed {{{completeddate}}}
Dormant {{{dormantdate}}}
Version {{{version}}}
Members {{{members}}}
Manufacturer {{{manufacturer}}}
Model {{{model}}}
Location [[{{{location}}}]]
GitHub / Repo {{{repo}}}
Status Complete
Type Members Project
Live Status {{{livestatus}}}
QR code

A comedy robot with sensory and existential issues.

"Why Cheesoid exist?"

Mitchell & Webb: Cheesoid

An unhappy robot designed to have a sense of smell but can only distinguish between its two operating modes: "CHEESE" and "PETROL".

Thoughts

Everybody loves robots: It's your plastic pal who's fun to have around! I'd like a robot too, and I'm going to build one goddamnit!!!

As with everything I want to build, it must be funny, and so Cheesoid is the ideal blueprint to follow.

It has (should have) speech limited to a number of pre-recorded phrases: -

  • "Cheese"
  • "Petril"
  • "Help! Cannot see! Can only smell!"
  • "Why Cheesoid exist?"
  • etc.

Basic Construction

I have a cardboard cylinder (slightly smaller than the original) and a silver "nose hose". The nose hose will contain a bent rod that will be rotated by a servo or stepper motor. The robot can run on top of a R/C car to begin with. The donated R/C car at the space has no battery and I couldn't get the motor to run!

I plan to cover Cheesoid in silver-grey paper.

The nose hose needs to be mounted in a shallow box which in turn is fixed to the body.

The "CHEESE" or "PETROL" mode switch must be authentic!

Voice capability will just be some sort of recordable button box.

Object detector (that initiates the smelling process) would be awesome.

The ability to actually distinguish between the smell of cheese and petrol would be crazy-awesome!

Need: -

  • R/C vehicle
  • silver-grey paper or card - using some silvery-blue slightly metallic wallpaper (recovered from skip) that reminds me of galvanised steel
  • nose rod and motor - have the stepper
  • voice
  • lamp eyes - one red, one green - Using LEDs and industrial lamp sockets (saved from skip)
  • flashing LEDS
  • automation!!!

Nose Stepper

A stepper motor will be used to drive the "nose". The curved nose hose is fixed to the body and doesn't rotate. Inside a rigid but bent rod will rotate, driven by the stepper. The stepper needs enough grunt! I have no idea how "grunt" is measured in ISO units - torque I guess. Speed and accuracy is not so important for this task but it is a learning experience.

So I chose a random biggish stepper motor (from the members' motor box)...

Cheesoid-nose-motor-1.jpg

It has 6 wires that go to a 2x4 0.1" pitch connector. It says "MINEBEA" "TYPE 17PS-C035-03" -- hmmm...

1.7 inch, P = Precision, Hybrid, S = 3.6 Deg, C =2 & 4 Phase Hybrid, Motor Lengths = 0(?), Different Windings = 35, Version = 03.

OK, so the information on the side isn't much help in finding the voltage and current so using the magic knowledge on the pages listed above I gleaned some info using SCIENCE!!!!

The stepper turns out to be a Unipolar. It has 6 wires, 2 for the centre taps which should go to V+ and two each for the grounds of the half coils.

I identified the usage of the wires using my cheap multimeter and measured the half coil resistances: 36.9 ohms, 36.6 ohms, 36.7 ohms, 36.7 ohms.

Six wires
Brown Black Red
Green Orange White
Wire purpose
Coil B 1 Coil A Centre Coil B 2
Coil A 1 Coil B Centre Coil A 2

Driving it!


To be continued!!!

Display and Indicators

The eyes on the "real" Cheesoid just flash left-right, left-right with one eye being red and the other green. I'll stick with this for now as it's simple but I'm not sure I want to use two pins on my Xino. I'll look into that when I have the basics in place.

I have added an LCD display...

Why Cheesoid Exist?

This is a Seiko L2012 LCD module (File:Seiko L2012 LCD Module - datasheet-3.pdf) which can be driven straight from the Arduino example library. I modified a Xino to directly drive one with a 14-pin header soldered to the prototype area of the board. This module I rescued from the skip at work and it has some damage to the LCD but it is entirely usable.

Voice

I need a device that can play back my recordings on demand. Some sort of controllable MP3 player would be ideal. How do I make an MP3 player controllable? Wire into the buttons? Possible. I'd need some feedback on what's playing or whatever is useful or available. I could try to read the LCD screen! I could try to "listen" to the audio output!

I need speakers!

An MP3 shield is a fine solution but it's not my cup of tea: too easy and no pain! I could make my own MP3 shield: -

Other devices can play audio and MP3s: PDAs, phones, etc. Can they be driven?

Voice Update - espeak

Advantages: -

  • the original comedy sketch has limited phrases that can be tough to extract cleanly. With text-to-speech, cheesoid can now say virtually anything
  • I can develop the voice using the espeak config
 1 name english_cheesoid
 2 language en-uk-chs
 3 language en-uk  4
 4 language en 5
 5 gender male
 6 
 7 pitch 125 135
 8 
 9 flutter 8
10 echo 100 30
11 roughness 4
12 voicing 150
13 
14 
15 ;phonemes en-wm
16 
17 ;replace 00 h NULL
18 ;replace 00 o@ O@
19 ;replace 00 i@3 i@
20 ;dictrules 6
21 
22 intonation 3
23 ;stressAdd 0 0 0 0 0 0 0 20
24 
25 
26 ;comment?

--Michael Erskine 09:44, 14 September 2011 (EST)

Sense of Smell

Wow! I've located a sensor that might actually be able to detect cheese and petrol!

http://www.figarosensor.com/products/2602pdf.pdf

A small case fan at the body end of the nose hose should be fine to draw air over the sensor. This would have to sit nicely with the nose movement stepper motor.

Movement and Power

Although I eventually want the robot to be pretty autonomous, initially I guess any kind of movement will be good. I imagine simply mounting the body on a reasonably powerful R/C car or tank. I'm going to have to get to grips with servos and R/C in general. I'll be looking out for tank track parts (e.g. bike chain tracks) in the meantime for a more serious robot movement base.

For power I want to try out using some of the 12v and 6v lead acid batteries from the Emergency Roadside Telephone. I have recharged a 12v one and it seems quite happy after being sat on a shelf for many years! I also have my solar panel and I'd like to make use of it for recharging.

--Michael Erskine 16:38, 3 May 2011 (BST)

More thoughts on movement: there are quite a few parameters when getting hold of motors but where to start? I have 12v batteries so want 12V motors and they need a certain amount of "oomph". My simple cyclist's brain understands that gearing is key to getting what I want and that also some function of wheel size. Whilst I'd love to have tank tracks I'm thinking of starting out with an "arse-dragging" robot: two wheels at chassis centre left and right and a lightly sprung castor each at the front and back for stability. The robot is going to be able to trundle around a nice flat space (the HackSpace or my home) and get over some small bumps.

I've already decided that I want to make the wheels from a stack of old CDs with Sugru tyres. They will therefore be a little over 120mm in diameter. This directs me to consider that a single rotation of the wheel will cover a distance equal to the circumference, or Pi x D = 3.14 x 120mm = 377mm. Nice! It'll be slightly more than that with tyres. This directs me to consider the RPM parameter I need to attain a certain speed: I can start by visualising some easy parameters, so if the robot wants to cover say a meter in a second then to my mind that's a pretty fast robot - I don't think R2D2 could do 1m/sec! What's this in km/hour? Google says: http://www.google.co.uk/search?q=1m%2Fsec+in+km%2Fhr = 3.6 km/hr = 2.24 mph. I like that! OK, how many revolutions of the wheel are there in a meter? 1000/377 =~ 2.65 revs. That's about 2652 revolutions in a km. To go 3.6kph I need 3.6 x 2652 revs (in an hour) =~ 9549 revs (per hour) or 9549 / 60 revs per minute =~ 159 RPM. Is that right?

--Michael Erskine 15:26, 6 September 2011 (EST)

I ordered a pair of 37mm 150RPM gearmotors from China and they're great little units.

For motor control I ordered some SN745110 H-Bridge ICs from Proto-Pic

The first set of undercarriage I developed was with wheels made from CDs on M8 threaded rod axles and 608z skate bearings in oak blocks. The axles were driven from the D-shape shafts using connectors made from thermoplastic and PVC tubing but the motors just could not deal with the axle misalignment and the weight of the wheel/axle assembly (in conjunction with weak batteries!).

Plan B: wheels directly connected to the motors using Pololu 6mm Universal Mounting Hubs (£5.50 + VAT + postage = £10.16). A smaller 80mm diameter laser-cut wheel is also planned.

A new development: Aug 2011 - give Cheesoid a proper brain with an old eeePC

After some time on the back-burner (Arcade Machine and Barcamp) this project has gained momentum again with the resurrection of my dead Asus eeePC 701. I am now using this little gem as the brains inside Cheesoid which solves a number of issues but perhaps introduces a few too! A quick list: -

  • this is the 701 4g version: http://en.wikipedia.org/wiki/Eeepc
  • I bought this eeePC 701 from Andy Beale some time ago and over time the keyboard broke followed by the power port. I tried previously to fix the power port but failed. A redoubled effort got it going yesterday but I don't know about the battery life!
  • an external USB keyboard is enough to get things going
  • it's a Linux box with bash and a full Java JVM!!!
  • it can play WAV and MP3 files with mplayer - solving my voice issues
  • there is a voice recognition app!
  • it has WiFi!
  • it can power the Arduino and also talk to it over the USB-Serial
  • I think I'll develop on my Arduino Uno - maybe even running the IDE on the eeePC
  • The eeePC just about fits into the cylindrical body of Cheesoid apart from cables plugged into the side ports. I have modified a USB extension cable to have a tight bend after the plug and it seems to work OK
  • The dimensions of the eeePC 701 4G: 225mm wide, 165mm deep, ~25mm hight when closed

PC application and Arduino sketch

Now the eeePC is to be used I want to use one of my genuine Arduino boards for the USB serial. I'd prefer not to use the UNO as it seems to have more issues with the USB/Serial but I need to retain my Duemilanove for most prototyping. Perhaps it's time to start making PaperFTDI cables (http://txapuzas.blogspot.com/2010/07/cable-de-programacion-para-arduino-ftdi.html) so I can use the Xino boards.

OK, so since my eeePC has a full Java VM perhaps I might write the PC end in Java. I wouldn't really host an IDE on the eeePC though so perhaps Perl is better option for quick prototyping. I don't think I need bother too much with Dev::Serial (or whatever it's called nowadays) since under Linux I can use tty to set up the port and just open the device as a plain filehandle. Good in theory! I'll have a go with this later. Update Sept 2011: Dev::Serial won't easily build on the eeePC so I've knocked Perl on the head for the main app and I'm going with Java.

On the Arduino end I'll probably keep the LCD panel running from the modified Xino and maybe talk to it with softserial from the other Arduino or talk to it from the PC app - wow, the possibilities! Either way I'll be wanting to chop the loop functionality into blocks and perhaps implement a cheap scheduler.

  • Switch debounce for all inputs
  • LED eye flash routines - for different modes
  • nose control
  • PIR or sonar detection for proximity of smell sample!
  • mode change detection

test sketch

Using a simple counter for scheduling tasks that repeat at different rates. Serial input just echoes right now.

  1 // Two LEDs are used for eyes on two digital pins...
  2 const int redeye = 5;
  3 const int greeneye = 6;
  4 // The mode switch is on a digital input...
  5 const int switchpin = 7;
  6 // Built-in LED on pin 13 used for watchdog status...
  7 const int wdogled = 13;
  8  
  9 // main loop has 10ms sleeps...
 10 const int naptime = 10;
 11 // the eyes flash every 60 loops = 600ms...
 12 int eyefreq = 60;
 13 // info is sent out on the serial port every 90 loops = 900ms...
 14 int reportfreq = 90;
 15 // a simple loop counter is used to decide what to do...
 16 unsigned int loopcounter = 0;
 17  
 18 int mode = 0;
 19  
 20 void setup() {
 21     Serial.begin(9600);
 22     pinMode(greeneye, OUTPUT);
 23     pinMode(redeye, OUTPUT);
 24     pinMode(wdogled, OUTPUT);
 25     pinMode(switchpin, INPUT);
 26     
 27     // announce startup...
 28     flasheyes(200);
 29     Serial.println("\n=== CHEESOID ===");
 30     // TODO: piezo buzzer to play a tune
 31     mode = digitalRead(switchpin);
 32 }
 33  
 34 void flasheyes(int zeds) {
 35     for(int i=0;i<6;i++){
 36         int onoff = i % 2;
 37         digitalWrite(greeneye, onoff);
 38         digitalWrite(redeye, onoff);
 39         delay(zeds);
 40     }
 41 }
 42  
 43 void loop() {
 44     do_switch();
 45     do_eyes();
 46     do_report();
 47     do_serialinput();
 48     delay(naptime);
 49     loopcounter++;
 50 }
 51  
 52 void do_switch() {
 53     // button debounce: state must remain stable for N samples.
 54     // This is just a lightweight debouncer
 55     // used if we want to avoid the more general purpose 
 56     // but heavyweight Bounce library.
 57  
 58     const int debouncesamples = 5;
 59     static int lastsample = 0;
 60     static int steadycount = 0;
 61     static int debounced = 0;
 62     // if the value is steady for 
 63     int sample = digitalRead(switchpin);
 64     // a change of value - restart the steady count...
 65     if(sample != lastsample){
 66         lastsample = sample;
 67         steadycount = 0;
 68         return;
 69     }
 70     steadycount++;
 71     if(steadycount < debouncesamples)
 72         return;
 73     steadycount = debouncesamples;
 74     debounced = sample;
 75     // set the actual mode switch value
 76     mode = debounced;
 77 }
 78  
 79 void do_eyes() {
 80     static int eyestate = 0;
 81     if(loopcounter % eyefreq != 0)
 82         return;
 83     eyestate = !eyestate;
 84     digitalWrite(greeneye, eyestate);
 85     digitalWrite(redeye, !eyestate);
 86 }
 87  
 88 void do_report() {
 89     if(loopcounter % reportfreq != 0)
 90         return;
 91  
 92     Serial.print("CHEESOID: mode = ");
 93     Serial.print(mode);
 94     //~ Serial.print(" | eye = ");
 95     //~ Serial.print(onoff);
 96     Serial.print(" | loop = ");
 97     Serial.println(loopcounter);
 98 }
 99 void do_serialinput() {
100     // can we avoid buffer overflows when using the 
101     // standard serial library at a 10ms read rate at 9600 baud?
102     // Well, 9600 8-n-1 is 960 bytes per sec or 9.6 per 10ms
103     // The standard serial receive buffer holds 128 bytes so we're fine
104  
105     static int maxread = 0;
106     // any data waiting?
107     int len = Serial.available();
108     if(!len)
109         return;
110     if(len > maxread)
111         maxread = len;
112     for(int i = 0; i < len; i++){
113         int c = Serial.read();
114         Serial.println(c); // just echo for testing
115         if(c == 'E'){
116           flasheyes(50);
117           Serial.println("I OBEY: FLASH EYES!");
118         }
119         // watchdog kick - proof that PC is alive
120         if(c == 'W'){
121           // LED on for a while (needs timeout)
122           // lastkick var
123         }
124     }
125 }

eeePC spares: keyboard and original PSU

Many thanks to Dr Matt Little for donating his broken black eeePC 701 in the HackSpace donation box. (I was unable to get it running as a machine in its own right - something wrong with the onboard flash?)

  • this has made quite a difference!
  • The cheesoid eeePC now has a nice replacement keyboard in contrasting black
  • This means I don't need the external USB keyboard
  • there are other spares available if things get broke (and I'm able to fix them!)
  • I'm now interested in mounting an external webcam!

eeePC mounting and housing

Original plan: have the eeePC fully inside the cylinder

    • poor access to the ports on the side :(
    • awkward for disassembly

New plan: the eeePC will be mounted in a simple "pizza box" shaped housing underneath the cylinder and on top of the chassis.

  • pizzabox is custom fit with port access and hopefully better airflow
  • using 6mm "foam sandwich" display boards for the outer material
  • the cylinder is to sit on top with locating pegs or similar
  • still need the eeePC to be open - how can I get it to stay awake when the lid is closed?
    • eeePC forums
  • ports: -
    • VGA
    • audio (headphone only)
    • USB keyboard & mouse
    • USB for Arduinos
    • other? webcam?
  • now rethinking the steel chassis which is ready formed into a nice shape and decorated but heavy and restrictive to work around

15th Sept 2011 - pizzabox built - snug fit for eeePC (thanks to David Hayward for taking the picture).

Why Cheesoid Exist?

I want to go for final boxing where we never need direct access the eeePC: -

  • power port extender for charging
  • speakers - borrow for now - need to be powered and amplified
  • vga output
  • usb kb and mouse
  • power switch
  • USB hub
  • mounting for UNO - outside the body cylinder?
  • lugs for mounting the cylinder

eeePC software

The eeePC run the main Java application as a Poor Man's Service under screen. This app communicates over serial USB to the Arduino UNO.

  • I already shoehorned a full Sun JRE onto the eeePC (for CAL Cube Timer!)
  • using the RXTX java serial API - I'm very familiar with it
  • main class is com.tecspy.cheesoid.CheesoidControl
  • just a console app - no GUI - runs under screen
    • can SSH into the box over the wireless
      • I installed ssh-server
      • need a passworded account ("user" on eeePC has no password and I don't want to open it to the world!)
      • OK, done but ssh then su gives us grief solution here
      • use hack: script /dev/null
      • will no longer need to open the case to configure and test
  • main loop reads from standard input for direct commands