# Modding Ebay RGB LED??

#### MNgeek

Joined Sep 22, 2011
10
Hey guys,

What are the chances that I could re-program a RGB LED from ebay?

I bought a remote controlled LED lamp off of ebay.

Like this one:
http://www.ebay.com/itm/5W-GU10-Remote-Control-LED-Bulb-Light-16-Color-lamp-/120620089310?pt=LH_DefaultDomain_0&hash=item1c15847fde

I would like to reprogram it. However, I cannot identify the microcontroller. The microcontroller is a SOIC-8. The identification is on the bottom of the chip for some reason. the chip has on it:

FC00772
AHK 1024

I'd like to find the datasheet, but I have no clue who the manufacture is. I googled a bunch, but couldn't come up with anything.

The 1024 must me the memory size?

The pinout is as follows:

1. VCC
2 Red PWM output
3. N/C. Pulled to ground with a 4.7kohm resistor
4. typical infra-red controller input.

5. 1.5vdc. square sine at 60hz, 50% duty cycle (for clock?)
6. Green PWM output
7. Blue PWM output
8. Gnd

The power supply is 120vac in, 5vdc out. It also has a 3vdc square sine coming from another lead. Not sure what this is for. Microcontroller timing?

Thanks

#### ErnieM

Joined Apr 24, 2011
8,045
I can't find anything searching on those numbers. It's not unheard of for a manufacturer to get their own part numbers on things.

Microchip 8 pin controllers have the Vcc (Vdd) & Gnd (Vss) in the same places as yours. If you could unsolder the SOIC-8 and replace it you could drop on of these in there and it would work. Programming needs 13 V briefly on pin 4, that may be a problem with the IR signal circuit.

The signal on pin 5 may be so the micro can synch itself with the AC line, necessary if the LED power isn't DC.

#### MMcLaren

Joined Feb 14, 2010
842
It's difficult to say which microprocessor you have there. Microchip, Atmel, and a couple other manufacturers have 8 pin devices. I used an 8 pin PIC (Microchip) μC for a project like this awhile back.

Good luck. Regards, Mike

#### Attachments

• 42.5 KB Views: 35

#### t06afre

Joined May 11, 2009
5,934
I will also guess that if it is a micro-controller. The code will be protected. So you will not be able to read out from the chip. Some micro-controllers are also one time programable only. What you can do will depend very much on your electronics skills. How skilled are you in electronics by the way.

#### MNgeek

Joined Sep 22, 2011
10
The code will be protected. So you will not be able to read out from the chip. Some micro-controllers are also one time programable only.
That would make sense. I connected a Pickit2 to the chip itself a while ago and it wasn't recognised by the software. I know that some microchips are not auto-recognised by the software.

The reason why I would like to re-program it, is because upon power up the light goes into full demo mode. Scrolling through colors, flashing and what not.

The big problem is, that I bought 13 of these to put in my outside recessed lighting. The recessed lighting is on a motion detector. Every time the lights turned on, it goes into full demo mode. I was disapointed, and too busy at the time to bother trying to send them back.

t06afre, My microcontroller experience is very limited. If you'd like me to mail you one to play around with, I will. I'd like to figure out how to get them to white and full brightness upon power-up.

#### Attachments

• 306.2 KB Views: 35

#### ErnieM

Joined Apr 24, 2011
8,045
I'd like to figure out how to get them to white and full brightness upon power-up.
Is that your only goal? You should be able to do that by pulling the SOIC and adding some jumpers.

It looks like an interesting device. Just don't let it bite you when you probe it, it looks like there is no line isolation in there.

#### MNgeek

Joined Sep 22, 2011
10
Is that your only goal? You should be able to do that by pulling the SOIC and adding some jumpers.
White and full brightness on startup, and still retain the full functionality. These lights are above my patio, and it's cool to have them on a color other than white while we are entertaining.

It looks like an interesting device. Just don't let it bite you when you probe it, it looks like there is no line isolation in there.
I'm using two small back-to-back 24v transformers to provide isolated 120vac. It also limits the current. I can short out the output and it only has 2 amps. No blowing fuses. The only drawback is that the transformer being drivin backwards gets slightly warm. It actually works pretty well.

Let me ask this. I'm new to microcontrollers so bear with me.
I have a Pickit2 clone. It still uses the standard microchip software.

