EEVblog Electronics Community Forum
Electronics => Beginners => Topic started by: anvoice on March 27, 2018, 12:17:01 am
-
I have a circuit I'd like to control with either an external controller or a PC. I'm guessing the cable length might be as much as half a meter or so, possibly a bit longer. I2C seemed like the simplest option until I started reading about the length/speed tradeoffs, and I don't know right now whether that is the right way to go.
There may be multiple instances of the circuit connected to the master device, so I need some form of addressing, preferably not involving chip select as that could take too many pins. I'm currently reading about RS422/RS485 which appears to be a robust protocol, but I'd need to set up a converter to interface with the uC (SAMD21), and also the master will need a way to implement the same RS485 so if it's another uC it'll need an adapter of its own.
Is there a recommended way for doing this? Perhaps some sources of information that I've missed on other standards that could be more suitable? Thanks for reading.
-
Half a meter is not a problem. Just go with I2C and reduce the speed if you start having problems.
Or use SPI without SS.
-
SPI without chip select? How do you distinguish between slave devices then?
I'm basically thinking this device might see use beyond my home someday, and then I'd like a fairly robust communication protocol that's reasonably fast. I2C would be perfect for its simplicity and compatibility with MCUs as well as adaptability to PCs, but the only example of something related to a servo using the I2C protocol I could find was this: https://www.adafruit.com/product/815 (https://www.adafruit.com/product/815)
-
SPI without chip select? How do you distinguish between slave devices then?
Missed the part about multiple devices. Just go with I2C, don't overthink it.
-
Believe me I don't want to overthink it. :) Just trying to think ahead a little. I'm all for I2C being enough.
-
websockets over wifi with esp8266 ?
-
websockets over wifi with esp8266 ?
But there will need to be power wires going to the device anyway, so might as well route a mechanical comm connection. Adding an esp8266 will complicate the design and increase cost, which isn't great if I later decide to make say 100 of these. Plus, then the controlling unit (for example a microcontroller) will also need wifi capability.
-
What about 1-Wire protocol:
https://www.maximintegrated.com/en/app-notes/index.mvp/id/1796 (https://www.maximintegrated.com/en/app-notes/index.mvp/id/1796)
DC1MC
-
What about 1-Wire protocol:
It is still subject to the same problems as I2C. But yes, you will save one wire.
-
CANBUS wouldn't be a crazy choice either
-
What about 1-Wire protocol:
https://www.maximintegrated.com/en/app-notes/index.mvp/id/1796 (https://www.maximintegrated.com/en/app-notes/index.mvp/id/1796)
DC1MC
But then I'd have to use a different chip than the SAMD21E I'm designing around now? I'll give that a read though.
CANBUS wouldn't be a crazy choice either
While I'm reading up on that, would you mind throwing in some advantages/downsides? I believe I'll need interface circuitry if I were to use that, but how is it superior to I2C?
-
But then I'd have to use a different chip than the SAMD21E I'm designing around now? I'll give that a read though.
Any MCU can bit-bang 1W, it is not that hard.
While I'm reading up on that, would you mind throwing in some advantages/downsides? I believe I'll need interface circuitry if I were to use that, but how is it superior to I2C?
It is explicitly designed for extremely noisy conditions, but it will add to the cost considerably.
If you were doing 10 meters of wires or something like that, you would have to go with CAN or similar. But for half a meter, you are overthinking it.