1-wire PWM

Status
Not open for further replies.

Tomasina

Member
I want to make a chain of 20 modules for PWM dimming of 12-volt LED white strips (1 meter each). Since the controller is at a distance of 30-40 m, it is preferable to use a 1-Wire bus.
The master device will be a Teensy or Attiny.
Are there any specialized ICs for this? I'm found only Maxim DS2405/06 ICs, they can work for PWM or not (slow frequency)?
Or may be is it easier to do on each module with Attiny85 & MOSFET?
 
Last edited:
I was reading about CAN bus on Teensy 3.1 for Master/Slave communications the other day and saw it was a differential wire system which gives is great noise immunity and possibly distance I assumed (given that is how RS422 works) - I just looked and you can get 40 meters at a fast 1 Mbit/Sec speed - and if you slow down you can go 1000 meters. This would require a CAN capable device on each end of course. And if you have power for the lights you are almost done, assuming you need the Master to tell the slave what to do?

This shows the BUS topography and distances:
http://digital.ni.com/public.nsf/allkb/D5DD09186EBBFA128625795A000FC025

The 3.1 does still need hardware for the transmit/receive. This 8 pin chip part SN65HVD230D is $2.30 at DigiKey.

https://github.com/teachop/FlexCAN_Library/blob/master/README.md
https://forum.pjrc.com/threads/25101-CAN-Bus-Library-for-Teensy-3-1
 
I'm not sure you need to embrace a 1-wire bus to achieve communications over such short distances. If the cable losses are low enough, you could simply duty cycle the signal at the Teensy using a FET, Darlington transistor, etc. and then send it out to the various strips (if uniform dimming of individual strips is all you are after). That requires a hefty power supply at the Teensy and two wires per node.

If high-speed communications to and from each node is really needed for some reason, I'd try using a simple serial bus at first in conjunction with EasyTransfer addressing / commanding each node. If that fails (and it may!) I'd upgrade to a differential bus like RS485. Paul has a great feature built into Teensyduino that allows the MCU to keep the transmit-enable pin HIGH as long as there is still stuff in the buffer and pulling it LOW once the transmit buffer has been emptied. You'd need two wires for power and GND, plus another two for the differential signal (i.e. 4 total) per node.

CAN-bus is certainly an option as well, but there are a ton of RS485-based solutions out there that lighting control systems like DMX are based on.
 
CAN protocol it is involved for me.
High-speed transmission is not necessary - I'm needed sometimes send to each module command to "soft start" / "glow 100%" / "soft off" command.
I'i've just found this project: http://littlewire.cc/ - low cost & small MCU Attiny85 and library for 1-Wire/I2C/PWM etc. I will try this and be back ;)
 
I'm still failing to see why you can't just PWM the signal going to each light strip using just one Teensy and a single FET or Darlington transistor per strip you are trying to control. Fewer wires, direct control, etc.

But maybe the journey is more important than the end product? :p
 
Here's how you propose:
u1.png

or this:
u2.png

That's how I want to do:
u0.png
 
I2C isn't meant to be used over a 36 meter cable!

For that type of distance, you should really use serial with RS-485 chips to transmit/receive over the long cable. The good news is RS-485 is designed for 1 transmitter to send to many receivers. The standard is up to 32, but "half load" and "quarter load" RS-485 chips (like MAX487) support 64 and 128 receivers.

RS-485 chips automatically handle up to 5 volts of ground difference. Hopefully you won't have such a large change in ground voltage, but with lots of high power LEDs, huge currents in the ground wires do cause problems. RS-485 signals will help.

The RS-485 chips have a pair of pins to enable the transmitter (when high) and receiver (when low). If you only send data in 1 direction, you can just connect those pins high on the controller, and low on all the receivers. If you want to send in both directions, Teensy has Serial1.transmitterEnable(pin) to allow a digital pin to automatically turn the transmitter on when you send. You'll need to create some sort of protocol where each device knows when to transmit, which usually end up being a query-response format where the master sends queries and each slave only transmits a reply right after it's queried.

Anyway, for this sort of project, you almost certainly want to use serial with RS-485 chips.
 
Tomasina, your drawing does not match my description. For example, I never suggested the use of I2C, a standard not meant to cover long distances. 1-wire and I2C are very different animals.

The simplest solution (with the most wires) is to use a common GND wire and a individual wire for each light strip coming from the teensy. The teensy uses a PWM chopper and a Darlington transistor or FET to duty cycle the 12VDC power supply running to the light strip. That in turn allows you to turn on and turn off each light strip with minimal additional circuitry. Depending on your configuration, etc. you might be able to do this with flat cable, for example. All nodes come together on one end, then split off individually at the other end of the cable. Given the distances and number of wires needed, perhaps not the best solution.

The next solution is to use a serial bus in conjunction with one small MCU per light strip to do the PWM. You'd need 4 wires, 2 for power, the other two for the bus. This may or may not work due to signal attenuation, noise, and so on. However, it is likely the cheapest solution with a distributed bus architecture since every MCU out there has a serial port.

However, as Paul and I point out, you are likely going to need RS485 chips to create a true differential signal that is more noise immune, that can cover long distances, and so on. You'd still need 4 wires for your bus, but now you'd also need to add a RS485 chip for each lighting strip (in addition to the MCU there). If you all you do is plan to send signals from the master and never reply back from a slave, you could also consider receiver-only chips on each lighting strip like the MAX3280E.

As I mentioned earlier, there are established lighting protocols out there like DMX that use RS485. You may want to consider studying them and a DMX-capable solution could allow you to add other gear as well.
 
Last edited:
The next solution is to use a serial bus in conjunction with one small MCU per light strip to do the PWM. You'd need 4 wires, 2 for power, the other two for the bus. This may or may not work due to signal attenuation, noise, and so on. However, it is likely the cheapest solution with a distributed bus architecture since every MCU out there has a serial port.
That's why I asked - whether there are ICs for 1-wire protocol with support of PWM output. I know that there are 1-wire discrete keys: DS2405 / DS2408 / DS2413 - I use them to control the relay at a distance of 15 meters. And I like this protocol - its simplicity, reliability and minimum details - only 3 items: IC+MOSFET+Resistor for each point (RS485 require more elements with the same functionality). If there is no such ICs, can I emulate this protocol on Attiny ICs or this is wrong way?

About I2C - sorry that confused, I did not mean specifically I2C, and mean what you need two wires for data transfer.
 
Last edited:
Status
Not open for further replies.
Back
Top