How to set up a Wia Dot One and display a simple text on the TFT Screen Module
How to use states to send a different joke every day from a website to the TFT Screen Module (advanced)
You will need
- 1x Wia Dot One
- 1x Wia TFT Screen Module
- 1x MicroUSB cable
- 1x Mobile device, ex. Smartphone
- 1x laptop or desktop computer
Insert the TFT Screen 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 deviceFollow 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 OneSending simple text to the TFT Screen module: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 new joke of the day every day to the TFT Screen module.
- Go to the Comms tab and drag the block connect to wifi onto your diagram.
- Open Wia > Modules and drag the block print to TFT onto your diagram. Connect it just below the c onnect to wifi block. You’re almost there!
- Now in Text drag the " " block and connect it just right text to print on the print to TFT block.
- Next input in " " what text you would like to print to the TFT screen module.
- Note you can change the size, orientation, colour and position of the text and background colour of the screen with the settings in the print to TFT block.
- Now in Time drag the wait 1000 milliseconds block and connect it below the print to TFT block.
- Next change 1000 to 10000 in the wait block. 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.
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 new joke of the day every day to the TFT Screen module.
- Go to the Comms tab and drag the block connect to wifi onto your diagram.
- Open Wia > Modules and drag the block print to TFT onto your diagram. Connect it just below the connect to wifi block. You’re almost there!
- Now in Wia > Cloud drag the get device state block and connect it just right text to printon the print to TFT block.
- Next change the state-key to joke.
- Now in Time drag the wait 1000 milliseconds block and connect it below the print to TFT block.
- Next change 1000 to 10000 in the wait block. 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 - For Joke of the Day (Advanced)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.
- First go to the Trigger >Wia and drag a Timer node into the workspace
- Next in the Configure trigger set the Trigger flow to Every minute and select update to configure the timer trigger and press Update.
- Then under the Services > Wia drag a HTTP Service node into the workspace.
- Next in the Configure service set the URL to the URL you would like to have the text input from. For this example we will be taking a joke from https://icanhazdadjoke.com thus that the URL we will paste in the box.
- Next set the Header > key to Accept be sure to make the ‘A’ capitalized. This what you are choosing to name the text that is in the state.
- Next set the Header > value to text/plain. This is the type of input which the state holds and for our purposes it is text (the joke) from the website and then press Update.
- Then connect the two flows Timer and HTTP Services by dragging the yellow ring from the bottom of Timer to the yellow ring on the top of HTTP services to connect these two flows.
- Now go to Logic > Wia and drag and Update State node into the workspace.
- Next in the Configure logic choose your Dot One from Choose device to update > Update device from list.
- Next set Key (required) to the key your code looks for which for our purposes is Joke.
- Next set Value (required) to ${input.body} which is a value which interacts with the API of the website we are using and then press Update.
- Lastly, connect the yellow ring from the bottom of HTTP Services to the yellow ring on top of Update State to connect these two flows and your flow is complete!
You can compare your diagram with our version below. You will notice that while you were adding the nodes to the workspace.
Make sure the board is connected in the correct way - remember, the corners of the TFT Screen 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.
We would love to support you with setting up your project! Just send us your question to our email: support@wia.io or view our Contacts page for further options:https://www.wia.io/contact. Join our community of Makers on the Community Page.
Comments