← back to blog index
Pushdata loves Python and Arduino We just released client libraries for Python and Arduino(ESP8266)!

Posted by Ragnar on Mar 6, 2019

They're here!

We just released two client libraries for pushdata.io - one for Python and one for Arduino/ESP8266:


pushdata-io for Python

There is a lot more information in the README.md files of these repos. Just go to the Github links above and check them out.


Using Pushdata has up until now involved making HTTP requests aimed at the Pushdata REST API. While this API was designed to be ridiculously simple to use, making HTTP requests is on many platforms slightly harder than using a dedicated client library.

We like IoT, which means Arduino was an important platform to target with a client library. However, I am not sure all Arduino variants were equally important to support. At least not initially. Given that Pushdata is an online service, data has to be sent across the public Internet to reach us. This means that the sender has to have Internet connectivity - something which is beyond many Arduino devices. Arduinos are often either limited to simple wired or wireless serial communication that is not IP-based. They can often only talk to other, similar Arduinos in the same logical network, or perhaps to some more powerful machine (a Raspberry PI maybe) that may have Internet connectivity.

So should we build client libraries for Arduino at all then? We can't receive data via LoRa or Zwave or some homebrewed 866Mhz-whatnot-radio, and definitely not via a wired serial connection.

There are Arduinos with Ehernet and WiFi, but my sense (may be wrong) is that they are not very common. WiFi or Ethernet shields for Arduino tend to cost much more than the Arduino itself, and even if you have one, supporting TCP may be tough for a tiny device like an Arduino. HTTP and HTTPS on top of TCP is of course even harder.


Enter ESP8266

But there are other options today - Espressif systems and their ESP8266 has become very popular. Today you can get a NodeMCU board based on ESP8266 for under $2 directly from China, and it has built-in WiFi, enough CPU and RAM to be able to actually work as a more or less "standard" REST API client, connecting over HTTPS to a web server. There is also ESP32, the successor to ESP8266, that is even more powerful and costs 3-4 USD (expect support for ESP32 also, if this ESP8266 library turns out to be popular). These are platforms I think are extremely interesting to support, as they are very likely the smallest devices that are truly Internet-capable, meaning they can send data to pushdata.io directly.

Orange PI

We also want Linux

Another platform that is important is "small Linux systems", often used as data collectors/aggregators for sensor data. They can be e.g. Raspberry PIs or Orange PIs - the cheapest type of Raspberry clone. These tiny computers start at maybe $8 and then you get a fast, multi-core CPU, hundreds of MB of RAM and built-in WiFi and wired ethernet! For me, who started out with computers in the early 1980's when you had to pay a monthly wage to get a bulky 32kB RAM computer that added numbers only slightly faster than a third grader, this development is just, uh, indescribable. "gob-smacking" is a fitting expression from british english. I mean just look at the picture on the right - how tiny is that Orange PI? The ethernet connector looks huge compared to the rest of the computer.

There are also "regular" Linux computers running e.g. Ubuntu of course, that are being used for IoT data collection, but all of these Linux systems are pretty compatible in terms of what software you can run on them.

On the Linux platform people use a ton of different languages when they develop things, so to start with low hanging fruit we decided to write a small Python library first. Python is a huge language and probably the most common language today for DevOps work/development.

What's next

We hope these libraries will make interaction with pushdata.io simpler for a lot of people out there, but it is worth mentioning that these libraries are quite "basic" in terms of functionality. There is a lot of room for improvement. We really appreciate if you give us feedback on how they work for you, if you need any particular features that are missing, if there are bugs or just if something is inconsistent, unintuitive or not very user-friendly.

We'd also like to know, of course, if there are any other platforms you're using that you'd like to have a pushdata.io client library for - just drop us an email.

Code examples

Arduino C++:

#include <Pushdata_ESP8266_SSL.h>

Pushdata_ESP8266_SSL pd;

void setup() {
	pd.addWiFi("MyWiFiSSID", "MyWiFiPassword");

void loop() {
	if (pd.monitorWiFi() != WL_CONNECTED)
	// Send a data point every minute
	if (millis() % 60000 == 0) {
		// send the value 4711, timestamped with the current date and time
		pd.send("MyTimeseries", 4711);

Go check out the Github repo for more code examples.

Python 2&3:

import pushdata

pd = pushdata.Client(email="myemail@example.com", tsname="MyTimeseries")
pd.send(12345)  # Stores the data point 12345, timestamped with the current date and time

Again, check out the Github repo for more examples.


← back to blog index