Introduction: RGB - Led Strip 12 V Controlled by an ATtiny85 With an 125Khz RFID Module
The basic idea gave me this side RGB-RFID-Lamp . But since I have a lot ATtiny85's I will use this micro-controller. To make it easier for me, I tested all part first on an Arduino Uno.
- 1 x RGB – Led strip 12 V
- 1 x ATtiny85
- 3 x MOSFET IRL540N
- 3 x resistors 10 kOhm
- 1 x 125 khz RFID – Modul
- 1 x Voltage regulator 7805
- 2 x 10 uf Capacitor
- 4 x Terminal blocks som wires
Step 1: Test the RGB-Led Strip and RFID-Modul on a Arduino Uno
Setting RGB LED strip:
I did like here at Jerome-Bernard's blog ,jerome-bernard.com - blog
He has an error in his Fritzing® drawing with the 10kΩ resistor this must be between the Gate and GND on the MOSFET and not Drain and GND. The resistor Gate to GND have the task of keeping Gate pin LOW which is especially important when starting the Arduino Uno.
Another resistor, as I do not use, can be used is from Gate to Arduino pin to reduce the flow and protect the pin.
I tried different MOSFET's, after reading a lot about MOSFET operation and how they work, seen video on Youtube, I ended up with the IRL540N.
They can easily be "burned" when swapping around with Gate - Drain – Source. You can build up a simple N - MOSFET tester like this: Mosfet-Tester
Setting up the RFID 125 khz module: I did use his setup : fibidi.com it worked out very god.
Tested RGB Led strip and RFID - module together with an Arduino Uno and the entire set worked as expected.
Step 2: Setting Up RGB - Led Strip on a Attiny85 :
The next step was to porting it over to an ATtiny85. The layout of a ATtiny85 has only five pin you can use, 2 pin for PWM and 3 Analog pin. I needed for the RGB - Led strip 3 PWM and for the RFID - Module 1 pin only Tx = read. Attiny85 must also have a clock speed of 8 MHz and to do so are described here : change the tiny arduino between 1mhz and 8mhz
From RFID - module I only use the read = Tx function, I found a library from Nick Gammon he made this library: http://gammon.com.au/Arduino/ReceiveOnlySoftwareSerial.zip
The next is to getting an additional PWM - pin this was a bit of a challenge. Since I am not so good in write programms or similar. But I found a solution here:
So pin 4 – of the ATiny85 layout is the third PWM - pin.
So the pins looks as follows se also the part of the datasheet :
- PB0 - PWM / Red
- PB1 - PWM / Green
- PB4 - PWM / Blue
- PB3-125 kHz RFID Tx just read
For better and easy control of RGB - Led strip I use this library: https://github.com/joushx/Arduino-RGB-Tools
A very easy method to control RGB - Led or strip.
After a breadboard setup to see that everything function, I could solder it on a strip board.
On the pictures from left to right :
- RFID - antenna
- power 12 V, IC 7805 voltage regulator with two 2 10uf capacitor
- ATtiny85 , Terminal Blocks for the RGB - Led strip
- RFID - module and 3 IRL540 N Mosfet and 10 kOhm resistor
I made a wooden box for the RGB - Led strip and ATtiny85 board. On the frozen glas is the RFID - antenna connctet and on the video you can se how it worked.
The schematic is not the best but gives a hint how I put all things together.
If there any electronic fault or programm mistakes you can se or now please write me so I can correct it, this is my first Instructable