- OllieLearnsCode
- Posts: 1
- Joined: Fri Oct 24, 2025 7:25 pm
Pi Pico Pressure sensor as pen tablet input
Hello,
I have a pi pico and a Circular forse sensitive resistor
This code reads the pressure and it works well. However, I now want windows to recognise this input as a pen tablet pressure. I believe I can do this with the usb_hid module but I get an error that it isn't found. How do i get the usb_hid input working no my pi Pico? thanks
I have a pi pico and a Circular forse sensitive resistor
Code: Select all
from machine import Pin, ADC
import time
fsr_pin = ADC(26)
NOISE = 1000
MAX_RAW_VALUE = 65535
print("FSR started")
def pressure_percentage(raw_adc):
if raw_adc<NOISE:
return 0
percentage = (raw_adc - NOISE)/(MAX_RAW_VALUE - NOISE)*100
return round(percentage, 1)
while True:
raw_value = fsr_pin.read_u16()
print (pressure_percentage(raw_value))
time.sleep(0.2)Re: Pi Pico Pressure sensor as pen tablet input
My understanding is the MicroPython USB_HID module is only available for the PyBoard port and not the for the Pico / RP2 port.OllieLearnsCode wrote: ↑Fri Oct 24, 2025 7:38 pmI believe I can do this with the usb_hid module but I get an error that it isn't found.
CircuitPython, based on MicroPython, does appear to have a usb_hid module which works with Pico / RP2 devices so that's probably the easiest path to take.
Re: Pi Pico Pressure sensor as pen tablet input
But you do have machine.USBDevice on the RP2.
https://docs.micropython.org/en/latest/ ... evice.html
https://github.com/micropython/micropyt ... usb#readme
https://docs.micropython.org/en/latest/ ... evice.html
https://github.com/micropython/micropyt ... usb#readme
Jump to
- Community
- General discussion
- Announcements
- Other languages
- Deutsch
- Español
- Français
- Italiano
- Nederlands
- 日本語
- Polski
- Português
- Русский
- Türkçe
- User groups and events
- Raspberry Pi Official Magazine
- Using the Raspberry Pi
- Beginners
- Troubleshooting
- Advanced users
- Assistive technology and accessibility
- Education
- Picademy
- Teaching and learning resources
- Staffroom, classroom and projects
- Astro Pi
- Mathematica
- High Altitude Balloon
- Weather station
- Programming
- C/C++
- Java
- Python
- Scratch
- Other programming languages
- Windows 10 for IoT
- Wolfram Language
- Bare metal, Assembly language
- Graphics programming
- OpenGLES
- OpenVG
- OpenMAX
- General programming discussion
- Projects
- Networking and servers
- Automation, sensing and robotics
- Graphics, sound and multimedia
- Other projects
- Media centres
- Gaming
- AIY Projects
- Hardware and peripherals
- Camera board
- Compute Module
- Official Display
- HATs and other add-ons
- Device Tree
- Interfacing (DSI, CSI, I2C, etc.)
- Keyboard computers (400, 500, 500+)
- Raspberry Pi Pico
- General
- SDK
- MicroPython
- Other RP2040 boards
- Zephyr
- Rust
- AI Accelerator
- AI Camera - IMX500
- Hailo
- Software
- Raspberry Pi OS
- Raspberry Pi Connect
- Raspberry Pi Desktop for PC and Mac
- Beta testing
- Other
- Android
- Debian
- FreeBSD
- Gentoo
- Linux Kernel
- NetBSD
- openSUSE
- Plan 9
- Puppy
- Arch
- Pidora / Fedora
- RISCOS
- Ubuntu
- Ye Olde Pi Shoppe
- For sale
- Wanted
- Off topic
- Off topic discussion