GithubHelp home page GithubHelp logo

isabella232 / pubnub-atmel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pubnub/pubnub-atmel

0.0 0.0 0.0 13.31 MB

Real time temperature sensor demo using Atmel and PubNub

C++ 2.95% C 83.54% Objective-C 3.25% Batchfile 0.13% Makefile 10.14%

pubnub-atmel's Introduction

#PubNub - Atmel Xplained Pro Real Time Temperature Sensor

The buzzword being IoT, we wanted to build something with software and hardware(duhhh!),that everyone can easily understand and try themselves. The first thing that came to our mind was the Raspberry Pi and the Arduino, but we wanted to try out something different. Something that is easy to understand, easy to use and also scalable. We decided on combining Atmel MCU and PubNub to build a real time temperature sensor demo.

VIDEO GOES HERE

What exactly is this, and what does it do?

The Atmel temperature sensor enables monitoring temperature from anywhere in the world at low-latency, and provides updates in realtime whenever the temperature changes. The temperature sensor will measure the ambient temperature and publish it as a data stream to a channel in the PubNub network. A web browser that subscribes to this channel displays the data stream.

The concept:

alt text

  1. The Atmel I/O1 Xplained Pro sensor measures the ambient temperature.
  2. This connects to the Wi-Fi using the ATWINC1500 module.
  3. The PubNub code running on the Atmel chip enables us to publish the temperature in real time to any one subscribing to the same channel as a data stream.
  4. Through the pubnub developer console, you can receive this stream of information from as many sensors as you like in real time.

1. What do you need?

####1.1 Hardware

alt text

  1. ATSAMD21-XPRO host MCU board.
  2. OLED 1 Xplained pro to provide the display on the chip.
  3. Atmel I/O1 Xplained Pro for sensor and SD-card input to host MCU
  4. ATWINC1500 module. This is a Wi-Fi black box that contains the Wi-Fi stack, the TCP stack and the TLS stack.

####1.2 Software

  1. Windows PC
  2. Sign up for PubNub, and get a set of publish and subscribe keys
  3. Install Atmel Studio 6.2
  4. Install updates to Atmel Studio as suggested during installation
  5. Install terminal software like putty or teraterm (I have used putty)

A prerequisite is that you upgrade the firmware for SAMD21 using the .bat file provided with the PubNub Atmel example before you run this demo. Make sure no other software like putty or teraterm is using the com port). Close atmel studio and the putty terminal. The firmware upgrade is successful if you see a PASS sign on the terminal after running the code.

###2. Connecting the hardware, the right way :

  1. Connect WINC1500 XPRO board to SAMD21 XPRO connector EXT1
  2. Connect I/O1 XPRO board to SAMD21 XPRO connector EXT2
  3. Connect OLED1 XPRO board to SAMD21 XPRO connector EXT3
  4. Connect SAMD21 XPRO to a free USB port on your PC (make sure no other USB port on your PC is in use)
  5. Connect the power to the port that says “DEBUG USB”

alt text

###3. The Software

3.1 Open the PubNub example solution on Atmel Studio and you will see the following page. Make sure you choose the debugger/programmer and interface as shown:

alt text

3.2 Include the following lines in Code/pubnubAtmel/src/main.h:

#define TEST_MODE_SSID "Enter-your-SSID"	(choose THE Wi-Fi access point you want the chip to connect to)
#define TEST_MODE_PASSWORD "Enter-the password-for-the-SSID" (enter the password for the same Wi-Fi connection)
#define TEST_MODE_WITHOUT_PROVISION

3.3 In code/pubnubAtmel/src/main.c, add the channel name and pub, sub keys.

alt text

3.4 Build (F7 / Build -> build solution), run(continue/ green arrow/ F5/ debug -> continue). alt text

3.5 Open [PubNub console] (http://www.pubnub.com/console/), use the same channel name and pub,sub keys as in the code and SUBSCRIBE.

3.6 If all is well, you should see a constant stream of messages in the following format :
<Atmel_Pubnub> {"columns":[["temperature","55.00"]]}

alt text

###4. Visualizing the data stream

ADD LINK TO THE GIF HERE. - http://g.recordit.co/jHPBFcm6zr.gif

Tomomi (ADD A LINK TO HER BIO), built a live demo for this and can be seen here : Atmel Xplained Pro Demo. It mocks nursery or greenhouse monitor(a very typical use case of using temperature sensors), instead of just displaying raw data off the sensor. This interface is running on a browser. The technology behind is quite simple, using PubNub JavaScript APIs to subscribe the data sent from the Atmel chip.

This interface is accessible from anywhere in the world with any kind of device - mobile phones, tablets, and any smart device, as long as you have a web browser. The main purpose behind this is to present information in most efficient manner without losing its accuracy.

In this scenario, the UI shows the current temperature, also a simple line graph, updating in real time so that you can tell the relative changes of the temperature, raising and dropping.

This particular data is simple, but when you have multiple, more complicated data, data visualization plays more crucial role.

Go Conquer IoT

This demo is read-only and reads the ambient temperature, but in reality, you want to develop products that lets your users monitor and control, i.e, bidirectional communication between devices. For instance, if you have a smart A/C, not only monitoring the current room temperature, but you need to make it controllable from a remote devices. With the power of PubNub APIs, you can achieve this with no hassle. I hope I am leaving you guys with enough excitement to try this demo out, and also build cooler ones. Let me know at @bhavana1110.

pubnub-atmel's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.