Introduction: Connected Mousetrap Powered by Afero
What is Afero and what do they do? Afero builds integrated hardware, software, and cloud services for IoT connectivity. Their turnkey, secure communication stack is for forward-thinking entrepeneurs and companies who want to bring better products and services to the world.
What is an Afero Powered mousetrap? It's an internet-connected mouse trap that sends you push notifications when you've caught a mouse, has 2+ years battery life, and takes less than an hour to make. How, you ask? By leveraging the Afero Platform.
Step 1: Parts + Tools
This project takes surprisingly little equipment and time; I completed it in less than an hour.
- Afero Modulo Development Board (available from Mouser)
- Mouse Trap (I like this trap from d-CON)
- 3V coin cell battery (such as a CR3203)
- Soldiering iron, wire, jumper switch, copper tape
- iOS/Android phone
- Download the Afero mobile app (for iOS or Android) and the Afero Profile Editor (for the Chrome web browser) from https://developer.afero.io/get-started
Step 2: Making a Simple Circuit
- Take off the cover and disconnect the springs now to save your fingertips later.
- I added copper tape to the trap's base and the plastic lever - these two pieces of copper will contact each other and complete a circuit when the trap is triggered. Solder a wire to each piece of copper and route it to the back of the trap.
- I wanted to mount the circuit board and battery on the outside of the trap so I made a hole to run the wires to the outside of the enclosure.
Step 3: Adding Power to the Modulo
- Since the Modulo is being powered by a battery there is no need for the USB port. I split the board in two along the perforation.
- Next, attach the battery to the VCC and GND pins on the Modulo. I also added a jumper to the GND wire to serve as a simple ON/OFF switch
Step 4: Completing the Circuit
- Solder one of the wires coming from inside the trap to the positive battery terminal.
- Solder the other wire coming from inside the trap to IO pin 0.
- When the trap is closed the circuit between the positive battery terminal and IO-0 will complete and raise the pin 'HIGH'.
- I attached the circuit and battery to the side of the trap with some double-sided tape and crazy glue.
Step 5: Creating + Publishing the 'Device Profile'
This is the part where Afero really shines — we use the Afero Profile Editor (APE) to take care of literally (figuratively) everything else. If you want to skip this step outright, you can grab the attached Device Profile.
- Sign Up: Launch the Afero Profile Editor and sign in. (If you don't have it yet, you can get it from https://developer.afero.io/get-started. If you don't have an account on the Afero Cloud service, you can create a new account right from the Profile Editor login screen - you'll use this account for the Profile Editor and for the mobile app to control your connected devices.
- Creating a New Device: create a new device profile, specify the name, folder, etc.
Defining the Attribute: the mousetrap uses IO-0. It should be configured as a pull-down input.
Create Mobile App UI: Select a UI control for the mobile app; I’m using a string control. The attribute has two values: logical low (aka zero) and logical high (aka one). Logical low means the circuit is open and waiting for a mouse, high means the circuit is closed.
Create a Control Group: Control groups are containers for UI controls (like the one we created in step 4). This control group will contain the single control that represents whether the trap is 'open' or 'closed'.
Generate and Publish: Publish this newly created 'mousetrap' device profile to the Modulo Development board that's wired into my mousetrap.
You're Done! Launch the Afero mobile app and bask in the glory of your internet-connected mousetrap as you send those pesky mice to meet St. Peter.
Step 6: The Final Product
Here you can see the mousetrap in action - the Afero app reflecting the state of the trap in realtime.
You can also see a push notification being delivered when the trap is triggered.
To learn more visit the Afero site: www.afero.io
marnberg made it!
We have a be nice policy.
Please be positive and constructive.