Software apps and online services
Some fellow hacksters let me know that this project was not working anymore so I updated the code to work again. Thanks!Story
I like experimenting with new things. Specially, when new things are something I really want and need.
In this project, I am going to play with Blynk, an awesome Android and iOS app that allows you to connect any hardware to the app.
Imagine a prototyping board on your smartphone where you drag and drop buttons, sliders, displays, graphs and other functional widgets. And in a matter of minutes these widgets can control and get data from Arduino, Raspberry Pi, and in my case Particle Core and Photons!
Starting to sound amazing? Read on!
UPDATE: Blynk is getting even more awesome!
From now on you are able to share the “Apps" you’ve made with Blynk with your family, friends or even customers.
Check the sharing feature here.The project
I decided to add Blynk to a simple project that I've built in the past to monitor the temperature and humidity of my house.
A DHT22 is plugged into a Particle Photon. If you are already familiar with this wifi dev kit, it comes with a cloud, standard. This cloud allows you to make rest requests to get information and trigger functions in your Photon or Core, check if your device is online, etc.
There is another tool that comes standard (oh, wait, there are sooo many tools that come with it!) with a Particle wifi dev kit: the Particle dashboard.
Think of it as a virtual serial cable connected via the internet from your Particle to your browser. You can monitor the events published by your Particle with no wires.
Now this Particle dashboard might not be enough to interact with your projects. It is work in progress, and so far you can receive all the events your Particles publish and that's it.
Don't get me wrong, I am grateful for having it and I think it is pretty good stuff for troubleshooting and monitoring your projects. It's just that you cannot add controls to modify variables or trigger functions in your Particles. This was at one point hinted by the devs, but sadly not implemented yet - hey, thousand new things got implemented, so I can't complain at all.
Now if what you want is to control variables or trigger functions, in other words, control your projects from your phone or tablet, you may have to code an app yourself. The guys at Particle provide Android and iOS SDKs, but still, you have to learn how to code your app in each of those two platforms.
Now, what I understand these guys at Blynk did, is to create another cloud (the Blynk server) where to connect different hardware, be it arduino, raspberry pi, particles (and more! yeah - the list is amazing), and expose that cloud to a beautiful app where you build your own controls and dashboards, with only few taps of your fingers!
From a maker's perspective, life gets so easy with things like these!My first dashboard in Blynk
I went to the Particle IDE (called build), added to my Particle firmware the blynk library, added few lines of code for exposing variables to the blynk cloud and flashed the new code to my dev kit. That was it for the hardware/firmware side.
Now I needed to add some widgets on the blynk app. In this case I grabbed a value display and a gauge. This combination does not look pretty, it's just that I wanted to experiment with different widgets :)
In less than half an hour I had added an Android app to my project, no coding efforts.
Temperature and humidity where at the tip of my fingers in such a pretty way that would cost me countless hours of Java programming for Android. Imagine now duplicating all that code to repeat the experiment on my friend's iPhone! Forget it.
With Blynk, I can share my project with a friend, and they can load it and use it in their projects, on Android or Apple devices. How much more awesome can it get?
Wait, it can. Just scan the following QR code with your blynk app and you get my dashboard:
I find this resource very well done.Troubleshooting
- If you get a reading of -2, most probably there is a problem with the wiring. Go back to the schematic and see if something is not wired properly
- If your reading is over your other devices or thermostats by a couple of degrees, I have experienced that and there is no way of calibrating the DHT22 as far as I know. Know that the proximity to the Particle could help raise the temperature reading.
- If you were using the project for a long time (weeks?) and then your Particle became not responsive, then maybe you hit the issue described by Owen de Long. The fix is on its way.
- Things are getting printed in the serial port so you can use a terminal and see what the device is doing at any time by running:
particle serial monitor --follow
- If you require more than one DHT22 sensor, then please take a look at this example from the original author of the DHT22 library.
- If you are using a DHT11, then please modify this line of code:
#define DHTTYPE DHT22 // Sensor type DHT11/21/22/AM2301/AM2302
to look like this:
You don't need Blynk?
#define DHTTYPE DHT11 // Sensor type DHT11/21/22/AM2301/AM2302
If you do not want to use blynk, then you can comment out this line in the code:
so it would look like this:
// #define USE_BLYNK
So, did you build something similar? are you planning to? any questions?
Feel free to leave me a note below,
Psst: please find my other projects here.Help
If you require professional help with your projects, don't hesitate to write me a line about your needs at email@example.com. Thank you!