How to set up a Wia Dot One and receive a notification each time a motion is detected
You will need
Connecting the components
Insert the PIR Motion detector module on top of the Wia Dot One. Take care to connect the module pointing in the correct direction as shown on the picture above. You will notice that the rounded corners of the boards correspond to each other when inserted correctly.
Now connect the Wia Dot One to your computer with the micro USB cable. A solid red light should appear on the board. We are finished connecting everything we need!
Configuring your Dot One device
Follow these steps to set up your Dot One:
- On your smartphone, head to the App Store. Search for the Wia App and install it on your phone.
- Once the app is installed, create an account or sign in and select one of your Lab spaces. Navigate to the Devices tab and click on Add Device.
- Select Wia as the device manufacturer and click on Next. Select Dot One as the device model and continue. If requested by the app, press allow for Bluetooth and Location access.
- Click the Scan button to begin the search for your device. You should now be able to see your device listed on the list - click on it and give complete WiFi access details so the Dot One can be controlled remotely later. Enter a name for your Dot One and head to your email - you should soon receive an invite to begin programming!
That's it configured!
Programming your Dot One
Navigate to the Code tab on the left sidebar and select Create Code Project.
For this tutorial we demonstrate the Blocks Project feature - we recommend this option for all beginners as it is simpler and faster for our project. Wia will then translate your blocks into code for the Dot One. Feel free to select Code Project if you are more advanced and are comfortable with writing the code yourself.
You can now drag blocks onto the diagram to express what actions you would like the Dot One to perform. In this tutorial we want to send a Wia Event each time motion is detected - later we will make the Wia Dashboard send us a notification each time motion is detected.
- Go to the Comms tab and drag the block Connect to WiFi onto your diagram.
- In the Logic tab you will find an If/Do block. This allows us to express a condition. Drag this block and connect it underneath your WiFi block.
- Open Wia > Modules and drag the block Motion Detected onto your diagram. Connect it to the right side of the [If] word. You're almost there!
- Now in Wia > Cloud drag the Create Event block and connect it just right of the Do word.
- Then change the event name from "my-event" to "motion-detected". Complete!
You can compare your diagram with our version below. You will notice that while you were adding the blocks to the control diagram, Wia translated them in real time on the right to the code which will soon be uploaded to the Dot One.
Still in the block editor, press on the rocket icon on the top right of the window. Select your device from the given options and hit the upload button.
When the platform confirms the code is deployed, press the Reset button - the button left of the USB cable - and wait until the LED stops flashing.
If the Dot One is still connected to the WiFi, the code will be automatically uploaded and start running automatically. That's it!
Configuring Flows - Sending Notifications
First, let's confirm that you are receiving an event when motion is detected. Navigate to the Wia Dashboard and select your Dot One in the Devices tab. Go to the Debugger, make some motion near the motion detector and wait a few seconds for the event to come in. Try refreshing the page to update the list. Once the first event comes in, you can view the Event history in the Events tab. Great!
Now head to the Flows tab and create a new Flow for this project. A flow is a program which defines how the Wia platform will respond to incoming events.
Let's start with placing the "Event Created" block. What this block allows us to do is start the flow each time that an event is created by a device. As we already sent an event previously called motion-detected, we select this event from the dropdown list. Next we select the device which will send the event, and press Update. This block is now ready.
The next block we want to place is found in the Action tab. We will use the Notification block to specify that a notification should be sent each time an event is created. After filling out all the details of the notification block, we connect the two blocks. Once you leave the Flow page, your new configuration will become active.
Congratulations! Your new IoT device is up and running!
Events send even when motion should not be detected?
Make sure the board is connected in the correct way - remember, the corners of the module and the Dot One should correspond with each other.
Make sure you are not touching the bottom of the Dot One with your fingers - you may accidentally lead to electrostatic discharge, which will impact the proper operation of the devices. Some things which can happen include resetting the device, sending a false motion detection input or even permanently damaging the device.
Also note that this motion detector is very sensitive so any sort of motion within a short distance of it could result in an event being sent. Try moving to a more controlled area where there is less motion.
Dot One device is not appearing during scan?
It is possible your device needs to be reconfigured to a new WiFi. Try the below steps:
- Hold down both buttons on the Dot One for 1 second
- With the USB cable pointing towards you, release the left button and keep pressing the right button for 12 more seconds
- Click on the "Refresh" button to scan for your device.
My question is not answered here?
We would love to support you with setting up your project! Just send us your question to our email: [firstname.lastname@example.org](mailto:email@example.com) or view our Contacts page for further options: https://www.wia.io/contact. Join our community of Makers on the Community Page.