Question:
Controlling LEDs with microcontroller using Infrared Remote or bluetooth? Where to start?
Flt.Lt. himanshu
2015-01-11 03:30:38 UTC
I am n00b in electronics. I have installed some LEDs in my diecast scale model bike.

1. 6 X white LEDs (4 X SMD, 2 X 3mm),
2. 2 X 5mm LED (angel eyes)
3. 1 X 3mm LED (tail lamp)
4. 4 X SMD LEDs (turn signals)

I currently use 555 timer to blink 4 turn signals and i operate all lights from an external breadboard using DIP switches.

I want to integrate all the components inside the model and use infrared remote control or bluetooth of my phone to control these functions.

Problem is i have never worked with microcontroller and i don't know where to start. I searched a lot. Most of the microcontroller projects are in robotics but i need something as simple as glowing some LEDs. I found some projects but they use relay boards to control lights (220V). since i am using LEDs i guess relay board isn't required and microcontroller's voltage should be enough to glow them. This will also eliminate the 555 timer i am using to blink leds.

Any idea from where i can gain some knowledge about this?
Three answers:
Ecko
2015-01-11 07:09:36 UTC
You can use an IR led as the transmitter, and an IR detector as the receiver. This link shows how to do it.

https://learn.sparkfun.com/tutorials/ir-communication



Sparkfun is a source for components, but you can scavenge these IR parts from an old piece of electronics gadgetry that uses an IR remote. The parts are usually paired. The IR led in the remote sends a burst of pulses that represents a 1, and a period of no pulses that represents a 0. Thus the pulses represent the carrier (maybe 38kHz) modulated by a digital signal of 1s and 0s generated by any remote. You can see that the signal driving the led modulator (it could be a 555 astable switched on and off) and the signal received from the decoder chip are the same signals, so the IR link replaces a piece of wire connecting these two points.



Tip. You can see the IR led flash using an ordinary digital camera.



This example uses an Arduino as the micro controller because they are cheap and there is plenty of info on the internet about using them. It is programmed by a version of C language. There are many similar devices. The physical size can be an issue. One I like is the Maximite series. It is programmed by a version of Basic, and has smaller versions.



The sending microcontroller has a keypad so there can be a different code sequence for each key, e.g. 1, 2, 3, 4, 5. This is called an encoder. Each key has a corresponding code sequence. It could be a complete IR remote which has a built in encoder, except you have to have compatible software to decode it at the receive end, and be able to determine what codes the remote sends for a particular key. If you use your own micro-controller, you remain in control of what codes are used in the program as you write it. The receiving device takes the code and decodes it to operate switches or logic representations of 1 or 0 or leds to represent which key is pressed. You need to have a micro controller that does this. It can also flash the leds as you wish..



Another approach is a garage door style wireless remote. The transmitter in these accepts a coded logic signal, and the receiver outputs the same signal. Some include the encoder and the decoder, so programming is not needed. The receiver needs more power to operate its built in micro controller and relays in this example:

http://www.jaycar.com.au/productView.asp?ID=LR8824



Here is an example of a a guy using this idea to control his autopilot on a boat. He uses bare bones 433Mhz transmitter and receiver and a small PIC micro-controller for each. The transmitter has a keypad. The receiver only sends a serial data signal out on a communications bus around the boat called "seatalk" though. The software and hardware could be modified to operate relays or logic switches or leds instead. The schematics and the software are given. A good start.

Tip. You can get a bare bones transmitter and receiver module out of a wireless doorbell. These are doing the same thing basically with just one button. You add your own micro-controllers.



If you look at a relay driver circuit, you will find it similar to an led driver, except the led replaces the relay, and a ballast resistor is needed. See the Sparkfun Relay Board Schematic in this link. It has both an LED and a relay driven by one transistor from a micro-controller or other logic input (0/5V). Just delete/add the unwanted part. It is not hard to modify the relay circuit of the units with built in encoders to an led circuit:

http://developer.mbed.org/users/4180_1/notebook/relays1/



Using a phone and blue tooth. I am a bit out of my depth here, and cannot find any reference about others doing it. In a sense it is propriety. You will need an app in the phone that produces an encoded signal for the blue tooth wireless link. This will use software libraries in the phone most likely. Rowmote Pro might be a start at the iPhone end. It makes the phone into a remote more or less, to work with maybe an iMac using bluetooth. You also need a blue tooth device and compatible software for the receive end. You will then have to work out how to use the output from the connected receiving blue tooth device. Bluetooth has networking facilities, and 2 way communication, so is more complex, and you tend to be locked in to using protocol involving a library to suit the controller in the receiving end, if you can get it. In the end it is wading through documentation. It is more of a challenge than you need I think.
johnm
2015-01-12 20:17:29 UTC
Bluetooth is pretty easy too, and inexpensive. Plus the wireless signal can go through light construction materials, and unlike IR, does not need to be aimed directly at the target. The Bluetooth module costs as little as $4.50. The Arduino Pro Mini costs $2.50. A FTDI adapter for programming the Pro Mini is $3.43. The rest is a battery (7 to 9 volts) and your leds. The transmitter can be a smartphone, as it has Bluetooth. With a free app like Arduino Bluetooth RC car or ArduDroid, you can send commands to the HC-05 which is connected to the Pro Mini. The Pro Mini has pins that can power the leds. The Pro Mini must be programmed to look for a specific serial data byte sent by the app. Review the extensive tutorial from Arduino Bluetooth RC car. And look at my nRF24 robot, https://www.youtube.com/watch?v=tzOAnrlcXRQ. I used Arduino Bluetooth RC car to control my Christmas lights https://www.youtube.com/watch?v=eHeAUkZoSnc



The Arduino programming is pretty straightforward and free for download, and has examples built in to the programming package. You don't need to be a programmer to learn, just follow the examples. http://arduino.cc/
Robert J
2015-01-11 04:39:04 UTC
Infra red is definitely the first stage.



You can get infra red LED emitters and IR control receivers very cheaply from most electronics suppliers.



Use PIC microcontrollers for the electronics, they are very cheap and again very common, and there are thousands of example programs about for them.



The MPLAB programming environment is free and you can either work in assmebly language or get a C compiler to go with it.

http://www.microchip.com/pagehandler/en-us/family/mplabx/

http://www.microchip.com/pagehandler/en-us/devtools/mplabxc/home.html



See the examples below for IR controls:



http://picprojects.org.uk/projects/ir/minirem/index.htm

http://www.circuitvalley.com/2012/09/infrared-ir-nec-microcontroller-pic-avr.html

http://www.pic-tronics.com/IR-Transmitter-and-Receiver.php

http://jap.hu/electronic/codec.html



If you use any of the chips above 8 pins, you can also trace the program in them as it runs and see what's happening using an in circuit debugger. The "PICKIT" units are quite cheap and can be used for both programming and debugging.



eg.

http://www.ebay.co.uk/itm/Development-PICkit3-PIC-KIT3-In-Circuit-debugger-programmer-Chip-dsPIC-PIC32-UK-/271549445075

http://www.ebay.co.uk/itm/ICSP-Adapter-ZIF-8-14-w-PICkit-3-USB-Programmer-/230432427613





Edit - ps. If you get the MPLab stuff anyway, you can write programs with that and emulate the chip itself within mplab, to see what the program does and watch the CPU internal registers etc. without ever having to connect any hardware.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...