Spycam with Arduino / Digispark

This is my first real project with the Digispark.

My son made a bird feeder at school and every now and then we could spot a bird eating on our balcony. I thought that would be cool to make photos of the birds stopping by.

Somehow we would have to detect when something comes/flies by. This is done using the PIR motion sensor. But apart from that, Digispark should also trigger after a defined interval, like making a foto every 5 minutes for some nice time lapse movies. I actually added a 1k potentiometer with which we can adjust the delay between two photos between 30 secs and 10 minutes. Setting the poti value in the middle Digispark would trigger a photo every 5 mins.

I bought myself a spycam on ebay:

spycam

Features:
Image Resolution: 1280 x 960 pixel
Color Video Resolution: 640 x 480 pixel
FPS: 29 frames per second
Image file format: JPEG
Video file format: AVI
Color Video and Audio
Rechargeable Li-ion battery: 280mA 3.7V
Dimension: 5.0 x 3.0 x 1.2 cm

Continue reading

HC-SR501 passive infrared sensor with Arduino

Got myself a HC-SR501 passive infrared sensor from ebay for less than 5€.
As information about this sensor is hard to find but usage is pretty easy I thought I share my findings.

HC-SR501

HC-SR501: Left poti is to adjust sensitivity. I have set it to medium. Right poti is to adjust the delay. I set it to minimum which means it triggers about every 5 seconds.

HC-SR501

On the bottom are the connections for 5V (left), signal (middle) and GND (right). I tried around with the jumper on the top right, but couldn’t really tell a different behaviour.

I thought the signal pin delivers an analog value according to the distance so I added a LED to pin 11 for the output. This was the initial setup:

#define pir A0
#define led 11

void setup() {
  pinMode(pir, INPUT);
  pinMode(led, OUTPUT);
  Serial.begin(9600);

}

void loop() {
  int i = analogRead(pir);
  int l = map(i,0,1023,0,255);

  Serial.print(i);
  Serial.print(" / ");
  Serial.println(l);
  analogWrite(led, l);

  delay(100);
}

I realized that the value I was reading at the sensor pin was always around 680 not matter what.
I then went on to change analogRead to digitalRead:

#define pir A0
#define led 11

void setup() {
  pinMode(pir, INPUT);
  pinMode(led, OUTPUT);
}

void loop() {
  digitalWrite(led, digitalRead(pir));
  delay(100);
}

And it worked too… but I think going forward I will use analogRead and will react to motion once the value delivered by the PIR is higher than 500.

Cash register for kids with Arduino

Ever since I started with Arduino I wanted to create a cash register for my girl.
My requirements:

  • A “scanner” that triggers a buzzer and displays a (random) value on a LCD.
  • A keyboard where numbers can be pressed and calculated.


For the scanner I thought it would be a good idea to use a LDR (Photo resistor). Initially I hard coded a threshold value and when the value returned from the LDR was over that value, it triggered a buzzer. I then realized that working with the LDR depended a lot on the light – meaning it really mattered if I tested at day or at night with no daylight. I decided to add a potentiometer with which I can fine tune the threshold value later instead of uploading new code to the Arduino just to change a constant.
I also added a LED to the scanner that is on most of the time but turns off when the LDR value goes over the threshold value, ie when it is dark.

Scanner complete

Scanner complete

Continue reading

The Arduino Christmas tree

Ever since I saw this How-To: Shrinkify Your Arduino Projects I wanted to do a project using Arduino Attiny85s. And because I want to bring my son into the world of Arduino and he was eager to learn how to solder I was thinking of an easy project. With Christmas being around the corner I wanted to do some kind of a blinking Christmas tree.

The Attiny85 has 5 pins to use so I thought it would be cool to hook up a shift register to blink some LEDs. First thing I did was buying Attiny85s and 8-Bit Shift Register (SN74HC595N) on ebay. 10 pcs of Attiny85 cost me 12 USD and 10 shift registers were 2.50 USD.

The idea was to control 8 LEDs with the shift register. That would use up 3 pins on the Attiny85… so this left me with 2 more pins. I decided to use them kind of doing multiplexing LEDs. So I could hook up 2 LEDs per shift register output but they would not share the same connection to ground. This was controlled by two transistors that are connected to the two remaining pins on the arduino.

Continue reading

Connecting the ENC28J60 ethernet breakout board

An idea I have in my mind is to create a mood light with arduino. It also should have an internet connection to be able to pull some information from the web. For example it could poll the data from yahoo weather and would change its color according to the forecast for the day…

The other day I bought a ENC28J60 ethernet breakout board on eBay for around $4.50. Lots cheaper than an ethernet shield of course.

To test it out I connected the ENC28J60 to my Arduino UNO according to this post. Which means I made the following connections:
Continue reading

Hello world!

Just testing the code plugin 😉

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */
 
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
 
// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);    
}
 
// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}