Sunday, April 10, 2016

Pi Zero

After a long Que of waiting for Pi Zero,i have received it. The size of Pi Zero is very small and compact comparing to other versions of Pi. I am not going to give a review on Pi but since i like the Raspberry Pi. i would like to give some information on what i did to test its performance. For technical details go directly to raspberrypi.org.  






Raspberry Pi Zero running RetroPie, just for a test.

 For testing purposes i installed OSMC and test as a media player and i am happy with the performance. Later i installed RetroPie and check how the new hardware performed. RetroPie is cool that it enables to play almost all the retro games that we played when we were young. :)

RetroPie running
I am not interested of GUI so kept aside all the i candy parts and focused on controlling GPIO and runing python scripts and bash script for external hardware communication. Overall what i can say is the waiting for Pi Zero is not time wasting, Pi Zero is better and faster. Thumbs up for Pi Zero.
What i am thinking is to use the Pi Zero for my home automation project which i will give some updates on my next post.

Being away

Due to few technical and other issues i have been away from blogging my electronics project and experiments i do. Lets hope this start will be better than all the past years. I have few things which i would like to write some article that others get the benefit of.
Few months back i got my Raspberry Pi Zero and did some cool things using it. Recently i am on to IoT stuffs so i cam across few new things for me, like MQTT and integration of hardware to MQTT server ruining locally. Possibilities are endless, i can make my light talking to MQTT server and it will handle rest by communicating the hardware like Arduino, ESP8266, Pi etc. I will detail one by one on my next post.
Thank you everyone who support my blog and gain knowledge from my articles. Stay tune for more update from me.

Friday, May 1, 2015

ESP8266 + DS18B20 Temperature sensor sends data to Thingspeak.com

Its been a while i was searching for a cheap wifi module and with the help of smart-prototyping.com, i was able to get a module almost less than USD 5.


To connect the module to breadboard for prototyping, i made a small jig to interconnect with the board easily. So i can wire up the device and interface anything to GPIO's.



Be careful with the module cause the device it powered with 3.3V and both UART side levels will be 3.3V so i recommend to use a FTDI converter with 3.3V level select.(one i used can select 3.3 and 5 volts) if you connect 5V the module will fry up. If you have 5V or 12V supply to power up the module i suggest to use LD1117V33 to make 3.3V.

The stock Firmware in the ESP8266 supports AT commands and for communicating with this need an micro-controller like Arduino. But i want to make a simple solution for that without using external micro-controller. NodeMCU firmware was the best thing i found. To upload the NodeMCU firmware please do a google search, there are tons of video's and supporting documents out there. I am not going to explain the flashing in this post.

NodeMCU is Lua based firmware and i hope most of the people will know it. Most router GUI also built by Lua.

If you are done with the flashing the ESP8266 module, lets connect the DS18B20 to GPIO 0. If you are not aware of pin mapping please check it before connecting anything to the module.
Before writing any code, goto thingspeak.com and make an account and get the API key which will be used with the Lua code.

The Library and sample code

You can download the files from the following Github link. DOWNLOADS
I will post only the code which push the data to thingspeak.

*********************************START***********************************
require('ds18b20')

port = 80
gpio0 = 3

ds18b20.setup(gpio0)

function sendData()

t1=ds18b20.read()
t1=ds18b20.read()
print("Temp:"..t1.." C\n")

-- conection to thingspeak.com
print("Sending data to thingspeak.com")
conn=net.createConnection(net.TCP, 0)
conn:on("receive", function(conn, payload) print(payload) end)
-- api.thingspeak.com 184.106.153.149
conn:connect(80,'184.106.153.149')
conn:send("GET /update?key=YOURAPIKEY&field1="..t1.." HTTP/1.1\r\n")
conn:send("Host: api.thingspeak.com\r\n")
conn:send("Accept: */*\r\n")
conn:send("User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n")
conn:send("\r\n")
conn:on("sent",function(conn)
                      print("Closing connection")
                      conn:close()
                  end)
conn:on("disconnection", function(conn)
          print("Got disconnection...")
  end)
end

tmr.alarm(0, 60000, 1, function() sendData() end )

***********************************END*************************************

Here is the out put to the thingspeak. You can do much more other than a chart. You can add google gauges easily and monitor a relay or button status.






I wish this would help you to do your own projects.