Monday, November 24, 2014

One in a million

Just quietly - I am really happy that this blog has reached over 1 million page views !
I don't know what to say, but I feel like I should say something.

Thank you for visiting my blog.

Here are the blog posts that have received most attention to date:
1. Ultrasonic sensor
2. Simple Arduino Serial Communication
3. Bluetooth tutorial 1
4. Bluetooth Android Processing
5. Sound Sensor
6. 433 MHz RF Module with Arduino : this one is rising FAST !
7. Reading from a text file and sending to Arduino
8. Flex sensor and LEDs
9. PhotoCell - sensing light
10. Simple Arduino Serial Communication (Part 2)


For a list of all my projects - please visit my projects page:
ArduinoBasics Project Page

If that is not enough, then perhaps you should visit the Arduino Tutorials Community on Google+.
You are bound to find a project that sparks your interest, or perhaps you could even share your own !

Feel free to leave your thoughts, suggestions or messages in the comments.
Or if you wish to send a confidential message to me - then I would advise to use the form on my Feedback page.

Thanks again for visiting, and good luck with your project and/or Arduino journey !!

Thursday, October 9, 2014

DIY Canon Intervalometer using Arduino



An intervalometer allows you to take photos at set intervals to view a slow process in super fast speed. Watching paint dry is just as boring in fast motion as it is at normal speed, however, when you point your camera to the clouds in the sky, you can get some amazing effects.
 
By taking a picture every 3 seconds, and then playing the sequence back at 30 frames a second, you will get to see a 10 minute event in just 7 seconds.To get a nice flowing motion picture, you need to get a good balance between the recording frame rate, and the play-back frame rate.
 

Clouds moving over city

 
The recording frame rate is limited by the amount of memory you have in your camera, the length of the captured event, battery charge, and the camera's general capabilities. The playback frame rate needs to be fast enough to prevent jittering, but not so fast that you lose the event in a blink of an eye. The more you practice with different subject matters, the more you get a feel for how long you need to keep the camera running and how long to leave between shots.
 
When taking pictures of the clouds, you can generally use a 3-5 second frame rate, depending on their speed across the sky. To capture the flow of traffic, I would recommend a picture every 1-2 seconds. However, for really slow events like a plant growing, you may need to extend the frame capture rate significantly. You will get a better idea once you try it for yourself.
 
 
City Traffic

 
This tutorial follows on from the Arduino selfie tutorial, so you might notice some similarities. However, in this tutorial, we will have more control over the intervalometer by using a sliding potentiometer and an LED bar. The pin layout is slightly different from the Arduino Selfie tutorial - so best to start from scratch to avoid pin misconfigurations.
 

Warning : Any circuit you build for your camera (including this one) is at your own risk. I will not take responsibility for any damage caused to any of your equipment.
 
I found out that my Canon Powershot SX50 HS camera has a port on the side for a remote switch. In the "Optional Accessories" section of the camera brochure, it identifies the remote switch model as RS-60E3. I then looked up the model number on this website to find out the size of the jack (3 core, 2.5mm), and the pinout (Ground, focus and shutter) required to emulate the remote switch. Once I had this information, I was able to solder some really long wires to the jack and connect up the circuit (as described below).
 
I use Time-Lapse tool to stitch all of the pictures together to create a movie/animation.
 
You will need to download and install the LED_Bar library from Seeedstudio into your Arduino IDE libraries folder in order to use the LED Bar in this tutorial. For more information about the LED Bar - visit the LED Bar Seeed-Studio wiki.
 

Parts Required:





 

Fritzing Sketch


 

 

 

 


 
 

Connection Tables


 
Arduino to Relay Module:
 

 
 
Relay Module to Camera:
 

 
 
Arduino to Slide Potentiometer:
 

 
 
Arduino to LED Bar:
 


 
 

Arduino Sketch


 
  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
    
