hello to this awesome community.
let me first say im still learning this stuff so i find hard to explain what i want to do, but i will appreciate any help guiding me in the right direction.
so here is my project:
I want to have several circuits in different boxes that can connect and communicate in a basic form.
the first box has voltage source let's say a 9v battery and also an arduino board, lat's call it the "master box".
the other boxes (let's call them slave boxes) get their power from the master box and also has an led, the closer the slave boxes are to the master box, the brighter the led.
here is a simple sketch i made (excuse my lack of skill):
so far it's simple but keep in mind that these boxes can be interchangeable.
so if i replace box E with box A, box E will get a value of #1 (because it's closest to the source) and box A will get the value of #5.
Now let's say we add another voltage source:
as you can see the slave boxes get their value from the master box and the smaller value (ie the closer to master) get's override by the higher value (the farther from another master).
so by introducing another source, box D got it's value overridden to #2, box C remains #3 because it's sits in the middle between both masters.
what i have so far:
so my idea is to put an arduino in each box and use PWM to communicate between the boxes.
so the master will output 255 and box A will take that and subtract an amount (let's say 10) and will output 245 and so on.
if another pin will show a higher value, it will override and the output will be the higher value minus 10.
Why PWM?
good question, as i said im still learning this stuff, and i have no idea how else to do it.
i looked into I2C, and as i understand you communicate by addresses, but in this case the state of each component is determined by it's location relative to the source.
also each box need to have up to 4 potential inputs or outputs (one from each side).
My Concerns
1. can be expansive: arduino's aren't cheap, and if i will make many boxes it can get costly fast.
2. unreliable: im not sure how well pwm will work for communicating between many arduinos passing on the data down the chain, could be jittery, i didn't tried it yet.
3. I have a feeling there is simpler solution to this but im still too novice to find it.
4. i want to make (at least) the slave boxes discrete logic so i can learn it better, arduino is easy but i don't feel like im learning the real basics.
i think it can also be done with a 555 timer, either by varying the frequency ( farther = slower ) or with (again) PWM.
i just want to add that it's not about dimming the led's so resistance is not the answer, i need to pass a signal (preferably digital) between the component's and the data need to be accurate enough to be converted for other stuff.
so what you guys think?