Summary of Jetson/Tutorials/GPIO using arduino
This article details how to test and control a GPIO pin (GPIO_PH1, gpio57) on the Jetson TK1 by setting it as an output through Linux sysfs interface commands. It explains how to measure the voltage changes on the pin and highlights that the 1.8V output cannot drive an LED directly due to low current and voltage. To control an LED or send signals to an Arduino, a transistor switch circuit powered by a 5V supply from the Jetson TK1 is recommended.
Parts used in the Jetson TK1 GPIO Testing and LED Control Project:
- Jetson TK1 board
- Volt meter
- Dual-row header (J3A1) on Jetson TK1
- LED
- Transistor switch circuit components (transistor, resistors)
- 5V power supply from Jetson TK1 pin 1 on J3A1
- Connecting wires
Quickly testing a GPIO pin
To set pin GPIO_PH1 as an output:
sudo su (Enter your user password. Defaults to "ubuntu") # See which pins are currently configured as GPIO, and what their state is. cat /sys/kernel/debug/gpio # Validate that the entry for the Tegra GPIO controller has a base value of 0. If not, add on whatever the base value is to the “57” in the commands below.
echo 57 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio57/direction echo 1 > /sys/class/gpio/gpio57/value
Put a voltmeter on pin 50 (gpio57) of the 2-row header (J3A1) & pin 2 (GND) also of the 2-row header,
You should now see that it is at +1.8V. This pin is LCD_BL_PWM (GPIO_PH1). Setting it to 0:
echo 0 > /sys/class/gpio/gpio57/value
You should now see that it is at 0.0V (roughly).
Once you’re done:
echo 57 > /sys/class/gpio/unexport exit
Turning an LED on/off or sending a signal to an Arduino microcontroller from Jetson TK1
You can now set a 1.8V voltage on a GPIO pin, but the GPIO pins on Jetson TK1 don’t have enough electrical current or power to connect directly to an LED and also, 1.8V is a lower voltage than you normally want. So the easiest way to control a single LED from Jetson TK1 is to build a transistor switch circuit, as shown in the circuit diagram (which you can download for the free KiCad package here):
Connect the red wire (+5V) to pin 1 on J3A1 of Jetson TK1 (bottom-right pin of the dual-row header, next to the text saying “DISPLAY TOUCH”) to power the LED from Jetson TK1.
For more detail: Jetson/Tutorials/GPIO