This article demonstrates using SAMI with simple, off-the-shelf sensors and hardware. Specifically, we will be gathering climate data from a low-cost temperature sensor and relaying that data to the cloud via SAMI APIs. From there, we can analyze our collected data in real-time or historically. This autonomous combination of hardware, software and networking is now being referred to as IoT (Internet of Things).
Hardware components we will use in our demo
- Raspberry Pi with a network connection
- Arduino Uno with a breadboard
- Temperature sensor (DHT11)
- USB and power cables, plus wiring for the breadboard
Software we will write
- A Node.js script running on the Raspberry Pi
- A Sketch program running on the Arduino
Step 1: Build the weather station
Connect to SAMI (it’s free, really!)
- First, sign into the SAMI User Portal. If you don’t have a Samsung account, you can create one at this step.
- Click to connect a device. Choose the already defined device type “Temp Sensor”.
- Name your device using your name (e.g., “Dan Temp Sensor”).
- Click “Connect Device…”. You’re taken back to the dashboard.
- Click the name of the device you just added. In the pop-up, click “Generate Device Token…”.
- Copy the device ID and device token on this screen. You will use these in the code.
Step 2: Set up the Arduino and the temperature sensor
Now let’s wire the sensor. We are using a DHT11 here. They are not the most accurate, but they are cheap and easy to use for our simple use case.
Using the Arduino IDE, upload the Arduino code (dht11.ino) to the Uno. This code reads the temperature data from the sensor and sends the value (in Fahrenheit) to the serial port every 2 seconds (you can change this parameter in the code later, since SAMI limits the number of messages per day).
For more detail: Weather station using SAMIIO, Arduino, and Raspberry Pi