Communicate between microcontrollers: Automatic address and request-less send?
hi everybody,
i have question wire i2c library.
i want communicate unknown number of buttons. every button connected microcontroller (i think can use attiny part). every button has own housing leds. every housing has 1 cable 4 wires , male connector. every housing has female connector daisy chain button housings each other.
there's 1 master controller box first button connector goes into. so, every button has ground, 5v , 2 data lines.
now master controller box wants know if there's button pressed. master controller box needs poll every button-controller address ask if button pressed? or there way button-controller can send master button pressed without being asked master? (very fast response after button press important)
follow question: don't know number of button's user has daisy chained up. how new hooked button gets automatically own unique address , let master controller know it's available (without setting dip switches)? 1 thing can think of give every button-controller address 127. controller polls if address 127 available, , if so, controller gives button-controller new address. won't work if multiple buttons connected @ same time, or if master controll box enabled after connection has been made.
maybe disconnect pass-trough dataline transistor , connect after button-controller has received new adress?
another option thought of use serial communication communicate each other. rx connected tx of other controller , on. master rx connected last tx button controller in chain. , every button-controller needs re-transmit received serial data. if button-controller has itself, injects own serial data in stream. 1 disadvantage need "terminate" or short data wire's on last button connector otherwise loop open.
any ideas?
i have question wire i2c library.
i want communicate unknown number of buttons. every button connected microcontroller (i think can use attiny part). every button has own housing leds. every housing has 1 cable 4 wires , male connector. every housing has female connector daisy chain button housings each other.
there's 1 master controller box first button connector goes into. so, every button has ground, 5v , 2 data lines.
now master controller box wants know if there's button pressed. master controller box needs poll every button-controller address ask if button pressed? or there way button-controller can send master button pressed without being asked master? (very fast response after button press important)
follow question: don't know number of button's user has daisy chained up. how new hooked button gets automatically own unique address , let master controller know it's available (without setting dip switches)? 1 thing can think of give every button-controller address 127. controller polls if address 127 available, , if so, controller gives button-controller new address. won't work if multiple buttons connected @ same time, or if master controll box enabled after connection has been made.

maybe disconnect pass-trough dataline transistor , connect after button-controller has received new adress?
another option thought of use serial communication communicate each other. rx connected tx of other controller , on. master rx connected last tx button controller in chain. , every button-controller needs re-transmit received serial data. if button-controller has itself, injects own serial data in stream. 1 disadvantage need "terminate" or short data wire's on last button connector otherwise loop open.
any ideas?
quote
another option thought of use serial communication communicate each other. rx connected tx of other controller , on.
that approach, assume happy use serial rather i2c.
the down side determining order in buttons pressed, example if button on node 2 pressed before 1 on node 22 master still see press 22 first.
is problem application? if it's game first button pressed wins maybe.
as addresses, can have simple self-discovery algorithm sends 0 first node, records it's address, increments number , passes along. when number returns nodes have unique address , know how many there are.
also distance between these boxes, i2c not long runs.
______
rob
Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Communicate between microcontrollers: Automatic address and request-less send?
arduino
Comments
Post a Comment