I2C – Neil's Log Book https://nrqm.ca What could possibly go wrong? Fri, 24 Jun 2011 21:24:20 +0000 en-US hourly 1 https://wordpress.org/?v=5.4.1 Poor man’s IrDA for intermodular communication https://nrqm.ca/2011/06/poor-mans-irda-for-intermodular-communication/ Fri, 24 Jun 2011 21:15:56 +0000 https://nrqm.ca/?p=614 If all goes extraordinarily well, the AUV will have the following modules sitting in the hull:

  • Acoustic modem
  • Motor control
  • Depth control (buoyancy control and pressure sensing)
  • Master controller

Rather than wiring everything together, I plan to give each module its own power supply and use an optical communication protocol to connect the modules to the master controller.  The inside of the hull will be cleaner and more solid than if everything was wired together, and waterproofing will be easier.  Here’s how it works:

I’m thinking about the depth controller at the moment, so take that as an example.  The master controller wants to send a depth set point to the depth controller.  In my current design, such as it is, the master controller sends a signal to a high-power infrared emitter via a transistor.  This could be e.g. a UART signal (inverted to be active high).  The infrared emitter lights up the inside of the hull with the signal sent by the master controller.  Everything receives this signal, so the frame will be addressed to the depth controller.  The infrared signal is transduced back to a TTL UART signal using an optical transistor and a pull-up resistor or filter, and the UART signal is fed to the depth controller’s UART receiver.  The depth controller transmits its detected depth back to the controller in a similar manner.  This is a very simple non-modulated (baseband) infrared communication protocol.

I can foresee several issues that demand exploration:

  • The emitter isn’t strong enough: I hope this won’t be an issue in a small, enclosed, dark sphere, but I might be able to arrange all the modules so that the IR components have line of sight.
  • Infrared absorption and reflection: the module casings will need to be transparent to infrared.  I currently plan to have most or all of the casings be made out of clear acrylic, and I will need to test the infrared transmission through air, acrylic and water.
  • Data rate: the two kinds of optotransistors I bought have rise/fall times of 10 and 15 microseconds, leading to a theoretical maximum throughput of 33 to 50 kbps.  I don’t need high-bandwidth communications though, so the data rate can be lowered easily to reduce interference.
  • Grim shadows: I am not designing the AUV to be sea-worthy, in part so I don’t have to deal with crud building up and blocking the optical signal.  The module casings should stay clean, and with only a couple wires inside the hull this is unlikely to be a problem.
  • Collisions: The master controller will initiate all communications, and all communications will be synchronous.  This is effectively a one-wire bus protocol, kind of like I2C with an asynchronous clock.
  • Other UART errors: Specifically framing errors.  Likely each module will have a crystal.  Even without a crystal, so few data will be transmitted at a time that framing errors should not be a problem, but I will probably keep a sanity check on the UART’s frame error detect bit just in case.

My original idea associated each module with a colour instead of an address, so a module would only receive data transmitted on the correct wavelength.  As a friend once said to me, “Rube Goldberg would be proud.”

]]>