jostlowe / Pico-DMX

A library for inputting and outputting the DMX512-A lighting control protocol from a Raspberry Pi Pico
BSD 3-Clause "New" or "Revised" License
176 stars 20 forks source link

Sample Wiring #36

Open red4dj opened 1 year ago

red4dj commented 1 year ago

Could simple wiring diagrams be provided for those of us with a software background and not a hardware one? I would appreciate them as a guideline for your examples (input & 8 parallel output) and using them with MAX485 modules.

sonnny commented 1 year ago

@red4dj see my youtube demo link below, source in the description

youtube demo

jostlowe commented 1 year ago

I'll see what i can whip up :)

blockiyt commented 1 year ago

Anything new?

jostlowe commented 1 year ago

Unfortunately, no :(

My PhD thesis is due soon, so i will likely not be making any contributions in the near future

nsc-de commented 1 year ago

For anyone still searching for answers on this topic: Here are two sample wirings for a common breakout module and the pi pico. The wiring should basically ve identical for other micro controllers. image image

6by9 commented 1 year ago

@nsc-de Nice diagrams, but a couple of comments.

The Pico runs on 3.3V, but the standard MAX485 is a 5V device. You want to be using a MAX3485 when running on 3V3. Other microcontrollers may be running on 5V, and there a MAX485 would be suitable.

Secondly your Receive DMX diagram shows GPIO1 being connected to DI. I think you meant to connect it to RO (Receiver Out) for receiving data.

nsc-de commented 1 year ago

Most max485 breakouts did work fine for me with 3.3V, but yeah, this may be a problem (and also for long range data transmission or if you have a couple of devices connected it is better practice to use the 5V instead of 3.3V). Instead of using another microcontroller you can use a transistor or stepup converter like this. This is quite a simple component to use, but it makes the diagram seem more complicated image

You are right, tbh i just forgot to update the this part of the diagram while copy-pasting. I updated it in my first comment, its now correct.

jostlowe commented 1 year ago

An ordinary MAX485 breakout should work fine when the VCC pin of the MAX is connected to the V_BUS pin on the Pico without a level converter. This is for two reasons:

6by9 commented 1 year ago

An ordinary MAX485 breakout should work fine when the VCC pin of the MAX is connected to the V_BUS pin on the Pico without a level converter. This is for two reasons:

* If i remember correctly: The MAX485 reads anything over 2.2V as a logic high. The 3.3V gpio on the pico is sufficient to produce a logic high.

I must admit to not having checked that one, but you appear to be right that VIH is min 2V for DE, DI, and nRE according to the datasheet

* The GPIO of the Pico is 5V-resistant. Any incoming data from the MAX to the Pico will have a 5V voltage level, but the GPIO is built to handle these voltage levels.

Officially it is not (I've just checked with colleagues here at Pi Towers). Datasheet section 5.5.3 IOVDD: max 3.63V. Input Voltage High @ IOVDD=3.3V: max IOVDD + 0.3, which will be max 3.93V.

Unofficially, it will stress the GPIOs rather than immediately latch up or fail, but it can't be recommended.

jostlowe commented 1 year ago

Oops! Looks like you're right. It is not 5V tolerant. I may have mixed it up with another chip.

Nice catch!

SutliffeProductions commented 1 year ago

On the plus side, logic level shifters are cheap and easy to source. Which is convenient. There are 3.3v rs485 modules out there, but I've not managed to get any of them to receive dmx yet... Probably my fault somewhere

6by9 commented 1 year ago

On the plus side, logic level shifters are cheap and easy to source. Which is convenient. There are 3.3v rs485 modules out there, but I've not managed to get any of them to receive dmx yet... Probably my fault somewhere

Strange as there isn't much to get wrong as long as nRE and DE are pulled low as @nsc-de shows in his diagrams. I'll have to give mine a go for receive (https://www.amazon.co.uk/DollaTek-module-SP3485-communication-Breakout/dp/B099DNYC3H). Although with jostlowe's observation that the MAX485 has a VIH of 2V you don't need a level shifter for TX, and a simple potential divider would do for RX.

SutliffeProductions commented 1 year ago

On the plus side, logic level shifters are cheap and easy to source. Which is convenient. There are 3.3v rs485 modules out there, but I've not managed to get any of them to receive dmx yet... Probably my fault somewhere

Strange as there isn't much to get wrong as long as nRE and DE are pulled low as @nsc-de shows in his diagrams. I'll have to give mine a go for receive (https://www.amazon.co.uk/DollaTek-module-SP3485-communication-Breakout/dp/B099DNYC3H). Although with jostlowe's observation that the MAX485 has a VIH of 2V you don't need a level shifter for TX, and a simple potential divider would do for RX.

Ahh yeah, the modules I've been using are automatic switching so I shouldn't have to pull any pins high or low supposedly. (From what I can tell, as there are no pins other than the gnd, vcc and tx and rx

6by9 commented 1 year ago

Ahh yeah, the modules I've been using are automatic switching so I shouldn't have to pull any pins high or low supposedly. (From what I can tell, as there are no pins other than the gnd, vcc and tx and rx

Good luck with those. From days of using Westermo MA-44 RS232 to RS485 transceivers, you generally have to tell them the baud rate you're using. They then have a monostable that holds the transmitter active for the configured delay after the last edge in the data. How you do it without any configuration is an interesting concept, and may be relying on the line bias.

Then again if you're only receiving that should be their default state.

SutliffeProductions commented 1 year ago

Ahh yeah, the modules I've been using are automatic switching so I shouldn't have to pull any pins high or low supposedly. (From what I can tell, as there are no pins other than the gnd, vcc and tx and rx

Good luck with those. From days of using Westermo MA-44 RS232 to RS485 transceivers, you generally have to tell them the baud rate you're using. They then have a monostable that holds the transmitter active for the configured delay after the last edge in the data. How you do it without any configuration is an interesting concept, and may be relying on the line bias.

Then again if you're only receiving that should be their default state.

Yeah they've been a pain in the ass so far. Will send dmx just fine, no issues. But they just refuse to receive it, and I don't really want to have to do some weird serial stuff, but I fear I might have to learn