Bypic and Thingsspeak.com

BV508

I recently bought a Internet of Things kit from byvac electronics and was surprised how easy it was to push data to my Things speak account with just a few lines of code !.

The kit itself is made up of a dev board with an ESP8266 connected , USB to serial converter , breadboard and various components to try such as leds, switches and a temperature sensor.

The devboard runs byvacs own by pic basic language and doesn’t require any IDE software to program as it can be programmed from any serial terminal.
The board spec is pretty impressive 2uarts (x1 used for esp8266), i2c ,10ai’s , running at 40mhz .

Example: updating things speak account with room temperature.

Thingspeak.com is a free service that allows anything with an internet connection to send data that can be put on graphs and gauges on you own profile. This means you could login anywhere in the world and view your data.

First create an account at Thingspeak.com

Then..

Then add a new channel call it something like “Temp _test”
Give field1 a name such as “Temp deg C” ect and field 2 as humidity.

thing_speak_01

 

 

Then click on API key tab to get your channel key .select and Copy you key.

thing_speak_02

 

 

Your now done setting up things speak account.

Connect temp sensor :

Connection diagrams are supplied with the internet of things kit and also on the bypic website.

wpid-wp-1441830916389.jpg

Code:

// SIMPLE Bv508 WEB TEMP Logger Example By Luke (www.ls-homeprojects.co.uk)
// Free to use this code how you like but please link my site

//******Instructions******

//**** Change the following***
// wifi settings line 17 ( join("your ssid" , "password")
// Thingspeak.com add your Api key to line 45, replace "API_KEY" with your own Api key for your  



//1) Copy and save on bv508 (see bypic homepage http://www.bypic.co.uk)
//2) In terminal type "connect()" to connect to wifi
//3) In terminal type "run_()" to Start the sending the temperature


function connect()
wf_start()   // init wifi
mode(1)
join("YOUR_WIFI_SSID","PASSWORD" )
isIP()       // wait until Ip address is allocated
info()       // Display connection info

//*** init temp sensor ****
dht11_init() // only needed once per reset
endf




function send_data(value1,value2)
if isIP() = 0 then // check wifi connection !
 print "\nUnable to get IP address try re connecting!"
return
endif

get("api.thingspeak.com","/update?key=API_KEY&field1=" + value1+ "&field2=" + value2 ,80)
 // Send request to thingspeak ***Add your API KEY !
endf




function get_temp()
dim x,temp$,hud$
x = dht11_read()      // this can only be called once every 2 seconds
temp$= get_temp$(x)   // get Temp in dec c
hud$=get_rh$(x)       // get hud

send_data(temp$,hud$)
endf




function run_()

//*** init temp sensor ****
dht11_init() // only needed once per reset

dim i
i=1
print "running"
while i>0
get_temp()   // Read and send temp and hud !
wait(600000) // wait 10mins very crude should use a timer ! but just an Example.
wend
endf

 

Results !

Here the type of output you should see…

thing_speak_04

 

thing_speak_05

Custom Google Gauges can be also displayed or Embeded on your website but this is slightly more involved.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.