I am currently working on a project for my studies, for which I am trying to make a very simplified programming board/toolkit, that children can use to built and 'program' simple electronic devices (mainly focusing on sensors and actuators).
To achieve this, I want to be able to automatically recognize components attached to the programming board (=arduino), so that it already knows if an input or output component is connected. - In case of input, it should then further identify if it's for instance a sensor/pot with ranged input, or a button/switch with on and off states. - In case of output, it should then further identify if it's for instance a servo, LED, buzzer etc.
To program the recognized components, children can then use a graphical interface, that shows the components that they connected and has a some options for interpreting and using the input data, to control output components.
If they for instance hookup a pot-meter and a servo. The GUI will show input=pot-meter with a dial showing the current pot-value and also output=servo with a dial for the current degree state it's in. In the GUI they can then select
- for instance to map the input data from the pot-meter, to a range of degrees to write to the servo
- Or another option would be to set a treshold and write a specific degree to the servo, once the pot-meter has reach said threshold.
Of course more programming options would be possible and desirable, but this is what I at least want to achieve.
To make the recognition of components possible, I am currently experimenting with the 1-wire DS2401 chips and have a sketch working, that reads and prints the 8-Bit Family Code +48-Bit Serial Number + 8-Bit CRC Tester. However I do not understand, how I can/should connect a component to the DS2401, while still being able to receive and write data from/to that component.
Can I just connect the data pin of a component (e.g. a sensor) to the data pin of the DS2401 and then to a digital pin on the arduino, to then receive both the ID Serial as the sensor data?
Or is that simply not possible and do I need 2 digital pins per component, one for reading from/writing to the component and one for identifying the DS2401 serial number?