


Leave the default values, but you could even change the serial number, manufacturer and product name to fit your specific needs. Open the file with: :~ $ sudo nano /usr/bin/isticktoit_usb Here’s how your file should look like (to save the file, press Ctrl+X followed by Y and Enter):įor this project, we will turn the Raspberry Pi into a USB keyboard, but you could make it work as a Serial adapter, Ethernet adapter, and Mass Storage. Then, you need to run this script automatically at startup. Open /etc/rc.local with this command: :~ $ sudo nano /etc/rc.localĪdd the following before the line containing exit 0: /usr/bin/isticktoit_usb # libcomposite configuration Create a new file called isticktoit_usb in /usr/bin/ and make it executable: :~ $ sudo touch /usr/bin/isticktoit_usb :~ $ sudo chmod +x /usr/bin/isticktoit_usb The configuration is volatile, so it must run on each startup. The configuration is done via ConfigFS, a virtual file system located in /sys/. Now, you have to define your Pi Zero (HID gadget) as a USB keyboard.

First, you need to run these three commands to enable the necessary modules and drivers: :~ $ echo "dtoverlay=dwc2" | sudo tee -a /boot/config.txt :~ $ echo "dwc2" | sudo tee -a /etc/modules :~ $ sudo echo "libcomposite" | sudo tee -a /etc/modules 2. These next steps to prepare the Pi Zero board are based on the instructions from iSticktoit.

Important: this tutorial doesn’t work with a Raspberry Pi 3 board. Parts Requiredįor this project you’ll need a Raspberry Pi Zero board. I recommend that you download my course: Build a Home Automation System for $100. If you like home automation and you want to learn more about Node-RED, Raspberry Pi, ESP8266 and Arduino.
