We are happy to announce a new update – the r2.1.2 Patch p02 is available!
One of the most exciting features of the update is a tweak on the library AWS IoT, which allows you to connect your sensor device to the AWS in only 15 lines of code in Python.
The update also introduces 12 new libraries, support for Gennann, a powerful Artificial Neural Networks library, and support for AWS Hexagon v1 development board among other things.
To see the full list of updates and improvements our team has made, read this community post.
From Sensor to Cloud in 15 lines of Python
With this newest example, it is possible to send data to the cloud in just 15 lines of simple Python. The example shows how to connect your device to AWS IoT and start sending data gathered from a plugged sensor.
Take a look at the code:
from wireless import wifi
from espressif.esp32net import esp32wifi as wifi_driver
from bosch.bme280 import bme280
from aws.iot import iot, default_credentials
endpoint, mqttid, clicert, pkey = default_credentials.load()
thing = iot.Thing(endpoint, mqttid, clicert, pkey)
sensor = bme280.BME280(I2C0)
We will go further into detail of this example in one of our future posts, so stay tuned.
Support for AWS Hexagon v1 development board
The AWS Hexagon v1 development board by Tekt Industries has also been added to the list of Zerynth supported boards with this update. This development board mounts on-board the official ESP32 WROOM32 module by Espressif Systems.
AWS Hexagon v1 contains a dual-core ESP32 chip, 4 MB of SPI Flash, tuned antenna, and The ESP32 microcontroller has both WiFi and Bluetooth Classic/LE support. You can learn more about it in the official Zerynth Docs.
You can see the full list of supported boards here.
Gennann, a powerful Artificial Neural Networks library
Genann is a minimal, well-tested library for training and using feedforward artificial neural networks (ANN) in C. With this update we have added support for it and now you can use it with simple Python.
Here you can see the code example our team has made, called “Hello XOR”:
from genann import genann
# create an ANN object
ann = genann.ANN()
# set the layers: 2 inputs, 1 output, 1 hidden layer of 2 neurons
# set the weights of a pretrained XOR model (https://github.com/codeplea/genann/blob/master/example/xor.ann)
# define the inputs
input_set = [
[0.0, 0.0], # 0 xor 0 = 1
[0.0, 1.0], # 0 xor 1 = 0
[1.0, 0.0], # 1 xor 0 = 0
[1.0, 1.0] # 1 xor 1 = 1
# run the network for each input set
for i in input_set:
print("Running XOR on",i)
out = ann.run(i)
# Enjoy AI on a microcontroller! :)
except Exception as e:
Download Zerynth Studio
To access all these amazing features (and more) download Zerynth Studio. Start your own adventure with Python programming. Zerynth Studio is free and available for Windows, Linux, and Mac OS.