This Kit includes a Thunderboard Sense 2 and Raspberry Pi 3 board. You will be connecting the Thunderboard to the Raspberry Pi via Bluetooth, then the Raspberry Pi will send the data from the Thunderboard to the cloud over Ethernet or WiFi. You then can log in and visualize the data in the Medium One Sandbox, a cloud service we provide with built-in tools you can use with your data.
You will also create a workflow to send alerts to your phone and an email if the device has been dropped or shaken. A workflow is one of the tools on the sandbox that helps you make useful applications using your data.
Step 1: Connecting your Raspberry Pi 3 and Thunderboard Sense 2 to the Medium One Sandbox using Ethernet
If you want to connect your Raspberry Pi to the cloud over WiFi, please refer to Step 6: Configuring WiFi on your RPI, at the end of this document. Otherwise, you will need an Ethernet cable to plug into your Raspberry Pi.
1. Find your Micro SD card in your Kit. Plug it into your Raspberry Pi.
2. Configure your Pi to WiFi or plug in the Ethernet cable.
3. Turn on the Raspberry Pi by plugging in a USB Mini and connecting it to a power source.
4. Wait two minutes for the Pi to finishing booting up.
5. Now, power on your Thunderboard by plugging it in via a USB Mini. You may or may not see a green light blinking before the red light, signalling that it is trying to find something to pair with.
6. After about 20 seconds, a red light on the Thunderboard should blink twice every ten seconds. The red light means it has successfully connected to the Raspberry Pi using bluetooth, and the Raspberry Pi has successfully connected to the internet.
Step 2: Login to the Sandbox and Visualize the Thunderboard data
1. Navigate to https://www.medium.one/. Click “LOG IN”.
2. LOG IN using the “username” and “password” on the postcard included in your Kit. You will find them in the Your Medium One Sandbox Credentials box.
3. After you LOGIN, you should see something like this. A description of each section of this Dashboard follows.
This is the “Real Time Events Stream” widget. Each of the lines, beginning with the date in blue on the left, is a piece of data coming in from the Thunderboard. You can see in the text, sensor readings like pressure, temperature, and humidity. You can also see x_max, y_max, and z_max, which are the maximum vibration in the x, y, and z directions since data was last sent.
The Real Time Line Chart widget shows you the maximum values of the vibration in the x, y, and z directions over time. You will use this widget later on to see how motion sends out an alert.
The Real Time Gauges show you readings from the different sensors on the Thunderboard. The values will change on these gauges as new data comes in.
The Last Value Table shows the last value for key information such as IP addresses, device address and battery. The values will change in real time as new values are sent.
Step 3: Modify Your Workflow to Send Alerts to Your Email and Phone
In this step, we’re going to modify a workflow. Workflows are python applications that run as data comes in. This particular workflow checks to see if the Thunderboard has moved based on the G-Force. If the board has moved, it sends an email and text message alert. It limits the number of alerts to be sent to one per day. We’re going to modify the workflow to send the alerts to your phone number and email address.
1. On the Medium One Sandbox, click on “Workflow Studio.”
2. Click on “Alert on Vibration.”
3. You should see three green boxes and one blue box. Double click on the blue box.
4. Python code will appear. On line 10, replace the phone number with your phone number, excluding country code. Make sure to keep it in the quotation marks.
5. On line 11, replace the email with your email address. Make sure to keep it in the quotation marks.
6. Click “Save and Activate.”
Step 4: Test Your Alerts
1. Make sure your Thunderboard is still blinking a red light. If not, press the reset button.
2. Go back to the dashboard on the Medium One Sandbox by clicking on the Dashboard icon in the left menu. Find the “Real Time Line Chart”. Here you can see the changes in vibration on the Thunderboard.
3. Shake the Thunderboard back and forth for about 10 seconds. The Real Time Line Chart should jump, and you should receive a text message and an email.
Step 5: Now what?
Congratulations! You have connected your bluetooth Thunderboard Sense 2 device to the cloud using Ethernet over a Raspberry Pi 3. We have many more interesting projects you can try out. Go to www.medium.one and SIGN UP for a free Medium One Sandbox account:
Then checkout our tutorials and see what else you can do using the Medium One Sandbox:
- Build a Home Weather Station using your Raspberry Pi. Check out this tutorial: https://blog.mediumone.com/2017/08/home-weather-station-using-raspberry-pi-and-sense-hat/
- Use Alexa’s voice-controlled speaker to tell your sensor system what to do! That and much more here: https://blog.mediumone.com/category/tutorials
- Learn more about the Medium One system here: http://docs.mediumone.com
Step 6: Configuring WiFi on your RPI
Your Raspberry Pi can also connect to WiFi, but you will need to configure the SSID and password. You will need a USB mouse, keyboard, as well as a monitor with an HDMI cable.
1. Plug the monitor, keyboard, and mouse into the Raspberry Pi. Power it on after they are plugged in and the monitor is on.
2. After about 30 seconds, you will see the following display on your monitor. Click on the WiFi button in the upper right hand corner.
3. Find the WiFi network you want to connect to and click it. Type the password in the pop up box.
4. Your Raspberry Pi will now automatically connect to this network when it turns on!
Important Note: Boot-up Sequence
The Thunderboard Sense 2 will try and find a device to pair with for about twenty seconds, and then it goes into sleep mode. You can tell if the Thunderboard is looking to pair because a green light on it blinks. Because of this short pairing window, it is important to turn on the Raspberry Pi first, then turn on the Thunderboard. That way, the Raspberry Pi will pair with the Thunderboard right when it turns on. If the Thunderboard is not blinking a green light indicating it is searching, or a red light indicating it is connected to the Raspberry Pi and the cloud, then you should power it off then back on.