Monday, 11 November 2013

Strip leds at 5v

Intro:
Are you looking to implement some leds on your project? Do you want a strip leds that works at 5v? Are you interest about strip leds? I hope that one of these questions you have answered to YES otherwise this post will be useless for you =).

I am going to describe what I got on Amazon for a few pounds, just to add on my project some strip leds that could work at 5V instead 12v as usual.


Items:


Teardown:

The strip leds came with a small controller with 3 functions:
  • Light: you can change the colour of the leds with predefined colours
  • Speed/Bright: you can change the speed and brightness
  • Mode: you can change mode between: fading, strobe and solid
In the video you can see how bright they are and a small demo.
 


Under the protective plastic you can find 3 buttons and on the back some components, nothing very interesting, the main chip doesn't have any info printed on it.



The strip leds is a normal RGB, you can see from the image below, it has 4 pins:

  • 5V
  • Green
  • Red
  • Blue
Great news that allows me to re-use this strip leds with my Arduino.




Testing leds: Google plus ( sorry I couldnt upload on youtube)


Arduino Test:

The final conclusion, this simple and "cheap" ( well still 4 pounds but for prototyping is good enough ),  is suitable to be connected on your Arduino.
Below you can see that I tried to give 5v and the Ground to the pin Blue, I got the blue colour.

What you need to do is to connect the 3 pins on your 3 PWM output and try to send values from 0 to 255.
The strip leds will change colour based on what you are going to send on each pins, it's easy, isn't it?

Friday, 25 October 2013

Photo resistor with inverter logic


Intro:
I was looking for a system that allowed me to trigger a circuit when was getting dark, so I found out that with some testing, a photo resistor and a inverter logic I could achieve this goal.

Items:

  • 1x 74HC04N ( hex logic )
  • 1x photo resistor
  • few resistors ( 10-22k )
  • 1x transistor n-channel
  • 1x led
  • 1x battery 5v
  • few jumpers

Wiring:



Connect the battery to the VCC and Ground of your Inverter logic.
The photoresistor needs to be connect to 5v on one pin and the other needs a resistor 10-22k to the ground and a jumper to the Input 1 on your Inverter logic. The resistor has to be tested on the final circuit because based on it, the system trigger the transistor when is very dark or less dark.
Connect the output 1 on the gate of your transistor, the drain to the led and the source on the ground. Remember to bridge the gate and source with 10k!
Complete everything by connecting the other pin of the led to the 5v, better to put a resistor if you dont want burn it.

After all this is done, try to cover it or switch off your light, you should see the led lighting up, if it doesn't work, try with something less than 10k.


Video:



Monday, 21 October 2013

Blinking leds with 555 timer

Intro:
I was looking for something that could make some leds blinking, but my head always ended up with some Arduino stuff.
I had to move my challenge to the next level, forget about the helpful Arduino and move to the real electronic way!
After few hours of research I came up with the 555 timer solution, simple, clean and cheap.

Items:

  • 555 Timer
  • Capacitor ( try to get a few from 10 to 100 uF )
  • Resistor 
  • Leds
  • Battery

Wiring:


The diagram above is the simplest one that I found in the internet, it shows how to connect the 3 resistors, capacitor and led.

Tweaking:
Here we go, now we have our flashing system but you have to tweak it a little bit because the flashing delay is too higher or lower for your project.
Change the capacitor with something higher than 100 uF to increase the delay or something lower to decrease the delay. 

Here an example:
100 uF = 2 flash per seconds
10 uF = 10 flash per seconds 
These are just "fake" information, but you can have an idea which capacitor you have to use for your project!

The brightness of the led can be changed by using the current resistor on R3, maybe 1K is too higher for your type of light.

The flashing delay can be adjust by changing the R1 and R2 with lowers values, but be careful, better have a look on the internet and calculate the right ones!

Sunday, 20 October 2013

Smoking Pumpkin


Items:

  • Pumpkin
  • Tray ( the right size of your pumpkin )
  • Glycerin
  • Water de-ionized 
  • Tea lights
  • Nails