Will a Pickit2 be able to communicate and program microcontrollers other than Microchips pic? I'm guessing that if I can't establish communications with my Pickit2 I should purchase and try a AVR programmer?

In my dreamland, I'd imagine I could copy the code from the microcontroller, run it through a dissasembler and attempt to change the default mode. From what I gather, this would be pretty tough to do. and Impossible if the code is protected.

#### Markd77

Joined Sep 7, 2009
2,806
Sounds like there could be another way.
If there is a fixed sequence of buttons that will set it to full power white, then you can duplicate that with a PIC and an IR LED at every turn on. You can use your scope and a phototransistor to see the pattern for the transmission, then the code to recreate it won't be too tricky.

#### eblc1388

Joined Nov 28, 2008
1,542
Or let all the 13 lights powered up, selected to full white but in the OFF state.

Then use the motion sensor to drive relay(s) to simulate closing the 'ON' / 'OFF' button on the remote control.

#### ErnieM

Joined Apr 24, 2011
8,045
I'm using two small back-to-back 24v transformers to provide isolated 120vac. It also limits the current. I can short out the output and it only has 2 amps. No blowing fuses. The only drawback is that the transformer being drivin backwards gets slightly warm. It actually works pretty well.

Let me ask this. I'm new to microcontrollers so bear with me.
I have a Pickit2 clone. It still uses the standard microchip software.
2 amps is plenty enough to stop a beating heart. The old trick is to always keep one hand in your pocket when probing inside, or make a nice switch one hand has to press to turn it on. OK, I wouldn't do this but I am always very aware of how dangerous it can be. And yep, I get bit too from time to time. Just be careful to the point of anal retentiveness.

Since you already have a Pickit, and Microchip makes parts that could drop into this circuit, why not just use that stuff? You can get several pretty decent C compilers for free to write code.

The on board IR receiver may need some help not to blow up when you program these but we could figure out something to add.

The hard part comes to reverse engineer the codes the remote sends out. I actually did that once for fun, IR sensor took the output from a TV remote and would show what you pressed on an LCD screen. It does take an oscilloscope to "see" the codes coming out of the receiver.

#### MNgeek

Joined Sep 22, 2011
10
2 amps is plenty enough to stop a beating heart.
My day job is an electrician, so I'm extremely careful. If it isn't safe, I don't do it. Our company is very good about safety and encouraging customers to shut off electrical gear/equipment while we work on it.

Since you already have a Pickit, and Microchip makes parts that could drop into this circuit, why not just use that stuff? You can get several pretty decent C compilers for free to write code.
I'm all for that. Pics from Digikey run about a buck a piece. Since I don't know C, how long would it take me to learn the basics? I've done some coding for PLC's years back, but that knowledge is long gone.

The on board IR receiver may need some help not to blow up when you program these but we could figure out something to add.
I could program it first, then solder it in. I suppose testing the code would be a pain though. I'll have to look closer at the IR circuit.

The hard part comes to reverse engineer the codes the remote sends out. I actually did that once for fun, IR sensor took the output from a TV remote and would show what you pressed on an LCD screen. It does take an oscilloscope to "see" the codes coming out of the receiver.
I have a DSO. I can easily capture the IR signals.

I'd like to send the extra light to you, if you'd be willing to help me with the code.

If the existing Pic is protected, would I be able to erase it completely and write my own code onto it? If not, I think this Pic from Digikey would work:
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=PIC12F609T-I/SNTR-ND

I attached an IR capture, and the screen I see in the pickit programmer.

#### Attachments

• 167.6 KB Views: 34
• 186.8 KB Views: 38

#### ErnieM

Joined Apr 24, 2011
8,045
Thanks for the offer of your spare, but you keep it. We'll all help you along without it. Besides, I'd need a controller pad too to make it work.

I can't believe that a guy who has a DSO and a Pickit doesn't have the urge to actually get in there and write some cool programs and make some fun things.

The PIC you picked might work, but its memory can only hold 1K instructions, and that might get tight fast. A PIC12F617 or a PIC12F1840 ($1.04/$1.08 ea for 10 at DK) can hold 2K or 4K instructions, which may be too many but that's a good thing. The PIC12F617 may be a better part for you to start with as it has fewer things inside to confuse you. I've used it's sister part PIC12F615 in a few products

Microchip gives away a decent version of the HiTech C compiler that would work for these chips. C isn't the worst thing to learn and it can keep you from making mistakes you would in the only other alternative: assembly. Assembly comes free inside MPLAB but I don't recomend learning to program using it. Plus while I can program is assembly I much prefer to use C.