/* ===============================================================
      Project: DIY Canon Intervalometer using Arduino
       Author: Scott C
      Created: 9th October 2014
  Arduino IDE: 1.0.5
      Website: http://arduinobasics.blogspot.com/p/arduino-basics-projects-page.html
  Description: Use Arduino as an intervalometer for Canon PowerShot SX50 HS
               A slide potentiometer is used to control the time between photos.
               The LED Bar is used to display the delay between photos.
               A 3 core 2.5mm jack is used to connect the Arduino and Relay module to the Camera.
================================================================== */

 /* You will need to download and install the LED_Bar library from here: https://github.com/Seeed-Studio/Grove_LED_Bar */
 #include <LED_Bar.h>

 /* Connect 5V on Arduino to VCC on Relay Module
    Connect GND on Arduino to GND on Relay Module */

 #define CH1 7   // Connect Digital Pin 7 on Arduino to CH1 on Relay Module
 #define CH3 6   // Connect Digital Pin 6 on Arduino to CH3 on Relay Module
 
 int potPin=A0; //Connect Slide potentiometer to Analog Pin 0 on Grove Base Shield
 int potValue=0; //The variable used to hold the value of the potentiometer

 LED_Bar bar1(9,8); //Connect LED Bar to Digital I/O 8 on Grove base shield.
                   //The LED Bar actually uses digital pin 8 and 9.

 void setup(){
   pinMode(CH1, OUTPUT);
   pinMode(CH3, OUTPUT);
   
   //Turn OFF any power to the Relay channels
   digitalWrite(CH1,LOW);
   digitalWrite(CH3,LOW);
   delay(2000); //Wait 2 seconds before starting sequence
   
   //Focus camera by switching Relay 1
   digitalWrite(CH1, HIGH);
   delay(2000);
   digitalWrite(CH1, LOW); //Stop focus
   delay(3000);
 }

 void loop(){
      // Read the slide potentiometer and convert the reading to a value between 0 and 10.
      potValue=constrain(map(analogRead(potPin),0,1000,0,10),0,10);
      
      //Use the pot value to create a visual count-down display on the LED bar.
      for(int i = potValue; i>0; i--){
        bar1.setLevel(i);
        delay(1000);
      }
      
      //If the pot value is less than 1, then delay for 30 seconds.
      if(potValue<1){
        delay(30000);
      }
      
      //Turn LED Bar off when taking photo
      bar1.setLevelReverse(0);
      
      //Press shutter button for 0.1 seconds. Modify delay if required.
      digitalWrite(CH3, HIGH);
      delay(100);
      digitalWrite(CH3,LOW); //Release shutter button
 }



 


The Video


 



This project shows how to make your Canon Powershot SX50 HS a whole lot smarter using an Arduino. There are so many things that look so different with an intervalometer. While I connected a slide potentiometer to the Arduino to provide extra flexibility, and an LED Bar for visual feedback, there are many other sensors out there that can be combined with the camera. For example, you could use a PIR sensor to take a picture when movement is detected. Or take a picture when a laser trip-wire is broken. What about sound activation, light activation, leak detection.... the options are limitless.
 
This has been one of my favorite projects, it was a lot of fun, and very interesting.
I highly recommend that you try it out!



If you like this page, please do me a favour and show your appreciation :

 
 
Visit my ArduinoBasics Google + page.
Follow me on Twitter by looking for ScottC @ArduinoBasics.
Have a look at my videos on my YouTube channel.


 
 

 
 
 


However, if you do not have a google profile...
Feel free to share this page with your friends in any way you see fit.



Tuesday, September 16, 2014

Arduino Selfie


 

My attention is drawn towards the noise behind me....
I cannot believe it.
There it is.

  The Arduino is taking a SELFIE !!


 

How did this happen?
 
Well actually, it is not that difficult for an Arduino.
 
I found out that my Canon Powershot SX50 HS camera has a port on the side for a remote switch. In the "Optional Accessories" section of the camera brochure, it identifies the remote switch model as RS-60E3. I then looked up the model number on this website to find out the size of the jack (3 core, 2.5mm), and the pinout (Ground, focus and shutter) required to emulate the remote switch. Once I had this information, I was able to solder some really long wires to the jack and connect up the circuit (as described below).
 

And before I knew it, the Arduino was taking Selfies !!!


 
Warning : Any circuit you build for your camera (including this one) is at your own risk. I will not take responsibility for any damage caused to any of your equipment.
 

Parts Required:


 

Fritzing Sketch


 


 
 

Connection Table


 


 
 

Three core, 2.5 mm jack


 


 
 

Camera Connection to Relays


 


 
 

Jack pinout


 


 
 

Completed Circuit


 


 
 

Arduino Sketch


 
  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