Construction:


  1. Get a Pumpkin and create your scary face and cut the top to have access to the inside



  2. Put 4 nails on the inside of your Pumpkin, the position of each has to be good for your tray, so make sure that is not too far.
  3. Put as many as tea lights you can fit, more there are, less time you have to wait to get some smoke
  4. Get your Tray and put 60% Glycerin and 40% Water to have good and thick smoke.
    If smoke is too thick, reduce the amount of Glycerin and add more water, you should try until you find out what is the best for you.
    Better if you close the Pumpkin, so the heat doesn't go away.
  5. Place your Pumpkin smoking outside in the dark and enjoy the smoke effect!




Reference:


Sunday, 13 October 2013

Happy Birthday Box

Intro:
I had to buy a present for a my friend but I didn't want to come up with something useless and out-fashion, so I thought to use my skills in electronic to build something different.
My mind made some wired ideas and I ended up with a "Happy Birthday box".

What Does It Do?
The Happy Birthday Box is a simple project where a small Arduino, LCD Screen, Buzzer and a battery are used to wish Happy Birthday with sound and text.
I had to mount a little switch to turn on the whole system, nobody wants the infinite Happy Birthday song on his house :)

Hardware:
I ordered these items:

  • Arduino mini ( you can use any Arduino
  • LCD Screen ( 16x2 )
  • Buzzer
  • Booster battery ( from 3.7 to 5v )
  • Battery 3.7 850mah
  • Roller switch

Wiring:

LCD:
This is a pretty simple way to wiring the LCD screen, they are all the same, the only issue that I have seen so far is to choose the right resistor for the contrast.
I have seen tutorials tell me to use 10 ohm but in my case I couldnt use this one, I had to increase to 600 ohm to actually read something on the screen. So be careful, if you dont read what you are trying to display, is not always a wiring problems! 

I just redirect to this nice guide how to wiring your LCD: http://arduino.cc/en/Tutorial/LiquidCrystal
If you want to get rid of the potentiometer, just put try to put some resistant from pin RS ( LCD ) to GND ( LCD ).
Also to light up the back light of the screen, just solder the penultimate pin to 5V and the last pin to the ground with 100 ohm ( usually is written + and - in the back ).
   

Buzzer:
Very simple, just attach the ground and the other cable to one of the pin.

Code:
Very simple and "clean" ( I hope ), I haven't written the melody part, I just got from internet:

Tuesday, 8 October 2013

Use Serial Port to access on your Raspberry Pi

Intro:
I was working on my personal project  where I couldn't attach a Ethernet cable to check what was going on or just check the status of my Raspberry Pi.
I knew that I could the pins TX and RX with a USB Serial port, so I got one and I started to use  as debug system.

Hardware:
You need a simple USB Serial port, you can get the cheap one here or you can get something "branded" on your usual electronic shop.

Wiring:
Connect the BLACK pin to the GROUND, the GREEN to the RX and the WHITE to TX.
If this combination wont work, just swap the GREEN and WHITE, it might be different from my adapter.

I never connect the red because your Raspberry is already powered from the usb port, so to avoid any problems, dont connect it!

Connection:
Everything is ready to communicate with your Raspberry Pi via Serial port, what you need to start, is a Terminal software, you can use GTK Terminal, Putty or whatever you prefer.

Open your software, select the right port, set the baud at 115200 and then you should see texts coming up on your terminal.




Sunday, 10 February 2013

Raspberry Pi and Leds strip RGB

Description
This project came up with my friend who wanted cover his room with leds strip and control all of them with a simple http request.
The idea was to be able to change color and the brightness, so I had to buy just a few components to make the controller:


  • 4x MOSFET N-Channel STP75NF75
  • 1x Breakout Adafruit
  • 1x 16 Channels servo Adafruit
  • 1x PCB
  • some wires

Schema
I just placed all my components on a PCB board, connected the 16 channels servo via I2C and each MOSFET to the leds strip.




Why MOSFET and 16 Channels?
Someone is maybe asking why I am doing this total mess with MOSFET.
The answer is that the 16 Channels couldn't give me the same result that I was expected. This means I couldn't pass the max power through this board, so I avoided the problem by using  4 MOSFET that are getting the main source power, 12V, and Raspberry is sending the right pulse to each ones.

HTTP Request
My friend made a little script in Python that is waiting for a POST request with Red, Green, Blu, Power as parameters and then it will send the new color through the 16 Channels.

Code?!
I don't really have so much code, I took the example from Adafruit to drive the 16 channels ( 3 lines ) and then parsed the 4 parameters to send the value between 0 and 4095.
Obviously I can post something if someones needs a little guide how to parse these values =).


