CreeRelays Project (part Cree bulb, part Arduino)

Thanks for the response, Dan. What you said makes sense with the power cycling for repairing. Thanks again!

I’ve been playing around with the Cree module, and wasn’t able to make this work reliably. For a few dim levels it’s reliable, but not for all of them. Sometimes, it fluctuates back and forth between levels when the bulb is constant. The PWM output isn’t perfectly linear, so the map function doesn’t do a great job of translating the PWM to a dimming level. I am trying to use all 99 dimming levels for my application.

A bigger problem, though, is that the timing is so sensitive that I can’t do anything else on the Arduino without throwing off the numbers. Certainly not anything that requires interrupts. I’ve taken it as inspiration to figure out a way to use the Cree board, though. To solve the main problem of letting the Arduino do other things, I’m using a Linear LTC2644 to convert the PWM to a fixed voltage. I’m then reading that voltage on an analog pin of the Arduino. I haven’t gotten all the voltages mapped to dimming levels yet, but it seems to be working, and completely offloads the hard stuff from the Arduino. http://www.linear.com/product/LTC2644

Thanks for the push to get me started!

1 Like

Update: It works! https://hackaday.io/project/19401-cree-dimming-level

2 Likes

Nice work and great writeup!

1 Like

Thank you! And thanks again for getting me started!

1 Like

Dan,

I’ve now got a working garage door opener prototype. Thanks for the inspiration!

I used Arduino interrupts to get the PWM value and did some fuzzy math to get around the fluctuations. I figure the Arduino has little else to do.

Chris

2 Likes

Thanks to all the contributors. I used one of the Cree modules to directly control a 3V relay (no Arduino needed in this case) so that I can switch some fluorescent tube lights. I used a cut down Amazon kindle USB power supply and a 3V regulator to power it. The whole thing is small enough that I managed to fit it behind the regular light switch in the electrical box and wired it so that it is in between the light switch and the light. That way I can still use the regular light switch to override the relay if I want. Just make sure that you properly insulate everything so that you don’t electrocute someone. I used GE silicone II from Home Depot for that.

Does anyone know how to wire up the Cree light so that it becomes a dumb LED bulb after the module is removed? I was hoping that I could feed 3V to the PWM pin but that didn’t work.

2 Likes

Ogiewon,
This project is way cool!
I wanted to see if the setup can be battery powered as opposed to having to plug in a wall wart to the wall. I know the ESP8266 can be battery powered. I wanted to see if the Cree parts you use can be as well.

I am not sure how much current the Cree Zigbee module consumes. That would determine whether or not it could be run using a battery.

You could obviously use just the Cree Zigbee module all by itself, without the need for an Arduino or ESP8266, which would help to reduce total power usage. However, the original lightbulbs are designed to be powered by 120VAC at all times. I also believe the Cree bulbs are Zigbee repeaters. Usually, battery powered devices are not Zigbee repeaters due to the increased power usage.

You may want to consider using my ST_Anything project which offers a direct LAN connected solution, bypassing the need for Zigbee altogether. It really depends on what your specific requirements are for what would work best.

I wanted to make a z-wave doorbell that can do things like play custom sounds, send pushover notifications, and light up. I want the doorbell to be located at a place that does not have 120VAC power.
My thoughts were to power the cree module via a 3V of batteries and then have the cree module send a high signal to an esp8266 which would be controlled via its own Lithium battery. When the cree module is told to turn on, the esp8266 can be taken out of deep sleep mode and do the work it needs to and then go back to sleep.

So, what role do you see the Cree zigbee module playing? It can only receive data from ST, not send data.

I think you could just use the NodeMCU esp8266 by itself, running a variant of ST_Anything. Others have used deep sleep with an esp8266 successful. The module’s WiFi will take care of bidirectional communications.

Dan,
I was thinking I could use a z-wave button to act as the doorbell button. The Cree zigbee module would listen for the doorbell button being pushed. As it can’t send data on its own, it would act as a relay and in turn talk to an ESP8266 in deep sleep mode and wake it up.

