PROJET AUTOBLOG


Dotmana

source: Dotmana

⇐ retour index

USB motion sensor (PIR) to wake up screen

vendredi 20 juin 2014 à 10:13

I have an always on net-book for weather forecast (yeah, when paragliding, you need it)
It basically displays a full screen custom web-page with time and date.

Its always on, not really good for the back-light and energy consumption.

So I got the idea of plugging a PIR sensor to wake up the screen when someone approach it.

Take an Arduino Micro Pro (8€ for the Chinese version), a PIR sensor from eBay (2€), a Hammond case (1€) and an USB A male from scrap (0€).

Let’s give a try, with a basic wiring, and this sketch to emulate keyboard thanks to it’s USB HID, the Arduino Micro Pro is a must.

int sensorPin = 10;
void setup()
{
  pinMode(sensorPin, INPUT);
  Serial.begin(9600);
}

void sendWakeUp(void);

void loop()
{
  if (digitalRead(sensorPin) == 1) 
  {
    sendWakeUp();
    while (digitalRead(sensorPin) == 1)
    {
      delay(1000);
    }
  }
  delay(1000);
}

void sendWakeUp(void)
{
    Keyboard.press(KEY_LEFT_CTRL);
    delay(1);
    Keyboard.release(KEY_LEFT_CTRL);
}
And voila!
Quite nice, discrete and works very well, for about 10€/$.
Note: if someone has an idea to send a key other than LEFT_CTRL (as it can be disruptive on a workstation), I’m looking for a solution.

flattr this!

Mes trouvailles du jour : 18 June 2014

mercredi 18 juin 2014 à 21:00

flattr this!

Mes trouvailles du jour : 17 June 2014

mardi 17 juin 2014 à 21:00

flattr this!

Mes trouvailles du jour : 15 June 2014

dimanche 15 juin 2014 à 21:00

flattr this!

Mes trouvailles du jour : 7 June 2014

samedi 7 juin 2014 à 21:01

flattr this!