Skip to main content

Command Palette

Search for a command to run...

Hello World, RDK X5

Updated
2 min read
Hello World, RDK X5

In the software world, it is customary to start a new programming language with 'Hello, World'. The equivalent of this in the electronics world is lighting up an LED.

And that's what we are going to do on the RDK X5, a relatively new AI Microcontroller board along the lines of Nvidia's Jetson Nano.

I feel that the official documentation is needlessly complicated. Here's probably the simplest tutorial to light up the humble LED on the X5.

Hardware

The LED is connected in series with a 330 Ω resistor powered by GPIO pin 37 and grounded on pin 39 on the X5.

Software

import Hobot.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)
GPIO.setup(37, GPIO.OUT)
GPIO.output(37, GPIO.HIGH)

2 jumper cables and 4 lines of code and then there was light!

(Don't go to battle with the above code. You need to reset, cleanup and guard critical sections in a try/catch block. The above is simply to help you get started)

Explanation

The X5 comes with a 40 Pin header like the Raspberry Pi. The top row is even numbered and the bottom row is odd numbered.

There are 8 Ground Pins and 10 GPIO Pins on the X5. For the example above Pins 37 and 39 were used (bottom right).

A GPIO can be configured as a input pin or as an output pin. Since we want to light up an LED, we are configuring it as a output pin in the code above. If this were hooked up to a sensor, then the pin would be configured as an input pin.

GPIO pins can have two states - on and off (high and low). In the high state, a voltage of 3.3V is applied which lights up the LED. In the low state, the voltage is withdrawn which turns off the LED.

So it acts like a light switch. What if we want to convert this into a dimmer switch? Hmm...

18 views