Design IoT Solutions Using Python and Zerynth

by:INDUSTRIAL-MAN     2019-09-14
Would you prefer to write code in python?
If so, Zerynth is a set of professional development tools that support 32-Python or hybrid C/Python firmware developmentbit micro-
Controllers and the most common prototype boards: Arduino DUE, ST Nucleo, particle photons and electrons, flip and click, ESP32, ESP8266, etc.
In this guide, we will explore Python code development in Zerynth Studio and how to visualize your results using the simplicity of Ubidots data visualization.
Zerynthis is not just another programming library for Arduino-related sensor kits.
Zerynth is a set of professional development tools developed from scratch that can enter the embedded world with just a few mouse clicks.
Beyond professional embedded developers, Zerynth also provides a complete set of high-end for web programmers, product designers and IoT system integrators
Program microcontrollers and high-quality development tools for developing IoT solutions.
How many are Zelins?
Rapid integration with sensors, drives, and cloud services reduces product development time and effort.
In the guide below, we will introduce you to the Zerynth platform using ESP32 DevKitC connected to the theUbidots cloud.
After completing this guide, you will be able to visualize the sensor data of the motherboard in Ubidots and control the LED using the large amount of code provided. 1.
If required, download and install Zerynth Studio using the installation guide for additional assistance. 2.
Next, keep an eye on the Getting Started Guide in the Connect, register and virtualize your devices section.
Once your device is properly virtualized in Zerynth, you can continue to use this guide.
FAQ and trouble shooting: for Windows and Mac users, if an error is received when creating a virtual machine, verify that the latest driver is installed.
For Linux users, access is allowed to add the user to the serial port in the group and the required read/write access is provided: 1.
Create a new Zerynth project.
To do this, press the browser project> to create a new project, and then assign the project title and project folder.
To complete, press create \". 2.
Next, your new Zerynth project will automatically open to \"main \". py\" file. This main.
Pyis, the main Zerynth code will be written in Python or hybridC/Python.
Here\'s where we develop any script logic. 3.
After creating the project correctly, copy and paste the sample code provided below into \"main. py\" file.
After pasting the code, assign the Ubidots token and WiFi credentials at the location indicated in the code.
If you don\'t do this how to find the Ubidots mind, please refer to the Ubidots Help Center.
Deployment note: In this sample code, the device label is set to \"ESP32\" and the variable label is set to \"temperature \".
This means that your request will be sent with these parameters.
If you wish to change this sample code, please change it as needed.
Refer to this guide for getting code.
This sample script released a POST HTTPrequest to the Ubidots cloud.
Release a variable containing analog pin readings (A0)
DevKitC of ESP32.
Send more values using your device\'s reference to the ubidrest API to learn how to build your own HTTP request. 4.
With the paste and update of the code, you must verify the credentials next.
To verify, press \"check-mark\". 5.
Once the script is verified correctly, it\'s time to put the script up into the ESP32DevKitC.
To make the script go up, press the \"up arrow\" icon.
Wait a few seconds until the script is uploaded to the motherboard.
Once the uplink is completed, you will receive the \"uplink completion\" message in the terminal log of Zerynth Studio. 6.
Open the status of the console debugging request;
Press the terminal icon to open the console.
First, the console will report the connection status.
You will then start receiving the status of the HTTP request to Ubidots.
FAQ and trouble shooting: If you open the console but can\'t visualize the debug message, press the reset button in ESP32 DevKitC to start receiving the message. 7.
Go to the \"devices\" section of the business account Ubidots and verify the received message: 1.
Go to the devices section of the Ubidots account and open to the device named ESP32 created in the previous step. 2.
Press add variable 3 to create a new default variable called control. Follow the on-screen point-and-
Click Application Builder to populate the new variable.
After creating the variable, the device dashboard should look like this. 4.
Go to the main Ubidots and create a control widget.
Click on the yellow plus sign (+)
Icon and deploy the new dashboard widget as per the options on the screen.
Select Control> switch> ESP32> control (
Variables just created> Finish.
Once the new widget is built, the dashboard will reload and populate the new widget.
The \"switch\" widget will send its status to the ESP32DevKitC to control the status of the led. 5.
Follow the same steps provided in the previous steps (
Release value Ubidots)
, Set up a new project in Zerynth and name the project according to your preference.
Then, copy and paste the following script in \"main.
During this process, the py \"file assigns your Ubidots token and WiFi credentials.
Refer to this guide for getting code. 6.
After modifying the parameters, verify the script and upload it to the ESP32DevKitC. 7.
When the uplink is over, open the console.
First, after you open the console, you will receive the connection status, and then you will start receiving the HTTPrequest status and LED status of Ubidots.
FAQ and trouble shooting: If you open the console but can\'t visualize the debug message, press the reset button in ESP32 DevKitC to start receiving the message. 8.
Changing the status of the \"switch\" widget from Ubidots will result in a change in the LED status in the console and in real life.
A few minutes later, you have sent an HTTP request to the Ubidots cloud using Python code uploaded with Zerynth espesp32 DevKitC.
Also, compare the sample code with any 32-bitmicro-
With Zerynth-supported controllers, you can quickly prototype and deploy by simply assigning the correct WiFi driver in the micro-controller.
For additional information on the Zerynth Python firmware platform, check the documentation for Zerynth.
It\'s time to redesign the code to deploy your own application.
Control and manage your environment with 32-zerynthbit micro-
Controller, Ubidots.
To learn more about creating Ubidots and events, check out these video tutorials. Happy Hacker :)
Custom message
Chat Online 编辑模式下无法使用
Chat Online inputting...