In a recent article, we’ve seen how to control an Adafruit NeoPixel ring via mobile using Python and JQWidgets.

Let’s do something similar but using another very popular “actuator”: a Servo Motor, that is a rotary actuator used for precise control of angular position.

We’ll use Zerynth Studio to program the microcontroller-based board in Python and Zerynth App to run the JQWidget-based graphical user interface.

Required Material

Last but not least, you need:

  • Zerynth Studio, our powerful IDE for embedded programming in Python that enables the IoT. You can download it here.
  • Zerynth App. You can download it here.


Just put the WiFi 4 Click on the slot “A” of the Flip&Click and connect the Servo as follows:

  • Brown wire of the Servo to the GND pin of the Flip&Click
  • Orange wire of the Servo to the 3.3V pin of the Flip&Click
  • Yellow wire of the Servo to a PWM  pin of the Flip&Click (for example D2)



Once you have installed Zerynth Studio and created a Zerynth user, you have to register and virtualize the board. Take a look at the Zerynth official documentation for the Particle Photon for a quick getting started.

Now you can start to program your board in Python!

Create a new project and edit the file as follows:

Of course, you have to edit the SSID name and the PASSWORD of the wifi network you want to connect the board.

As you can see comparing the script of the project mentioned above, the logic is the same and the code is very similar. Just a few differences:

  • In this case, we’ve used a different wifi driver so you have to import the SPWF01SA module instead of the BCM43362 module for the WiFi connection.
  • Of course, you have to import and setup the Servo library instead of the Neopixel library.
  • Then, you have to define a function that sets the degree of the servo according to the data sent by the Zerynth App. So you have to define a function “set_degree” instead of the function “set_color” of the previous project.

The rest of the code remains pretty much the same. Easy, huh? Say thanks to our Zerynth Virtual Machine and its hardware abstraction layer features.

Just another step and you’re done!

In this project too, you have to create a “connected device” and link the “zerynthapp” instance to it. Then you have to create and link a template to the connected device. Take a look at the “Create and set up a connected device” and “Create, upload and set the Template” steps of this tutorial for more details.

The index.html file should look like this:

In this case, we’ve used the jqxKnob” element of the JQWidgets collection. The main part of this code is

The function is the channel from Javascript to Python. Every time you move the knob, the function sends the value to the device and it is used as argument of the corresponding Python function.

At this point, you can uplink the project to your device.

Finally, as you can read in this very brief tutorial, you just have to open the Zerynth App, log-in and select the specific device to see your GUI.

Enabling Firmware Over-the-Air (FOTA) updates with Zerynth Studio PRO

Once you’ve built your smart project, you wouldn’t want to disassemble everything to upgrade the firmware.

To meet this specification, Zerynth has included the “Firmware Over-the-Air” feature within the Zerynth Studio PRO version, that also includes industrial-grade features like:

  • Selectable RTOS
  • Power Saving
  • Hardware-driven Secured Firmware burned on the device at industrial volumes
  • …and much more