Tesla Garage Opener Powered by Particle Monitor One

Tesla Garage Opener Powered by Particle Monitor One

With a decade of experience in IoT software engineering, I specialize in building integrated IoT solutions that help businesses manage products, solve industry challenges, and turn data into actionable insights. If your company needs expertise in this area, feel free to reach out!

In this article, I explore how a Tesla and a Particle Monitor One can work together to create a cloud-connected garage door control system using BLE and cellular connectivity.

The goal? Adding a custom button to a Tesla’s touchscreen to open and close a garage door. How hard could it be? Let’s find out...

Architecture

The Particle Monitor One is connected to your garage door system. When you use the web interface on your Tesla 's touchscreen, it communicates with Google Firebase . Firebase then sends the command to the Particle Cloud, which relays it to the Monitor One, controlling the garage door.

Here's master plan




Particle Monitor One

A Field-Ready, yet customizable IoT cellular gateway. Track and manage assets with reliable and dynamic cellular connectivity (LTE CAT 1/LTE CAT M1) and BLE.

The Monitor One is an off-the-shelf complete gateway design. Comes in an IP67 waterproof enclosure with room inside for an expansion card and additional connectors. Designed to be used off-the-shelf to interface to other devices and sensors using standard protocols such as CAN bus, I2C, serial and, like in this article, Bluetooth (BLE, in fact).

More info: https://www.particle.io/devices/monitor-one/


A cool looking transparent Monitor One developer edition

The I/O Card included with your Monitor One Developer Edition is packed with useful features to help you start creating right away:

  • VIN - Power input, 6 to 30V DC
  • CAN Bus
  • RS485 (Modbus)
  • 4-20 mA input
  • 0-10V analog input
  • 12-24V slow-signal input, Opto-isolated
  • Relay, 30VDC 2A maximum
  • QWIIC connector, 3.3V I2C


Perk #1: Particle Ledger

We leverage Particle Ledger to automatically sync the garage door status with the cloud.

What is Ledger?

Ledger is the digital representation of your product. It's a cloud-based key/value store designed to create digital twins for your customers and users.

Particle Ledger enables you to build digital twins, monitor state changes, queue messages, and aggregate data across devices through a simple key/value store scoped to your devices, products, and organizations.

  • Store the last known state and configuration data of your device
  • Easily get () and set() data to/from a Ledger from Device OS or the REST API
  • Understand state and changes over time with timestamped data points with queryable history

Ledger artwork

Source: Particle.io

Create the Particle Ledger

Go to the Particle console and create a Device to Cloud ledger, naming it "garage-monitor-edge". The process is detailed in the Particle documentation.



Perk #2 - BLE buttons

The project uses Shelly Group BLE buttons to control the garage door.

Shelly buttons are cute

Do not underestimate the impact of this little button. My son was thrilled when I gave him one and told him he could use it to open or close the garage door whenever he wanted. His "This is so cool, Dad!" still resonates in my mind. Only a Maker Dad will understand how rare an event that is.

You can find more information and usage instructions here.


Firmware

Based on the Monitor Edge firmware, code was added to control the garage door and get its status. The 'particle' folder in the code provided contains the firmware.

There are few areas of interest:

  • The Particle cloud function toggleRelay() activates the relay for one second.
  • The local function checkStatus() monitors the input signal indicating whether the door is closed. The ledger is updated when a change is detected.
  • Continuous scanning detects BLE button presses.

The setup

You can find the code here.


Wiring

The Monitor One comes with two cables: one 8-pin and one 4-pin and an AC power source.

The 8-pin cable will be used for powering the system.

The 4-pin cable needs to be connected as follows:

RED: connect to one of the two terminals of the industrial magnetic switch. The other terminal connects to +24V on the power source.

GREEN and BLUE: these two wires connect to you garage door opener. There is a relay on the I/O Card that will short these two when you want to trigger the garage opener.

BLACK: not used.

Wires, wires, wires



Firebase Google Cloud - Project setup

Go to Firebase console and add a project named "garage-monitor-edge".

