Display temperature and brightness on webpage

Posted on
  • Hello,
    I want to display temperature and brightness values in my web page, every 30 minutes.. How can i achieve that??
    Thanks in advance!

  • Hi. Some good information that helped me can be found at Puck.js and Node-RED with MQTT. You can use a Raspberry Pi (I am using "Zero W" which has wi-fi and bluetooth, and costs around 10 euro), and send the information you want from Puck to the Pi (and vice-versa).

  • If you're using Android, iOS or Mac OS I'd suggest Web Bluetooth.

    There's an example here that would be perfect: http://www.espruino.com/Web+Bluetooth+Da­shboard#realtime-dashboard

    Where it says:

    connection.write("setInterval(function()­{Bluetooth.println(JSON.stringify({light­:Puck.light()}));},100);NRF.on('disconne­ct', function() {reset()});\n",
    

    change it to:

    connection.write("setInterval(function()­{Bluetooth.println(JSON.stringify({light­:Puck.light(), temp:E.getTemperature()}));},1000);NRF.o­n('disconnect', function() {reset()});\n",
    

    However I seem to recall you're on win 10? If so web bluetooth will be available in a few months but it's not there yet and @Pi's advice is spot on

  • Hello,
    I'm on Windows 10 and in puck.js webpage I can see that 'web bluetooth is already enabled'. Also I can connect to my Puck device this way.. But when i try to use the dashboard example black screen is displayed and a 'can't connect' sign pops up.. I thought of buying the Zero W pi but I want to try one more time the Dashboard example..
    Is this what i need for Node red :
    http://nettop.gr/index.php/raspberry-pi/­raspberry-pi-zero/raspberry-pi-zero-kits­/raspberry-pi-zero-w-basic-kit.html
    Thanks.

  • Windows 10 doesn't fully support Web Bluetooth yet, regardless of what it says. The absolute latest versions of Chrome can connect and send data, but can't receive it so won't work for what you want. In a few months it should be fixed.

    All you actually need is a Pi Zero W, a Micro SD card and a Micro USB power supply - that link has useful things, but you don't actually need any of them.

    I'd recommend a Raspberry Pi 3, as it has Ethernet - which makes getting connected easier.

  • I'm a little bit confused in how I can display and store my Puck's data into a database .. I'm working
    on an Android project. What would you say is the cheapest and easiest way to achieve that??
    I'm thinking of buying the Zero W full kit.. I'm gonna be ok with that?
    http://nettop.gr/index.php/raspberry-pi/­raspberry-pi-zero/raspberry-pi-zero-kits­/raspberry-pi-zero-w-full-kit.html

  • I'm a little bit confused in how I can display and store my Puck's data into a database .. I'm working
    on an Android project. What would you say is the cheapest and easiest way to achieve that??
    I'm thinking of buying the Zero W full kit.. I'm gonna be ok with that?
    http://nettop.gr/index.php/raspberry-pi/­raspberry-pi-zero/raspberry-pi-zero-kits­/raspberry-pi-zero-w-full-kit.html

  • That kit is fine, a little bit expensive though if you are not planning to connect the board on a screen (and the card is 4GB, which can be a problem if you install lot of things). All you need is the bare board and a microUSB->USB cable (same you use to charge the phone) if you are going to connect it to a laptop/PC, or a 5V wall charger if you want to plug it on mains.

    I don't know anything about android, but the general idea is that you would advertise temperature and light level of the Puck every 30 minutes, and read those values from Raspberry Pi. That is done by installing and running EspruinoHub on the Pi. Then you use Node-Red, which make it super easy to take those values coming from the Puck and do something with them, for example store them on Firebase and use them from there on your app.

    I am struggling myself with all these as I am new to most of it, but EspruinoHub + Node-Red help a lot, once you start using them things will come along.

  • If it the puck output getting displayed on your android phone, you can host the web page on github.io, and use web Bluetooth to communicate with the puck. You can then display information and send setting to the puck via the web page talking over web Bluetooth. Then you would not need to use the pi as a broker in between.

  • Yes that will do I'd say, the only thing you may additionally need is a wall charger if you are aren't going to plug it on a computer, and a microSD card of course.

  • Everything's ok now. Thanks

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Display temperature and brightness on webpage

Posted by Avatar for Pzr0 @Pzr0

Actions