View Single Post
Old 04-16-2014, 10:02 AM   #26 (permalink)
mechman600
Master EcoModder
 
mechman600's Avatar
 
Join Date: Jul 2008
Location: Langley, BC
Posts: 1,227

Fusion - '16 Ford Fusion Hybrid SE
Thanks: 190
Thanked 273 Times in 167 Posts
I started figuring out I2C communication between Arduino boards. I soon learned that it is not a good solution for our purposes here:
1) It robs two analog pins per board
2) It can only send one byte at a time

I quickly set out to invent my own comm protocol. I set up two wires, one for Reader to send messages to Sender, and one for Sender to send messages to Reader. Using the analogWrite() function to send and pulseIn() to read, I successfully made a system that works.

Basically, the Reader sends a message at a specific duty cycle, waits a moment and then measures what the Sender has sent back. It then sends a different duty cycle and then reads again. The Sender responds to each duty cycle instruction and sends info back as a duty cycle that the Reader can measure.

I will attach code and maybe a video later. I'm excited that I figured this out.
  Reply With Quote