Here's one thing to play with. It's an app note to make an RGB LED change color using a PWM drive. (Sound familiar?) The drawback with it is the code is written in that dreaded assembly. But it should give you something to play with.

You have an excellent capture of the IR Remote's output there. You'll need one for every button you want to use, then figure out it's "language." To start, I would bet every sequence starts off with that "very long low/long high" pattern to make START.

#### MNgeek

Joined Sep 22, 2011
10
I just got the dso this week. I decided to start this project since I can now see what is going on. I'm slowly building a small electronics workbench. Next item to get is a Hakko 936 soldering iron.

This rgb led needs a pwm output on pin 6 (gp1) for the green led. It appears that most of the Pics can't do pwm on gp1?

#### Markd77

Joined Sep 7, 2009
2,806
They can do software PWM on all output pins. Hardware PWM requires less processing time but isn't really needed for this project. It would be interesting to see the frequency that the PWM for the lights are doing at the moment. You should be able to see it at any brightness less than 100%.
This for example does software PWM on 3 pins on a chip that has no hardware PWM capability.

I think it would be much easier to make something that pretends to be the controller and just sets the unmodified lights to white, but if you fancy the challenge.....

#### ErnieM

Joined Apr 24, 2011
8,045
This is a solder station I got at work and would get one for home too if I needed one. It has a conventional iron (that frankly I never used as I have an incredibly good one already) and a hot air reflow pencil that can do SMD stuff easily.

As was said, you'll be doing PWM in the code, that leaves plenty of time for looking at the IR input.

Are you going to sketch out the full schematic of this light? While not essential, it's a good learning thing (and I'd like to see it <grin>). The only real question I have is the connection between the 3 pin IR receiver and the PIC input; is it a direct connection or is there anything between them?

Also, it may be simpler if you made a breadboard to test code and once it works just replace the chips in the real lights with pre-programmed PICs.

#### MNgeek

Joined Sep 22, 2011
10
Markd77, The frequency of the PWM is 155hz (see attachment)

ErnieM, Pin 1 of the IR receiver is wired directly to pin 4 of the pic. A full schematic would be tough, the traces don't have much contrast through the blue coating. The cheap handheld microscope I use is very nearsighted, so the taller components make using it tough.

I'm guessing that the IR receiver is close to the Vishay TSOP4838 in MMcLaren's attached post. The IR reciever has an "H" on the top.

I wanted to find the frequency of the receiver. I had to dig through my junk box to find something with a photodiode on it. I found a board that I saved from a flatbed scanner. I took out the photodiode from the scanners position sensor and connected it to my scope. It looks like the IR transmitter is 38khz.

Now, the question is, could I do ICSP, and not smoke the IR receiver with the the programming voltage? I the IR receiver datasheets don't give me any good info on max voltage for pin 1.

#### Attachments

• 146.4 KB Views: 27
• 145.4 KB Views: 22
• 268.3 KB Views: 20

#### be80be

Joined Jul 5, 2008
2,045
ErnieM

Thanks for the link that's a nice looking soldering station

#### MNgeek

Joined Sep 22, 2011
10
EDIT***Oops, Thought you were taking out my set up. I like the soldering station too.***

Last edited:

#### Markd77

Joined Sep 7, 2009
2,806
Somewhere around 155Hz is easily enough achievable.
I don't think ICSP is going to be an easy option:
The DAT and CLK pins for programming are PWM pins so when programmed, these pins will switch on the transistors and the LED. The PICKIT2 can't provide that kind of current so you would have to power the board. At the moment we are guessing it is unisolated so you would probably need to remove from the mains and insert a decent power supply instead.
Also the unknown loads on the pins could prevent normal programming anyway (although at a guess there would be a fairly high value resistor to the base of the small transistors so it might work).
If you are worried about the IR reciever you could desolder and put a socket for it so it could be pulled for programming.

I think it would be much easier to get at least the initial programming and testing done on a breadboard with a few LEDs and an IR sensor instead.

#### be80be

Joined Jul 5, 2008
2,045
MNgeek Nice job I seen that to your work holder looks great Im with the rest I would breadboard this for testing.

You could place solder jumper to isolate the ICSP pins. Then its just a easy bead of solder place or remove and doesn't take much board space.