Sunday, November 18, 2012

Wireless fun

As my attempts at starting the heater have failed again and again, I needed to get my mind off for a while and decided to concentrate on prototyping the wireless connection and CAN controller. ELM327 is too cumbersome to be used as a permanent installation and frankly, I'm not too fond of the AT command interface that it uses. I ordered few things online and now it's time to put them into use:
  • 2 XBee modules (XB24-ASI-001 & XB24-AWI-001)
  • Wireless SD shield for easy XBee prototyping
  • XBee USB Explorer for transparent testing with terminal emulator
  • Arduino CAN shield
  • 2 MCP2515 CAN controller chips and 2 MCP2551 CAN transceiver
The CAN controller and transceiver chips are identical to those in Arduino CAN shield, so after prototyping with Arduino and aforementioned shields, it's easy to design and build a PCB from those same components.

After some weekend hacking, I managed to build a CAN network consisting of ELM327 and Arduino CAN modules with XBee modules routing the CAN traffic and commands quite transparently.


Here's some early XBee module testing. 


Here's the CAN network: On the left, Arduino with CAN shield and on the right, ELM327. The network is terminated with two 56 ohm resistors to minimize signal reflection. It might work without them, but I added them just in case.
Here we are sending one message with Xbee module to the Arduino. The XBee USB Explorer allows hassle-free connection with any terminal emulation software. Here we use Minicom.
Message is received via XBee module and sent through CAN bus using the CAN shield (topmost shield). The antenna used here from old wireless ADSL router. Seems to work quite fine anyway.

Finally the message is received with ELM327 in a "monitor all" mode. The communication works also backwards: A message sent with ELM327 is received on the CAN controller on Arduino, and sent via XBee to the other laptop.





Here we can see beautiful symmetrical CAN signaling on the oscilloscope :)

I also tested the power consumption of various shields and modules with 12V input power (using HP 6632B lab power supply).
  • Arduino: 52 mA
  • Wireless SD shield + XBee module: 55 mA
  • CAN shield: 6 mA
  • LCD: 27 mA (with backlight), 10 mA (without backlight)
  • Total: 140 mA
As you can see, there's quite a lot of optimization to be done. The 7805 power regulator has some overhead that can be minimized with smarter power supply. Arduino can be put to sleep mode, to be awoken with a signal from either XBee or CAN module, but at minimum, we are talking about 60-70 mA consumption at idle. With my 95 Ah car battery, it would take around (95 Ah/2) / 0.07 A = 678 hours =  28 days for the battery to be depleted to half charge. Not bad, but still potentially harmful, since this device is not the only machine in the car using battery.


2 comments:

  1. Hi

    Thanks for your post.

    I am working on something similar. I want to send the CAN messages wirelessly using LoRa to another CAN BUS connected to the receiver LoRa. I am using a multiprotocol shield to connect the CAN Bus and LoRa for each Module.

    Do you have an ideal how can I get the message from the CAN bus to the LoRa for transmittion using the SPI.

    Thanks in anticipation of your response.
    Akpo

    ReplyDelete