Macchina Docs
  • Macchina.cc
  • Introduction
    • Disclaimer
  • Product Documentation
    • M2 Docs
      • Getting Started
      • Arduino IDE Quick Start
      • M2 Code libraries
        • CAN bus
        • Single-wire CAN
        • LIN
      • Next Steps with M2
      • Detailed Reference
        • Installation
        • Processor
        • Pin Mapping
        • Automotive Interfaces
        • Communication
          • M2 Bee-Compatible Add-ons
          • Cellular
        • Power
        • Storage/Memory
        • 12V IO
        • LEDS/Buttons
        • Enclosures
        • Breakout Board
        • Schematics and Source
      • Versions of M2
    • A0 Docs
      • Quick Start Guide
      • Firmware Reference
      • Hardware Reference
      • Projects
      • Troubleshooting
    • SuperB Docs
      • Getting Started
      • Hardware
      • Sending AT Commands
    • P1 Docs
      • Getting Started
      • Pin Mapping
      • Interfaces
      • Power Supply Note
    • OBD3way Docs
  • Projects
    • A0 Projects
      • A0 CAN Vehicle Data
      • A0 CAN Point to Point
      • A0 CAN Read VIN
      • Work-in-Progress A0 projects
    • M2 Projects
      • "OK Google, start my car!"
      • M2 and SavvyCAN, the Basics
      • Help Collect Voltage Data
      • Mini-Project Tutorials
        • M2 CAN Loopback
        • M2 CAN Point to Point
        • M2 SWCAN Point to Point
        • M2 VIN Extraction
    • P1 Projects
      • P1 CAN Vehicle Data
      • P1 CAN Loopback
    • Community Projects
    • Project Support
    • Other Resources
  • Support /contact us
    • Contact US / FAQ
    • Common Issues
    • Out of Stock/ Status
Powered by GitBook
On this page
  • Theory
  • Implications, Expansion
  • Google Assistant
  • If This then That (IFTTT)
  • Adafruit IO
  • Step 1: Set up Adafruit IO
  • Step 2: Set up and Test SuperB
  • Step 3: Set up and Test IFTTT
  • Step 4: Flash M2

Was this helpful?

Export as PDF
  1. Projects
  2. M2 Projects

"OK Google, start my car!"

Remotely start and stop a car using M2 with SuperB!

PreviousM2 ProjectsNextM2 and SavvyCAN, the Basics

Last updated 1 year ago

Was this helpful?

Hardware Needed:

  • Smartphone with Google Assistant

  • GM Vehicle (GM CAN messages provided, you'll need to find your own for non-GM vehicles)

Services Needed:

  • Google Assistant

Theory

  • 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

Implications, Expansion

  • 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.

Google Assistant

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 (IFTTT)

Adafruit IO

Step 1: Set up Adafruit IO

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.

Step 2: Set up and Test SuperB

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.

Step 3: Set up and Test IFTTT

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.

Step 4: Flash M2

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!)

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 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 accessible 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

Download the SuperB sketch (This sketch uses the Adafruit MQTT library which can be installed through the Arduino library manager)

To flash SuperB with M2 follow the instructions Alternatively, if you have an XBee USB adapter board you can flash SuperB using the instructions found

If you're interested in using more than just one pin the SuperB pinout can be found and the pinout for the M2's XBee socket can be found

Download the M2 sketch

This sketch uses the M2_12VIO library found the pwm library found and the mcp2515 library found make sure you have them installed.

Determine which version of M2 you have Comment out the V4 specific line in the readBatteryVoltage() function if you have V3 or earlier, otherwise leave the code as is.

If This then That (IFTTT)
Adafruit IO
here.
here.
here.
here.
here.
here.
here,
here,
here,
here.
M2
SuperB
here,
here.
Flowchart showing the relationship between hardware and services used
How to create a feed
How to create a feed
How to create a dashboard
How to create a toggle switch
How to create a toggle switch
Settings for the toggle switch
The switch on the dashboard
Where to find username and keyimage showing where to find username and key
Where to update credentials in sketch
SuperB responding to Adafruit IO dashboard
Google Assistant in IFTTT
Adafruit IO in IFTTT
The 2 applets just created
Google Assistant controlling Adafruit IO and SuperB
Code to modify for different versions of M2
Start and stop functions