Telemetrix For The Arduino Nano RP2040 Connect

Telemetrix For The Arduino Nano RP2040 Connect © GPL3+

Remotely control and monitor a Nano Connect using Python over WiFi.

  • 0 respects

Components and supplies

About this project


Have you ever wanted to be able to quickly prototype an Arduino project using Python from your laptop or PC?

Or, perhaps you need to control and monitor an Arduino Nano RP2040 Connect remotely but do not wish to give up the performance of a C-based Arduino sketch?

Would you like to be informed of any GPIO data changes without constantly polling to determine if any changes occurred? Would having a timestamp for each data change be a valuable addition to your project?

You can enjoy all of these features with the Telemetrix library for the Nano RP2040 Connect!

How Does It Work?

A Telemetrix application consists of a client written in Python using the Telemetrix API and a server, an Arduino resident sketch, written in C/C++.

For the Nano RP2040, the client and server communicate over Wi-Fi using TCP/IP. Once configured and saved with your network SSID and password, the server does not need additional programming.

A Python asyncio API is also available if you wish to work in an asyncio environment.

Callbacks Are Cool

Telemetrix utilizes the concept of a callback function to report the data changes to your application. You register your callback function with Telemetrix when you set the mode of operation for the pin. Once you establish a callback for an input pin, your application is automatically notified of the data change. There is no need for polling.

A Simple Example

To demonstrate how easy it is to create a Telemetrix application, let's look at the code to set pin 11 as a digital input with pullups enabled.

import sys
import time
from tmx_nano2040_wifi import tmx_nano2040_wifi
Monitor a digital input pin with pullup enabled
# The callback data is provided as a list.
# These are the list
# This is an index to the pin mode.
# This is an index to the reporting pin number
CB_PIN = 1
# This is an index to the reported data change
# This is an index to the raw timestamp the change occurred
def the_callback(data):
    """    A callback function to report data changes.    This will print the pin number, its reported value and    the date and time when the change occurred
    :param data: [pin mode, pin, current reported value, 
                  pin_mode, timestamp]    """
    # convert the raw timestamp into human readable format
    date = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(data[CB_TIME]))
    print(f'Report Type: {data[CB_PIN_MODE]} Pin: {data[CB_PIN]} '
          f'Value: {data[CB_VALUE]} Time Stamp: {date}')
# Instantiate the telemetrix class providing the IP address 
# of the Nano RP2040.
board = tmx_nano2040_wifi.TmxNano2040Wifi(ip_address='')
# Set the pin mode for pin 11 and establish the callback.
board.set_pin_mode_digital_input_pullup(11, the_callback)
    # wait forever reporting all data changes.
    while True:
except KeyboardInterrupt:
    # perform an orderly shutdown

The callback in this example will generate a report that looks like this:

Report Type: 2 Pin: 11 Value: 1 Time Stamp: 2021-09-29 16:35:16

Once you enable the pin as an input pin, all data changes are automatically reported by the server from that moment forward.

Example Applications Are Available For Download

There is a set of tested and working examples available to demonstrate the API's use.

What Features Does The API Support?

  • Analog and Digital GPIO.
  • SPI and I2C communications Protocols.
  • Control and monitoring of the onboard IMU, Microphone, and RGB LED.
  • HC-SR04 type distance sensors.
  • DHT type humidity/temperature sensors.
  • NeoPixels.

Why Not Give It A Try?

If you prefer to program in Python or access the Nano RP2040 Connect remotely, using Telemetrix may simplify and shorten your development cycle.


This is the repository to the Python Telemetrix client.
This is the Telemtrix server.


Add projectSign up / Login