So a bit of background:
I have a RPI which does some nice things and is connected to a MQTT broker to control stuff (currently just the sense-hat LED colour) via a custom webpage on the RPI. This webpage can be accessed by my smartphone worldwide. Now I recently graduated from college and I have tons of time. It's too cold and dark here after 6pm to do anything outside for now. So I focussed on doing thing in house.
Now I want to control my roller curtains with the website. I have no troubles programming everything except one thing which I though would be the easiest. Which communication protocol to use?
The setup is as follows:
4x arduino Nano with stepper motors and drivers
1x Raspberry Pi
Some ethernet cable and some ethernet breakout boards so I can connect everything (not wireless)
Things I checked:
Serial is not working because is don't supports master-slave configuration (is that actually true?)
i2C is not going to work because the cable length is more than 5 meters and the speed is quite high.
1-wire would work, but I can't find any way of writing to this network on the RPI. Is seems to mainly read some temperature sensor....
for SPI I would need multiple enable pins, I do have those (ethernet wire has 8 cables but i'm also planning on powering everything trough this cable, leaving almost no wires left for expansion etc).
I could use Wifi, but I would like to hard wire everything.
Also though of my own bit sending protocol (I don't need speed after all) but that could be a nightmare to debug...
My backup is using CANbus, I am a automotive engineer after all. But this would need some extra hardware which I don't like.
Ideal would be: A low speed serial master slave configuration. Is this somehow possible? Not looking for speed at all....
If you are just talking about wired communication between the RPi and the 4 Nanos then I reckon serial should work fine, but you have not stated the distances. For longer distances you could use RS485 or (as you seem familiar with it) CANBUS.
You can connect several serial devices in parallel if you use a diode for each of "slave" to isolate its Tx HIGH signal from the master and use an external pullup resistor on the master's Rx pin. That way the slaves can pull the master's Rx pin LOW but can't drive it HIGH.
After that you need to organize your messages so that the slaves can identify what is meant for them and so that they only speak when requested.
Robin2:
If you are just talking about wired communication between the RPi and the 4 Nanos then I reckon serial should work fine, but you have not stated the distances. For longer distances you could use RS485 or (as you seem familiar with it) CANBUS.
You can connect several serial devices in parallel if you use a diode for each of "slave" to isolate its Tx HIGH signal from the master and use an external pullup resistor on the master's Rx pin. That way the slaves can pull the master's Rx pin LOW but can't drive it HIGH.
After that you need to organize your messages so that the slaves can identify what is meant for them and so that they only speak when requested.
...R
Ok. sounds good. That looks what I need. I will get my breadboard out and test some things. Thanks.
I only use ethernet hardware for "easy cable routing". If I want to connect to an actual network that would require extra hardware? With the ethernet cable I can supply power, communications and I still have some pins left for expansion.
I only use ethernet hardware for "easy cable routing". If I want to connect to an actual network that would require extra hardware? With the ethernet cable I can supply power, communications and I still have some pins left for expansion.
So you don't have Ethernet breakouts but simply RJ-45 breakouts (no Ethernet hardware at all). In that case you would need extra hardware. If you have Ethernet breakouts (with actual Ethernet hardware on it) all you'd need in addition is a small switch for a few bucks.
pylon:
So you don't have Ethernet breakouts but simply RJ-45 breakouts (no Ethernet hardware at all). In that case you would need extra hardware. If you have Ethernet breakouts (with actual Ethernet hardware on it) all you'd need in addition is a small switch for a few bucks.
I have the impression the OP is just using the ethernet cable as a convenient source of wire for a serial connection.