Remotely start and stop a car using M2 with SuperB!
Smartphone with Google Assistant
GM Vehicle (GM CAN messages provided, you'll need to find your own for non-GM vehicles)
Voice commands will be given to either a smartphone or a Google Home device
Voice data is passed to Google Assistant
Google Assistant then triggers IFTTT with either an ON or OFF command
IFTTT in turn updates Adafruit IO with the ON or OFF command
SuperB receives the ON or OFF command and updates itself to reflect the new state
M2 reads the ON/OFF state of SuperB and then starts or stops the car
Other than Google Assistant, IFTTT supports a huge number of triggers. (e.g. weather, connect/disconnect from Wi-Fi networks, time, etc.) For example, have your car warm up before leaving for work if the temperature is below a certain threshold.
Because the smartphone and SuperB are never directly connected, commands can be sent to the vehicle as long as both devices have an internet connection, regardless of the physical distance between them.
You'll need either a smartphone capable of accessing Google Assistant or a Google Home device. In either case, make sure you know the credentials of the Google account associated with the device.
If This then That will handle the exchange between Google Assistant and Adafruit IO, and adds the option to use a trigger other than a voice command. Register for an account here. Make sure to link the same Google account used on your smartphone or Google Home.
Adafruit IO is an easy to use web service that can control internet enabled hardware (like M2 and SuperB). IO provides a virtual dashboard accesible through a web browser onto which all manner of gauges, sliders, buttons, and switches can be placed. For our purposes we'll have a dashboard with a simple ON/OFF switch, the state of which the SuperB will be able to read. What makes IO extremely useful is that these switches can be controlled by other web services like IFTTT, and not just through the web dashboard. Register for an account here.
Create a new feed titled "LED_Control". (case-sensitive!)
Create a new dashboard with any title.
Navigate to the new dashboard and place a toggle switch linked to the "LED_Control" feed. Leave the block settings on their default settings.
There should now be a single toggle switch on the dashboard:
Find and record your username and key, which will be necessary later.
Download the SuperB sketch here. (This sketch uses the Adafruit MQTT library which can be installed through the Arduino library manager)
Update the sketch with your Adafruit IO and Wi-Fi credentials.
Power on SuperB (either with an M2 or USB adapter board) and use the Adafruit IO dashboard to test the functionality.
Create a new applet with Google Assistant as the trigger (the "this").
Select Adafruit IO as the action (the "that"). Connect your Adafruit account to IFTTT if prompted. Select the "LED_Control" feed and enter "ON" (case-sensitive) as the data to save to the feed.
In the same style create another applet to turn the car off, sending "OFF" instead of "ON".
With these 2 applets you should now be able to control the toggle switch on your IO dashboard via Google Assistant.
Great! At this point we can toggle a pin on SuperB using Google Assistant. The final step is to have M2 read the pin state and then perform an action on the car accordingly.
Download the M2 sketch here.
Determine which version of M2 you have here. Comment out the V4 specific line in the readBatteryVoltage() function if you have V3 or earlier, otherwise leave the code as is.
The startCarSpecific() and stopCarSpecific() functions are pre-populated with GM specific CAN messages. You'll have to determine what CAN messages to send for other cars. (This may take some work to determine!)