Open Source On-Board Vehicle Monitoring and Control
Updated: 4 January 2022
During late-Summer 2021 we decided that it was time to start thinking about camping again. For months we had been wrestling with buying a trailer (shout out to TurtleBack Trailers as our final choice), sticking with our current RTT (Roof Top Tent) mounted on a bed rack, installed on our 2015 Gen 2 Tacoma Off-Road pickup, or going a completely different route. We walked our options for a few months and considered factors like how often we’d be camping, whether we were willing to take on monthly storage fees for a trailer (or chew up a big chunk of garage space), how many seasons we’d be likely to camp… We decided that we’d probably be best served, at least for now, by dropping a cap on the bed of the truck, sticking with our current RTT (a ruggedized Tepui Autana IV), and using my daily driver as our camping rig. We’d like to have enough “off-grid” resource to be able to regularly camp fairly far away from civilization for at least a week, and this implied some kind of power subsystem. I’m also an Amateur Radio Enthusiast (Extra Class), and having power available to support radio use, is a really good thing. We’ve also been concerned, since we moved to Colorado, that we might have to evacuate at some point. We’re not “preppers”, by any stretch, but occasionally, large chunks of Colorado catch on fire. We’d like to have sufficient resource to be able to evacuate ourselves and our cats to a safe distance if necessary without having to rely on infrastructure. How to control/manage power… Well… I could drop about 4,000+ dollars on a commercial solution, which ends up meeting most of my needs, but… I’m an Electrical Engineer. Thus begins my journey to build an complete OSHW (Open Source Hardware) focused implementation that is more flexible and maybe a little less expensive than things like and “S-Pod” or “SwitchPro” controller.
Overview
The VMaCS system consists of two modules. The Remote Module design is described here. The Control Module can be any WiFi connected device that supports MQTT. While the VMaCS design is focused on supporting vehicle management and control applications, the design could easily be adapted to support, for example, control of a home brewery or more general home automation management chores. If there is any eventual interest, I may make this design available in either kit form or finished form. There will, by necessity, be a fair amount of SMT soldering involved in construction, so a kit would be pretty advanced.
For vehicle applications, I am stunned by both the cost and lack of flexibility of existing off-the-shelf solutions. I could find lots of little black boxes, most for more than $1000.00, that would control between six and eight 12V relays. For my $1,000.00, I’d end up running wire all over my truck to transport relay switched power. The rest of the world has been distributing things like this for about a decade. As an EE, I see no reason that “control wiring” can’t be replaced with WiFi. Running six 12V power rails to the bed of my truck to support individually switched power is ridiculous. I should be able to run one rail and switch it locally. As well, if I want to monitor current on one or more of those rails, I should be able to do this. The same goes for temperature, random switch states, various data interfaces, etc. i should be able to interface with a local DC-to-DC charger (Renogy products have an RS-485 interface. I’m not sure why REDARC’s products are so ridiculously under-specified).
Features
CPU
I’ve chosen a Microchip SAM D21 Low-Power 32-bit ARM Cortex-M0+ Microcontroller (ATSAM21G18 in a QFP Package).
- 256 KB of on-chip Flash
- 32 kB of on-chip SRAM
- 32-bit Real Time Counter (with Clock/Calendar functionality)
- A Watchdog Timer
- A Built-In USB 2.0 Interface
- Up to six SERCOM (Serial Communication) Interfaces that can be configured as a USART, SPI, I2C, and a Lin client.
- A 12-bit 350 ksps ADC with up to 20 muxed channels (both single ended and differential)
- Up to 52 programmable I/O pins
- Various really fantastic low-power features
The prototype implementation is using an Adafruit Feather.M0 with an onboard WINC1500 WiFi module. The next generation will roll the microcontroller onto the main board.
External I/O
Relay Drivers
The Remote Module will support a minimum of 16 relay driver channels. The relay driver being considered is the TI DRV8860 (in a PWP package). Each driver channel will source a maximum of 330 mA at +12V. The DRV8860 provide a number of fault protection and diagnosis features. The interface will be via SPI.
RS-232
I’m including a two-wire RS-232 interface to support extending control to the cab via a hard interface (vs. the current plan to use WiFi). It’s also nice to have an external serial interface that can be easily adapted to support USB if needed. I’ll likely be terminating the TTL level UART as well.
RS-422
I’m buying a Renogy Lithium-Phosphate auxialiary battery. Their batteries include a handy RS-422 interface for monitoring battery status.
Optoisolated External Switch Interface
The current design provides 16 optoisolated GPIO interfaces organized into banks of eight. Each bank of eight can use a separate reference voltage. If you wanted to eliminate the RPi based touch screen and just use 12V switches, it’s supported. I’m also eventually installing switches in the truck bed to override the RPi when we’re set up to camp. Eight of the interfaces will also support both level and transition based interrupts back to the microcontroller.
3.3V GPIO Interface
We also support four 3.3V GPIOs. I’m not sure I’m bringing these out to the board edge, but they’re there if I come up with a use for them.
Analog Switches
The Remote Module will provide a discrete interface (1-2 wire) to support waking up/sleeping an attached Raspberry Pi. The RPi doesn’t provide a wake on LAN capability or any form of useful power management.
Debug UART
The prototype will exploit the USB connector on the Feather M0.
WiFi Support
The VMaCS Remote Module will connect to external control via WiFi. Control will be via MQTT messages. The candidate WiFi module is a ATWINC-1500-MR210UB. I’ll run an external coax connection to support a dipole mounted on the enclosure. The ATWINC-1500-MR210UB supports 2.4 GHz WiFi, and will interface to the host CPU via SPI.
On-Board RTC
The current generation board does not include an RTC. The next generation will!
External Indicators
I’ve peppered a ton of status LEDs all over the board. This is my primary reason for switching to a PolyCase with a transparent lid.
Internal Battery
DC Power
The remote will use a +12VDC rail directly off either the starter or auxiliary battery, depending on role. The internal power supply will be appropriately filtered/isolated from typical automotive electrical system transients/noise.
Enclosure
The target enclosure is a PolyCase SK-18 with a transparent lid. The PolyCase SK series enclosures are IP66 rated and have lots of knockouts in the base that support cable gland installation. I may need to move up to an SK-28 or an SK-20 once the board layout is actually done.
Length: 7.09″ (180.09 mm)
Width: 5.12″ (130.05 mm)
Height: 3.31″ (84.07 mm)
Wiring Termination
The intent is to use Bosch fuse/relay boxes. I am also considering Bussman fuse/relay boxes, but they are very difficult to get. Adapting to the Bussman interface shouldn’t be difficult. The Bosch boxes use spade lugs. Internally, I’m broadly using screw terminals to terminate cables on the prototype.
Constraints
Environment
Frequently Asked Questions
Design
Example Architecture – 2015 Gen 2 Toyota Tacoma
Remote Module Functional Block Diagram
DC Power Supply Design
Requirements
VMaCS is primarily designed for use in an automotive environment, and may either be powered by the “starter” battery or an isolated auxiliary battery. In the event that the prime DC power supply is the starter battery, the front end needs to be fairly robust. In both cases the DC supply should be capable of sustaining a significant reverse voltage. Some of the issues that can arise at the DC power supply front end include:
- Load Dump
- Reversed Battery Polarity
- Cold Cranking Conditions
- Spikes/Transients (LV 124, ISO 7637-2, ISO 17650-2 and TL82066)
- Mechanical Vibration
- Noise
- A wide range of operating temperatures
Design
Simulation
Optoisolated GPIO Front End Design
Requirements
We specifically require
Design
Simulation
Gallery
Build It
Downloads
Schematics
PCB Design
Bill of Materials
Enclosure
Miscellaneous
References
Nymea homepage:
https://nymea.io/
Installing nymea:
https://www.hackster.io/michael_zanetti/open-source-smart-home-with-touchscreen-control-panel-55e613