mirror.sketch

The sketch for my mirror with display:

/* mirror
*
* control PWM for fan, read temperatures from DS1820 and interface to PIR
*/
#include
#include
#include // interrupt routine
#define ONE_WIRE_BUS 3 // define port for DS1820 interface
#define TEMP_DEVICE_IN 28E08F3606000003
#define TEMP_DEVICE_EX 289A78370600002C
#define TEMP_DEVICE_BOARD 2873163706000020
#define LED 4
#define PIR_INTERFACE 5 // define port for PIR
#define FANSENSE 8
#define FANPWM 9
#define THRESHOLD_OFF 25
#define THRESHOLD_LOW 30
#define THRESHOLD_HIGH 40
#define THRESHOLD_ON 45
#define TASTER_DOWN 6
#define TASTER_UP 7

DeviceAddress devices[] = {TEMP_DEVICE_IN, TEMP_DEVICE_EX, TEMP_DEVICE_BOARD };
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
int buttonPressed = 0;

void setup() {
Serial.begin(9600);// start serial port
sensors.begin();// Start up the library
for( int i=0; i < 3; i++){ sensors.setResolution(devices[i], 10);// set the resolution to 10 bit } pinMode(PIR_INTERFACE, INPUT);// read PIR status from external Board pinMode(FANSENSE, INPUT); // read RPM data from sense of FAN digitalWrite(FANSENSE, HIGH); // activate internal Pull Up pinMode(LED, OUTPUT); // LED for status info pinMode(TASTER_DOWN, INPUT); // external key for navigation input pinMode(TASTER_DOWN, INPUT); } void setLED(int pulse){ if(pulse > 0){
digitalWrite(LED, HIGH);
delay(10*pulse);
digitalWrite(LED, LOW);
delay(10*pulse);
}
}

void loop() {
/* main loop sends list of values via serial line in format:
* up/down (PIR status flag), TempExternal, TempInternal, TempBoard, RPM from Fan
*/
float Temperature = 0;
double frequency = 0;
unsigned long pulseDuration = 0;
int pirStatus = 0;
pirStatus = digitalRead(PIR_INTERFACE);
if( digitalRead(TASTER_UP) == HIGH ){
buttonPressed = 2; // up taster pressed
} else if ( digitalRead(TASTER_UP) == HIGH ) {
buttonPressed = 1; // down taster pressed
} else {
buttonPressed = 0; // no button pressed
}
if (pirStatus == HIGH) {
Serial.print("up,");
} else {
Serial.print("down,");
}
for(int i = 0; i < 3; i++){ Temperature = Temperature + sensors.getTempC(devices[i]); Serial.print(Temperature); Serial.print(","); } Temperature = Temperature / 3; // Temperature Hytherese pulseDuration = pulseIn(FANSENSE, LOW); frequency = 1000000/pulseDuration; Serial.print(frequency); Serial.println();// new line for next data // analogWrite(FANPWM, 70); //set PWM signal }

android-x86

USB install:
zcat android-x86-….img.gz |dd of=/dev/sdb

How to wake up:
the following keys are working: ESC, Menu, left, right, up, down

to wake up the machine the keys must be pressed for at least one second

you may use the mouse wheel to unlock the screen

if you encounter graphics problems you may use the following options:

kernel initrd=/initrd.img root=/dev/ram0
androidboot_hardware=generic_x86 acpi_sleep=s3_bios,s3_mode video=-16 SRC=DATA=DPI=240

the parameter xforcevesa enables VESA graphics driver for X

nomodeset disables the kernel mode setting

Both options may be used to play around and getting graphics to work.

Navigation:
HOME – windows key left
BACK – ESC
MENU – menu-key

Android Tools

adb is part of the adroid development tools and can b found in the directory platform-tools. adb itself must have enough privileges to get a connection to the USB connected android device, so normally it should be started as root.
On an amd64 system the compatibility libs must be installed #

apt-get install ia32-libs

And here is a link to the development platform at google:

http://developer.android.com/sdk/installing.html