Wireless Fuel Gauge
Up to now, Jane's fuel gauge was driven by an Arduino Uno that is monitoring current via a Shunt in and out of the battery pack. This has worked well but it require a comms wire be run from the boot to the dashboard to power the fuel gauge. Since the fuel gauge had to be isolated from the 12V system to maintain complete isolation of the traction pack from the rest of the car.
This week's project involved replacing the wire with a wireless system. Using two nrf24L01+ 2.4GHz radio boards that cost about $2.00 each, the system now communicates wirelessly from the current monitoring Arduino Uno to the dashboard Arduino Mega.
nrf24L01+ board
These boards communicate over the SPI port on the Arduinos and only need 2 additional digital lines for chip select. Using the RF24 library, it took about 15 minutes to connect these and have a two exchange between the Arduinos. To assure reliable comms, the radios were set to 250 Kbps and maximum output power and retries. The system has no problem communicating from the boot to the dash and these radios have a acknowledgement system, so comms are quite reliable. The dash radio sends a request for data and the battery system send back charge level, current current and time that the system has been charging. Since this is less than 10 bytes, it goes quite fast.
For the dashboard Mega that is also driving a Sainsmart 3.2" color LCD, an SD card, a Touchscreen and the CanBus interface for the Kelly Controller, I ended up adding a softSPI interface since connecting to the standard hardware SPI interface introduced some issues. After a couple of hours of unsuccessful debug, it was easier just to grab 5 unused pins on the Mega and setup the greiman Soft SPI bus. This worked great and did not interfere with the SDCard which is the only other SPI device in the system. Also, Megas are known for noisy 3.3V supplies, so I added a simple LM317 regulator with the appropriate resistors to get a 3.3V supply from the 5V line. The radios run between 1.9V and 3.6V so a precise supply was not critical, just a clean one which was done with a few large caps.
With the battery monitor now is communication with the dashboard computer, a new feature was added to the dashboard computer. By touching the screen, the system will switch to a battery view which shows charge level and current battery current. This will allow for an easy comparison between battery current and motor current. The real test will be comparing the reported power of each which should provide some additional efficiency data. Also, the dashboard computer will now drive both the original fuel gauge and temperature gauge, simplifying the overall system and isolating the battery system from the dashboard.
No comments:
Post a Comment