Electronics > Projects, Designs, and Technical Stuff
configure jumpers at a distance?!
k8943:
Consider a network (CAN) of devices connected in a star formation from a main board, with multiple devices on each arm of the star. Currently each device is “told” which arm it is on using on-board jumpers or switches. Everything is cabled up using 4-core wire to RJ12 (6 pins) board connectors .
Like the idea of being able to configure boards at a distance such that a device could be swapped from one arm to another - or a new device brought in - and it would automatically “know” which arm it was on and adopt the appropriate behaviours. How about if use 6-core cables in the RJ12 connectors? In addition to GND, +24v, CAN_H, CAN_L there will be CONFIG1, CONFIG2. On each arm of the star, CONFIG1 could carry a different voltage (set by resistor bridges adjacent to connectors on the main board). 6 arms could be represented as 0, 1, 2, 3, 4, 5v respectively. Any given device would use it’s microcontroller ADC to read the voltage on CONFIG1, (comparing with it’s internal voltage reference) and then the device would self-configure accordingly. In order to ensure that there is never a voltage present on the ADC before the microcontroller has powered up, presumably the config-input should be separated with a MOSFET that turns on only after the device has powered up.
QUESTION: is this going to work reliably? Will voltages transmit reliably over the network and, if so, what level of granularity (6 levels over 5v, or more, or less) would be reasonable? Will there be some kind of EMF interference (a device turning on nearby) such that desirable to take average over time? Or is there just a much better way of doing this? All feedback appreciated!
Siwastaja:
Of course this works, a cheap microcontroller ADC has typically some 8 to 11 bits of linear ENOB and the internal reference is typically specified something like +/- 2% or better. For the divider, 1% resistors are cheap and easily available.
From this, we can see you can easily fit like 4-5 bits of information in the analog level, and afford some illegal dead zones between each two adjacent levels, allowing rudimentary error checking. So I wouldn't hesitate doing this up to some 16 addresses.
Being DC, assuming you can allow longish (milliseconds) time for address enumeration step, noise and EMI is non-concern. Just put a 1uF ceramic right between the ADC input and ground, and use some hundreds to thousands of ohms of series resistance and call it a day. Let the signal level stabilize after you are sure whatever is powering the resistor divider, then wait for like 10*R*C before sampling.
Large enough series resistance also limits the current going through the clamp diodes of the ADC input pin to avoid damaging (or inadvertent parasitic power-up of) the MCU rendering extra isolation switch you are discussing unnecessary. Because you only need one sample, even a large resistance (as long as it is orders of magnitude below DC leakages, i.e., don't go over hundreds kOhm) is not a problem for the ADC which can sample from the added capacitor directly.
However, usually this isn't done for the purpose you are discussing. Whenever you have a communication bus - CAN in this case - available, there almost always is some clever way to communicate address enumeration through that bus before starting actual communication, saving extra hardware or wiring. Think about it.
k8943:
Many thanks.
How to do purely over the network? Hmm, if there was some kind of switch at the CAN_H (for example) of each RJ12 on the main board, could disable all but one of the arms of the star, then send a message of the form "if you are receiving this then you're on arm number 3". Then proceed to the next RJ12/arm of star. Each device would require nothing in hardware and could stick with 4-core wiring. All components would be on the main board. Would need a way to launch the procedure in the case a device is added to or moved on the network (or just restart).
NiHaoMike:
Use a voltage divider so the config pins would be set by resistors to 24V.
ejeffrey:
Lots of ways to skin this cat.
A 4..20 mA current loop would be more noise resistant, but more expensive and power hungry and probably not needed here.
If you have a spare dedicated wire for this, you could also use digital communication over that wire. Of course then the question is why use a shared bus for the primary communication?
You can also use the aux wire as an address override. Drive the auxillary wire high to enable programming the address.
If you have control over the cable you could build the jumpers / voltage divider at the remote end of the cable or inside the connector body. That would avoid long wires, emi, ground shift and loops.
If the microcontroller has a unique ID built in (many do) you should be able to define an in band enumeration protocol to find new devices and assign them a bus local address.
If the root node can be a little more complex give it the ability to switch on and off each spoke. Then at startup enable each spoke one at a time to program it's address with a broadcast address before enabling the whole bus.
Navigation
[0] Message Index
[#] Next page
Go to full version