I am hoping that the above would happen without having the Cree module or the ESP8266 connected to 120VAC power. My problem with using an ESP8266 alone is that we need a battery efficient method to listen for events like a doorbell being pushed. Wifi is pretty power hungry and would require 120V AC power.

Why not just wire an ESP8266 directly into the doorbell wiring to get the “wakeup” event? When I say directly, I mean with the proper circuitry to prevent destruction of the ESP8266, of course.

Most US doorbells operate from a small AC transformer. Perhaps you could build an AC to DC circuit to power the ESP8266? This eliminates the need for 120VAC.

Dan,
I think your ESP8266 idea will work well for the doorbell project I was referring to as I have a power source nearby. In my case, the door transformer is behind the doorbell.
I am planning to use this for my backdoor which currently does not have a doorbell.
The plan will be for a z-wave doorbell switch to be engaged and then for me to use a Core piston to call a URL that my ESP8266 will listen to. From there I can activate the door bell using a relay, light up my visual notification and also shoot off a pushover message.

I could use your advice for a another project. I have a dog door that I want to automate. Right now I have a simple dog door that I have to manually open and close.

I do not have any power nearby so it needs to be all battery based. What I was thinking was to power the cree relay via battery. When cree relay gets a command to be opened, it can send a signal to the dog door which can be powered by an esp8266 and a servo that are also battery controlled. I don’t want to use an ESP8266 that is always listening on battery as that can be pretty battery intensive. The idea would be for the cree part of the circuit to do the ‘listening’ work and for the esp8266 to only be turned on for the actual opening and closing of the dog door to conserve the battery of the setup. Thoughts?

Interesting projects! Thanks for sharing the ideas. My biggest concern is just how much power does the Cree module consume? I believe it is a Zigbee repeater, as it is meant to be powered from your house’s AC wiring at all times (at least, when inside the light-bulb!)

If I were you, I’d measure the power usage of the Cree module to make sure it doesn’t drain your battery source in a matter of hours/days, instead of months…

1 Like

Hey Dan, how did you remove the zigbee module from the board? This is my very first project and I have no idea what I’m doing. Lol Also if I wanted to enclose the radio into a lantern that’s battery powered with led candles how would the wiring need to go? I plan on also doing this with candles. Thank you so much!

Heather,

I simply desoldered it from the rest of the Cree bulb assembly. I am not sure you’re going to get good battery life, if that is your plan for powering everything. The Cree Zigbee module is designed for constant power and may drain a battery quickly. I’ve never tried it, so YMMV.

Is there a reason you don’t want to use a ESP8266 module? My ST_Anything project makes adding these to ST pretty easy, and you get bidirectional communication. But, these modules use WiFi which is even more power hungry.

Good luck on your project!

Dan

I’m wanting to control relays just like you did with your awesome project. Is the Arduino sketch functional just the way it is? I’m looking at lines 106- 113 and I’m not understanding what “level == 1?HIGH:LOW)” means? Mostly the question mark and HIGH:LOW is throwing me for a loop. I have some basic experience with Arduino (wrote a sketch for a keypad to control 3 garage doors). I think I can figure out the extra code to make it work how I want, but I have to figure out where to “splice” my output code into yours. I’m looking to modify your sketch so the outputs latch (stay on) until told to turn off. Something like level 5 turns on relay 1 and level 10 turns it off. Likewise, level 15 turns on relay 2 and 20 turns it off. I’m wanting to control lights using the relays.

https://syntaxdb.com/ref/c/ternary

I’m sure you threw away the left over bulbs at this point, but you would need to jumper pin 1 to pin 3, then put another jumper between pin 2 and pin 4. I just tried it and it works fine. The reason for the two jumpers is that the zigbee module provided 3.3v to pin 4 when the light was on, and it also provided the PWM to pin 3 for the brightness (with 0V being 100% and 3.3V being 0%). The 0% 100% thing threw me for a minute as I was expecting positive action not negative. Glad I checked the outputs before desoldering the zigbee board. Also, how did you get the bulb apart without destroying it to the point it can’t be reassembled?

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.