Video


Saturday, 26 January 2013

Leds Strip Fading system



Description
I made a little test with some components to find out how to control the brightness of this leds strip, I couldn't find a good answer on Google so I came up with a solution.
Keep in mind that I am not an electronic so this solution could be not the best one, it worked and tested. 

Items
  • Leds strip
  • Arduino
  • N-Channel MOSFET, my was 2N7000
  • 200 ohm resistor
Schema


Code

void setup() {
    pinMode(5,OUTPUT);
    pinMode(6,OUTPUT);
}

void loop() {
 analogWrite(5,0);
 for (int i = 0;i < 260;i++) {
    analogWrite(6,i);
    delay(10);
 }
}

Saturday, 12 January 2013

Converting a freezer into a Lipton icetea dispenser

Introduction
This project could sound weird because why would I want to use a freezer instead of a fridge? why would I want to make a Lipton IceTea dispenser and what does it mean?
There are a lot of questions about this project and there are only two answers:

  1. My friend bought the wrong fridge to store some drinks but he only realised this when we got home. It wasn't a fridge but a freezer!
  2. We couldn't be bothered to get up, open a bottle and refill our glass, instead we prefered pressing a button and having our glasses automatically refilled.
If you want to reproduce this project you can avoid to buying a freezer instead buy a fridge and remove some other components.

Transforming a freezer to a fridge
I thought that the best option to don't waste more money and keep the bottle in a liquid state, is to control the temperature inside of the freezer. I got one temperature sensor DHT22 and attached a relay to the power socket, by doing this I could switch the power on and off when the temperature was too high or too low and the bottle didn't become a big block of ice.

Back of the freezer where was connected the sensor to turn on/off by the sensor of temperature

I connected the sensor and the relay to the Arduino, I made a little script that keeps it switched on because if the temperature drops below 5° to 0°C it stops working and becomes a freezer.
The two wires ( Brown and White ) are going to connect into the relay



IceTea distribution 
This is the most expensive part of the process, I had to make one hole on the fridge to ensure the pump works effectively. The tube is used to get the liquid from the freezer.

  • Holes
The freezer was not equipped with a hole to pass one hose, that means that I had to use a drill to make it. 
There is one hole, on the  lower part
To ensure that the warmth was not dispersed through these holes, I had to use some kind of isolant and I chosen the product Sugru.
  • Water pump
The pump was the main part of the project as it has to move the liquid from the fridge into the glass, but I had to make sure that the pump was FDA tested!
If you don't have a certificated pump , you could drink a poisoned liquid. 
I hadn't check this part of the project when I bought the pump( see the picture below ). Fortunately I found that it's very dangerous to buy the cheapest one because you didn't want to spend 10-20 pounds more.


In the end I had to contact the company TOPSFLO that had certificated pumps and I bought one for 30 pounds ( included the shipping cost ).
This was the pump ( website ):


To connect this pump with your Ardiuno, please have a look at this tutorial: http://bildr.org/2012/03/rfp30n06le-arduino/.
  • Hose
I bought two types of hoses, one of them is used to connect the bowl to the pump ( 13mm ) and the second one is connect the pump to outside of the fridge ( 9mm ).


I also bought a tap hat gourmet to fit the hose into the bowl, in that way I can take off the tube and wash the container without cutting anything. 

  • Push buttons
I have chosen to install two push buttons, the first one fills the glass in one shot and the other one is working as a normal button, when you press it the pump is working and when you release everything stops.



  • Valves
The system could work without any valves because there wasn't any problem of functionality, the only problem was that you wouldn't  drink something that was not isolate and kept into a bottle.
If I didn't use a valve, the liquid will be the same as leaving the bottle open in a fridge.

I found the non return valve for the external tube.


 Prototypes

Demo 1



Demo 2



How refill the fridge


Arduino messy wiring

The wiring was a little bit messy on the back of the fridge but I want to explain what I have connected there:

I have made a own PCB that I have attached:
  • MOSFET: switch the pump on/off
  • Resistents: DTH22 needs one and the pump
  • 5V and Ground: these two just to have a specific place to get the power and ground
I have connected the relay to the Arduino to turn on/off the fridge and 2 wires to get an analog input of the two buttons.





I had to make sure that all holes were isolated and for that I have used the awesome product Sugru that was a kind of silicon and it makes a perfect insulating.



Sunday, 6 January 2013

Webcam over 3G with Raspberry PI

Description
This project was about a personal challenge that my Dad asked me to do it.
Everything started more than one year ago when I was trying to do it with Arduino but I lost a lot of time because I couldn't make everything works as fast as Raspberry does.
I decided to move on Raspberry PI and everything became easy and fast, in a few days I had made 70% of the project.

Let's talk about the project, my idea was to create a remote webcam that I could control it over the 3G network, because I wanted to install it on my mountain's house and I don't have an internet connection.
The camera have to be equipped with:
  • 2 servos: move left/right and up/down from a web interface
  • one temperature sensor: getting information and store them in a file
  • one motion sensor: something like a little CCTV that will send me message and picture when someone is close to it
Obviously everything have to be very well thought for any little problems,  and in case that something goes wrong, I had to make sure that I can access to the camera and fix it.







Simple Schema
Schema



Web Interface
I made a little website to communicate with the camera, I can move it LEFT/RIGHT and UP/DOWN by pressing 4 buttons.
I can get the current temperature, start live streaming, change motion alerts and manager all files about camera pictures and some other files.
I'd like to improve everything with a proper client side using another Raspberry Pi, small screen and a few buttons.




3G Modem
I was looking for a good and cheap 3G modem that could work with Raspberry PI and read/send message, what I found was the HUAWEI E3131 that had a web interface and a simple API to control it.
I made a little wrapper library that I could send commands from my Python code, something like: connect to 3G network, send message, read message, etc..
I really recommender this modem because it was cheap, unlocked and easy to use!

Python library for HUAWEI E3131





Servo Pan and Tilt
I had to build my own Pan and Tilt system because the position that I have chosen is not simple one.
I came up with a solution to put everything in a PVC tube and attached one servo on the top to move the whole structure and the second to move the camera up and down.

First prototype:



Webcam
I have used fswebcam to capture snapshot from the webcam and I made a little wrapper in Python to execute this command with specific parameters.


Temperature sensor
I have chosen the DHT22 as temperature sensor, because it was easy to hook up with Raspberry and I have used this sensor on my previous projects with good results.
What I thought was to implement this sensor to store different temperatures through the whole year and have a little chart about the weather on my mountain.

Motion sensor
The motion sensor was attached to my Raspberry via one digital pin, there was a thread that was checking every 4 seconds if someone was there and send me two kind of alert: SMS and upload the picture.
I have implemented some functions to remove any kind of alert in case that the motion sensor will be trigger for stupid reasons.

AutoSSH
This was my special army to access on my Raspberry even if I was connected to a 3G network, because you know that you can't open any port as you can do on your own modem.
Basically I had to setup a ssh key to connect to my server without insert the password and create a system to active and de-active the session.
I came up with an external service with Python that will start the service if the internal service was crashing. You never know if the main script will working properly or your thread will stop to work, so this was my second security system to access and fix it.

External Power
Raspberry has only one micro usb port to give power to the whole system, so I had to solder 2 wires directly to the board.
I found the instruction on this website: http://www2.pmb.co.nz/blog/computers/raspberry-pi-direct-5v-power-wiring-modification/ to understand which pins were the 5+ and GND.
I suggest to mount  a fuse between the battery and the Raspberry, in case that something goes wrong and you don't burn your board.


Solar panel
The power source was a little problem because at 2'000 meters over the sea you don't have a normal power socket to plug your devices, so I bought a solar panel from EBay and a car battery.
I have chosen the car battery because you have 2 years of warranty and I was looking for something very high capacity and I found one with 55mAh at 12V.






Conclusion
I am testing this configuration at home before move everything at 2'000 meters, so I can be sure that at least for a month I can connect to it, get some pictures and fix any crashes that will came up.