I’m working on a project which will involve plug & play components. For example, the Core needs to be able to detect if a connected component is a servo or a motor.
In this example I presume the motor and servo would need to be part of their own circuits, with an extra component to identify them. Does anyone have examples of this being done elsewhere with the Core or Arduino?
You could have a “sense” or “id” pin with a certain resistor value on that. A 1k resistor is a motor, a 2k is a server, etc. This method eats up analog input however
Or, and this is obviously more expensive, you could make each plug and play item “smart”. So, a servo would be a servo + a small micro (ATINY?) which you communicate with over I2C. To determine what’s up you just need to query the I2C bus (see http://playground.arduino.cc/Main/I2cScanner for example). That would be cool and would only ever tie up the I2C lines, power, and gnd
The second approach sounds most sensible. The number of possible components is likely to expand beyond just motors and servos, so I don’t want to be limited by the number of resistor types. I’ll have a look at I2C. Would it be possible to make this work with multiple items connected at one time though?
Another challenge is how I power each item correctly, given they’ll have different requirements.
You could have a spec for 5 wires: GND, 3.3V, 5V, I2C, I2C. That should satisfy most power requirements.
A cool idea. Let me know if you want some help with it. I’d be happy to provide some firmware help once you decide on a slave IC. I’ve got a couple of ATTINY45s here if you decide to go that route I could help
@harrisonhjones, when @timb was here we discussed using an MPS430 processor on ALL shields he was designing. It was to use I2C to communicate with the Core and create “smart” shields (like the ATINY you propose). He was planning one on his power shield. Though smart shields cost a little more, they defer processing away from the Core. One idea was an SD and/or FRAM shield that did all the FAT processing for example.
That sounds awesome. I honestly wish that’s how all shields (Arduino included) worked. It would be harder for new comers wanting to learn electronics perhaps but it would make prototyping so easy
I got some ATtiny85s, and a Sparkfun Tiny AVR Programmer, but can’t seem to get the communication working. I’m using the Spark as the master, to request data from the slave ATtiny85. That could then return an ID that identified this component.
Below is the code. The Spark uses the Wire library, and the ATtiny85 uses TinyWireS.
Do you think this is good approach, and can you see what might be wrong? If I try logging from the ATtiny85 it works fine, so I think the circuit is correct.
@tw_uk, which TinyWireS library are you using? The standard Arduino TinyWireS library does not have “onRequest”.
I tested your code with an Arduino Pro Mini and the Wire library and it worked fine. I need to know which ATtiny library you are using so I can test with an ATtiny85
Hey @peekay123 thanks for answering @tw_uk’s question. I was out of town this weekend. I’m looking forward to trying my hand at the same code. Ghetto open servo maybe?