/* ===============================================================
      Project: Arduino Selfie
       Author: Scott C
      Created: 14th Sept 2014
  Arduino IDE: 1.0.5
      Website: http://arduinobasics.blogspot.com/p/arduino-basics-projects-page.html
  Description: Arduino takes selfie every 30 seconds
================================================================== */

 /*
  Connect 5V on Arduino to VCC on Relay Module
  Connect GND on Arduino to GND on Relay Module */
 
 #define CH1 8   // Connect Digital Pin 8 on Arduino to CH1 on Relay Module
 #define CH3 7   // Connect Digital Pin 7 on Arduino to CH3 on Relay Module
 
 void setup(){
   //Setup all the Arduino Pins
   pinMode(CH1, OUTPUT);
   pinMode(CH3, OUTPUT);
   
   //Turn OFF any power to the Relay channels
   digitalWrite(CH1,LOW);
   digitalWrite(CH3,LOW);
   delay(2000); //Wait 2 seconds before starting sequence
 }
 
 void loop(){
   digitalWrite(CH1, HIGH); //Focus camera by switching Relay 1
   delay(2000);
   digitalWrite(CH1, LOW); //Stop focus
   delay(100);
   digitalWrite(CH3, HIGH); //Press shutter button for 0.5 seconds
   delay(500);
   digitalWrite(CH3,LOW); //Release shutter button
   delay(30000); //Wait 30 seconds before next selfie
 }


 

By connecting up the camera to an Arduino, the camera just got smarter !!
The Arduino connects to 2 different channels on the relay board in order to control the focus and the shutter of the camera. The relays are used to isolate the camera circuit from that of the Arduino. I have also included a couple of diodes and resistors in the circuit as an extra precaution, however they may not be needed.

Warning : Any circuit you build for your camera (including this one) is at your own risk. I will not take responsibility for any damage caused to any of your equipment. Do your research, and take any precautions you see fit.


 
 

The Video


 


 


 
 

If you like this page, please do me a favour and show your appreciation :

  Visit my ArduinoBasics Google + page.
Follow me on Twitter by looking for ScottC @ArduinoBasics.
Have a look at my videos on my YouTube channel.


 
 

 
 
 



However, if you do not have a google profile...
Feel free to share this page with your friends in any way you see fit.



Sunday, September 7, 2014

Relay Module

WARNING: Mishandling or incorrect or improper use of relays could result in

  • serious personal injury or DEATH
  • possible physical damage of the product
  • faulty operation
  • or create serious/dangerous hazards.

Please make sure that you read and understand how your relay/relay module board works, the voltage and current it is rated for, and the risks involved in your project BEFORE you even attempt to start putting it together. Seek professional and qualified assistance BEFORE you undertake ANY high power projects.

If you choose to follow the instructions in this tutorial, you do so at your own risk. I am not an electrician, and am not a qualified electrical engineer - so please do your research and seek advice BEFORE undertaking a project using a relay. Please check your connections and test them BEFORE turning the power on.

I accept no responsibility for your project, or the risk/damage/fire/shock/injury/death/loss that it causes. You take full responsibility for your actions/project/creation, and do so at YOUR OWN RISK !!!

Please note: It is illegal in some countries to wire up a high power project without an electrician. Please check your country's rules/laws/regulations before you undertake your project. If you have any doubts - don't do it.


 

What is a relay

A Relay is an electrically operated switch. Many relays use an electromagnet to mechanically operate the switch and provide electrical isolation between two circuits. In this project there is no real need to isolate one circuit from the other, but we will use an Arduino UNO to control the relay. We will develop a simple circuit to demonstrate and distinguish between the NO (Normally open) and NC (Normally closed) terminals of the relay. We will then use the information gained in this tutorial to make a much more exciting circuit. But we have to start somewhere. So let's get on with it.

Parts Required:

Fritzing Sketch


 


 
 

Table of Connections



 
 

Arduino Sketch


 
  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


/* ===============================================================
      Project: 4 Channel 5V Relay Module
       Author: Scott C
      Created: 7th Sept 2014
  Arduino IDE: 1.0.5
      Website: http://arduinobasics.blogspot.com.au
  Description: Explore the difference between NC and NO terminals.
================================================================== */

 /*
  Connect 5V on Arduino to VCC on Relay Module
  Connect GND on Arduino to GND on Relay Module 
  Connect GND on Arduino to the Common Terminal (middle terminal) on Relay Module. */
 
 #define CH1 8   // Connect Digital Pin 8 on Arduino to CH1 on Relay Module
 #define CH3 7   // Connect Digital Pin 7 on Arduino to CH3 on Relay Module
 #define LEDgreen 4 //Connect Digital Pin 4 on Arduino to Green LED (+ 330 ohm resistor) and then to "NO" terminal on relay module
 #define LEDyellow 12 //Connect Digital Pin 12 on Arduino to Yellow LED (+ 330 ohm resistor) and then to "NC" terminal on relay module
 
 void setup(){
   //Setup all the Arduino Pins
   pinMode(CH1, OUTPUT);
   pinMode(CH3, OUTPUT);
   pinMode(LEDgreen, OUTPUT);
   pinMode(LEDyellow, OUTPUT);
   
   //Provide power to both LEDs
   digitalWrite(LEDgreen, HIGH);
   digitalWrite(LEDyellow, HIGH);
   
   //Turn OFF any power to the Relay channels
   digitalWrite(CH1,LOW);
   digitalWrite(CH3,LOW);
   delay(2000); //Wait 2 seconds before starting sequence
 }
 
 void loop(){
   digitalWrite(CH1, HIGH); //Green LED on, Yellow LED off
   delay(1000);
   digitalWrite(CH1, LOW); //Yellow LED on, Green LED off
   delay(1000);
   digitalWrite(CH3, HIGH); //Relay 3 switches to NO
   delay(1000);
   digitalWrite(CH3,LOW); //Relay 3 switches to NC
   delay(1000);
 }


 