Install the Firebase CLI on your computer:

npm install -g firebase-tools        

Check the Firebase CLI documentation for more information.

New to Firebase? Check out this intro video.

Note: Documenting each step precisely isn't straightforward due to the specific knowledge required for Firebase. If you're new to Firebase, be prepared to invest time in reading and watching instructional videos.


Firebase Google Cloud - Cloud Functions

The 'fx' folder in the code provided with this project contains everything we need.

Step 1: create an api user with permissions to call functions on Particle

Step 2: create an.env file under the 'fx/functions' folder with the following:

API_KEY_CALLFX="1235083045abcdef" <- this is what you get in step 1 
PARTICLE_PRODUCTID="123456"       <- Monitor One, Particle product  
PARTICLE_DEVICEID="1234567abcdef" <- Monitor One, device id        

Do not include the comments I added here.

Step 3: deploy:

firebase deploy --only functions        

The cloud function is called callParticleFunction(). It receives a request from an authorized user of the web app and calls the Particle API. The Particle API, in turn, calls a function on the Monitor One to trigger the onboard relay, which then opens or closes the garage door.

Here's a great video to help you understand how Cloud Functions work.


Firebase Google Cloud - Web app

The web app will be hosted on Firebase Hosting.

On the 'fx/ionic' folder, run:

npm i        

If you want to run the web app in your development environment, run:

ionic serve        

The web app is using Angular v17 and the Ionic Framework v8.

Enable Firebase Hosting

Navigate to the Firebase console of your project then enable Hosting:

To deploy to Firebase Hosting, there is a deploy.sh script:

cd fx/ionic
./deploy.sh        

Note: Firebase will assign a domain to your web app:

Firebase Google Cloud - Authentication

Now, you'll need to manually create a user on Firebase Auth. While a typical web app would provide a signup page for this purpose, our web app omits this to simplify complexity.

Create your user by providing email and password:


Perk #3: Mobile and web app

Since the web app we just deployed can run on any browser, we can now use it on our laptop or phone.

Tip: Swipe down to refresh the system state.


Perk #4: Always Knowing Where My Garage Is

Thanks to the Monitor One's tracking abilities, I can now keep tabs on my garage's location 24/7—no more lost garages!

Beautiful place for my garage ;)


Final Result

After finalizing this project, the key outcome is as follows:

I tried to match the look and feel of the Tesla dashboard as close as possible. I could not find the exact same font though.

That said... mission accomplished!


Let’s talk IoT - and how I can help your business

This article playfully explores what you can build using Particle and Google Cloud products like Firebase, and how companies can leverage Google Cloud to enhance their products with scalability, security, and powerful data insights.

If you are looking for expertise in:

  • C++ firmware development
  • Cloud infrastructure solutions
  • Mobile and web app development
  • the Particle platform: cellular, Wi-Fi, bluetooth, and soon satellite and LoRaWAN connectivity

Let’s connect! Feel free to reach out if your business needs IoT expertise.


Impresionante Bike!

赞
回复
Yury Shamrei

CEO & Founder at SumatoSoft

1 个月

Great work!

赞
回复

要查看或添加评论,请登录

Gustavo Gonnet的更多文章

  • Shelly BTHOME BLE door/window sensor

    Shelly BTHOME BLE door/window sensor

    With over a decade of experience in IoT software engineering, I specialize in developing integrated IoT solutions that…

  • Powerful and Simple IoT Monitoring: Ruuvi Tags & Particle Monitor One

    Powerful and Simple IoT Monitoring: Ruuvi Tags & Particle Monitor One

    With a decade of experience in IoT software engineering, I specialize in building integrated IoT solutions that help…

    9 条评论
  • Particle Asset OTA

    Particle Asset OTA

    With a decade of experience in IoT software engineering, I specialize in building integrated IoT solutions that help…

  • Infrared replicator

    Infrared replicator

    STORY Some time ago I got into decoding an infrared AC remote with the purpose of controlling the AC via WIFI. I…

社区洞察

其他会员也浏览了