The Red light on the Relay board turns on when power is applied (via the VCC pin). When power is applied to one of the Channel pins, the respective green light goes on, plus the relevant relay will switch from NC to NO. When power is removed from the channel pin, the relay will switch back to NC from NO. In this sketch we see that power is applied to both LEDs in the setup() method. When there is no power applied to the CH1 pin, the yellow LED will be on, and the Green LED will be off. This is because there is a break in the circuit for the green LED. When power is applied to CH1, the relay switches from NC to NO, thus closing the circuit for the green LED and opening the circuit for the yellow LED. The green LED turns on, and the yellow LED turns off.

I also show what happens when you apply power to a channel (eg. CH3) when there is nothing connected to the relay terminals. The respective onboard LED illuminates. This is useful for troubleshooting the relays, and knowing what state the relay is in (NC or NO). NC stands for Normally closed (or normally connected) NO stands for Normally open (or normally disconnected)

Here is a circuit diagram for two of the relays on the relay module (CH1 and CH2).
This was taken from the iteadstudio site.

 


 
 

The Video


 



 

This tutorial will become very useful in the future. I now have an easy way of switching a circuit electronically. Yes, I could do this with a transistor, but sometimes it is nice to hear that mechanical click. I am not sure why I like relays, but I find them to be quite fun !!

If you liked this tutorial - please show your support :


 
 


 
 

Wednesday, August 13, 2014

Arduino UNO nRF Adapter

nRF24L01 adapters


This blog entry is about my process in making an Arduino UNO nRF24L01 Adapter from start to the current version... ( If you would like to order a pair of the nRF Adapter, please click on nRF Adapter for Sale. )


Do you face the problems of messy jumpers cables like below when using nRF24L01+ with an Arduino UNO on a breadboard ??

nRF24L01 on breadboard
Or need to DIY your own adapter to sit in between the breadboard groove like the picture below ?

DIY nRF for breadboard

nRf24L01 on Arduino UNO

nRF24L01 with external antenna

With this problem, I started my journey to solve this problem with a nRF Adapter... below are pictures of the evolution of the adapter.

Perfboard first version

The orange and white wires fly across the UNO for the 3.3V power needed by the nRF24L01 radio.
nRF adpater with bottom wiring

nRF adapter with top wiring

PCB Version with 3.3V LDO ( PCB designed by ZXLee )

nRF20L01 adapter DIY PCB 1

nRF24L01 adapter DIY PCB 1

nRF24L01 adapter DIY PCB 1


PCB Version 2 with 2 buttons ( PCB designed by Vintronics )


nRF24L01 adapter DIY PCB 2 bottom

nRF24L01 adapter DIY PCB 2 top

We took the above design, dropped the 2 buttons , fine tuned it and made the final version for factory PCB. This is a joint collaboration project between Arduino for Beginners blog and Vintronics ..

Final factory made PCB version ( designed by Vintronics & myself )

This version have a AMS1117-3.3 at the bottom of the PCB.
nRF24L01 adapter PCB front

nRF24L01 adapter PCB back

Final version with headers soldered on PCB

nRF24L01 adapter PCB front

nRF24L01 adapter PCB back


nRF24L01 Adapter with radio

nRF24L01 adapter with radio

nRF24L01 adapter PCB with radio

nRF Adapter on Arduino UNO

The nRF adapter uses pin 8 for CE, pin 9 for CSN and pin 10 for Vcc (5V to 3.3V with the AMS1117-3.3V VR )

nRF Adapter on Arduino UNO

nRF Adapter on Arduino UNO
All the nRF adapters together ..

All nRF24L01 adapters

If you would like to order a pair of the nRF Adapter, please click on nRF Adapter for Sale.

Summary Links :-

- My RF24 repo fork with support of the nRF Adapter :  https://github.com/stanleyseow/RF24
- Test your nRF24L01 transfer speed https://github.com/stanleyseow/RF24/tree/master/examples/Transfer
- More info on nRF24L01 http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo