Arduino UNO Q - Force Sensor

A force sensor (FSR — Force Sensitive Resistor) changes its resistance based on how hard you press it. Connected to the Arduino UNO Q's 12-bit ADC with a pull-down resistor, it gives you a reading from 0 (no pressure) to 4095 (maximum squeeze). With Bridge and Telegram, you can get instant alerts and query pressure levels remotely.

In this tutorial, you will learn:

Arduino UNO Q Force Sensor

Hardware Preparation

1×Arduino UNO Q
1×USB Cable for Arduino Uno Q
1×Force Sensor (FSR)
1×10 kΩ Resistor
1×Breadboard
1×Jumper Wires
1×Recommended: Screw Terminal Block Shield for Arduino Uno
1×Recommended: Sensors/Servo Expansion Shield for Arduino Uno
1×Recommended: Breadboard Shield for Arduino Uno
1×Recommended: Enclosure for Arduino Uno
1×Recommended: Prototyping Base Plate & Breadboard Kit for Arduino UNO

Or you can buy the following kits:

1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of the Force Sensor

The force sensor (also called FSR — Force Sensitive Resistor) is a thin, flexible component that acts like a variable resistor:

  • No pressure applied: Very high resistance (several MΩ) → near-zero voltage at the analog pin
  • More pressure applied: Lower resistance → higher voltage → higher ADC reading
Force Sensor Pinout

The force sensor has two identical pins (it is a resistor — polarity does not matter). It is not suitable for precise weight measurement in grams or pounds, but is excellent for detecting touch, squeeze, or press events.

Voltage Divider Wiring

Because the FSR is just a resistor, it must be wired in a voltage divider with a known pull-down resistor (10 kΩ) to produce a measurable voltage:

3.3V ─── [FSR] ─── A0 ─── [10kΩ] ─── GND
  • When the FSR resistance is high (no pressure), A0 reads near 0
  • When the FSR resistance drops (pressure applied), A0 reads higher

12-bit ADC on Arduino UNO Q

The UNO Q MCU uses a 12-bit ADC (0–4095) with a 3.3V reference. The pressure classification thresholds in this tutorial are scaled accordingly (R4 used 10-bit 0–1023; all thresholds are multiplied by 4 for UNO Q).

Wiring Diagram

The wiring diagram between Arduino UNO Q Force Sensor

This image is created using Fritzing. Click to enlarge image

Component Arduino UNO Q MCU
Force sensor pin 1 3.3V
Force sensor pin 2 A0
10 kΩ resistor pin 1 A0
10 kΩ resistor pin 2 GND

How To Program For Force Sensor

  • Read the analog voltage at the force sensor pin:
int reading = analogRead(FORCE_SENSOR_PIN); // 0-4095
  • Classify the pressure level based on ADC value (12-bit, 0–4095):
if (reading < 40) Serial.println(" -> no pressure"); else if (reading < 800) Serial.println(" -> light touch"); else if (reading < 2000) Serial.println(" -> light squeeze"); else if (reading < 3200) Serial.println(" -> medium squeeze"); else Serial.println(" -> big squeeze");

Arduino UNO Q Code

The Arduino UNO Q has two processors working together:

  • The STM32 MCU reads the force sensor analog value every second and classifies the pressure level
  • The Qualcomm MPU runs Debian Linux with Wi-Fi — in this section, only the MCU is programmed. A later section shows how both processors work together via Bridge.
/* * This Arduino UNO Q code was developed by newbiely.com * * This Arduino UNO Q code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-force-sensor */ // COPYRIGHT newbiely.com // AUTHOR: newbiely // This code is made available for public use without restriction. // For complete instructions, tutorials, and further information, visit: // https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-force-sensor // Force Sensor (FSR) — Analog reading via voltage divider with 10kΩ pull-down resistor // Arduino UNO Q MCU: 12-bit ADC (0-4095), 3.3V reference #define FORCE_SENSOR_PIN A0 // The Arduino UNO Q MCU pin connected to the FSR void setup() { Serial.begin(9600); Serial.println("Arduino UNO Q Force Sensor ready"); } void loop() { int reading = analogRead(FORCE_SENSOR_PIN); // 0-4095 Serial.print("Force sensor reading = "); Serial.print(reading); if (reading < 40) // no pressure Serial.println(" -> no pressure"); else if (reading < 800) // light touch Serial.println(" -> light touch"); else if (reading < 2000) // light squeeze Serial.println(" -> light squeeze"); else if (reading < 3200) // medium squeeze Serial.println(" -> medium squeeze"); else // big squeeze Serial.println(" -> big squeeze"); delay(1000); }

Detailed Instructions

First time with Arduino UNO Q? Follow the Getting Started with Arduino UNO Q tutorial before proceeding.

  • Connect: Wire the force sensor and resistor to the Arduino UNO Q MCU as shown in the wiring diagram.
  • Open Arduino App Lab: Launch Arduino App Lab and wait until it detects your Arduino UNO Q.
  • Create a new App: Click the Create New App button.
Create New App in Arduino App Lab on Arduino UNO Q
  • Give the App a name, for example: ForceSensor
  • Click Create to confirm.
Arduino App Lab App folders and files on Arduino UNO Q
  • Paste the sketch: Copy the MCU code above and paste it into sketch/sketch.ino.
  • Upload: Click the Run button in Arduino App Lab.
Click Run button in Arduino App Lab on Arduino UNO Q
  • Press the force sensor gently and then harder — observe the readings change in the Serial Monitor.

App Lab Console Output

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
Message (Enter to send a message to "Newbiely" on usb(2820070321))
New Line
9600 baud
[2026-04-29 09:00:01] Arduino UNO Q Force Sensor ready [2026-04-29 09:00:02] Force sensor reading = 0 -> no pressure [2026-04-29 09:00:03] Force sensor reading = 0 -> no pressure [2026-04-29 09:00:04] Force sensor reading = 528 -> light touch [2026-04-29 09:00:05] Force sensor reading = 588 -> light touch [2026-04-29 09:00:06] Force sensor reading = 1576 -> light squeeze [2026-04-29 09:00:07] Force sensor reading = 2428 -> medium squeeze [2026-04-29 09:00:08] Force sensor reading = 3164 -> medium squeeze [2026-04-29 09:00:09] Force sensor reading = 3684 -> big squeeze [2026-04-29 09:00:10] Force sensor reading = 0 -> no pressure

Bridge: Linux + MCU

This section shows how to program both processors of the Arduino UNO Q so the Linux side can read force values and receive pressure events via Bridge:

  • The force sensor is connected to the MCU — the MCU reads the analog value every 500 ms and caches it
  • The MPU cannot read the analog pin directly — it calls Bridge functions to get the raw value, pressure level, or a new-press event
  • The MPU has Wi-Fi — running full Debian Linux, it can send Telegram alerts the moment force is applied
  • Arduino_RouterBridge enables RPC communication between the two processors
  • ⚠️ /dev/ttyHS1 (Linux) and Serial1 (MCU) are RESERVED by the router — never open them in user code

MCU Code (Bridge)

/* * This Arduino UNO Q code was developed by newbiely.com * * This Arduino UNO Q code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-force-sensor */ // COPYRIGHT newbiely.com // AUTHOR: newbiely // This code is made available for public use without restriction. // For complete instructions, tutorials, and further information, visit: // https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-force-sensor #include "Arduino_RouterBridge.h" #define FORCE_SENSOR_PIN A0 // The Arduino UNO Q MCU pin connected to the FSR // Cached values int cached_value = 0; String cached_pressure = "no_pressure"; bool pressure_event = false; bool prev_pressed = false; unsigned long last_read_ms = 0; const unsigned long READ_INTERVAL = 500; String get_value(String arg) { return String(cached_value); } String get_pressure(String arg) { return cached_pressure; } String get_event(String arg) { if (pressure_event) { pressure_event = false; return "pressure_detected"; } return "none"; } String classify(int reading) { if (reading < 40) return "no_pressure"; if (reading < 800) return "light_touch"; if (reading < 2000) return "light_squeeze"; if (reading < 3200) return "medium_squeeze"; return "big_squeeze"; } void setup() { Bridge.begin(); Monitor.begin(); Bridge.provide("get_value", get_value); Bridge.provide("get_pressure", get_pressure); Bridge.provide("get_event", get_event); Monitor.println("Arduino UNO Q Force Sensor Bridge ready"); } void loop() { unsigned long now = millis(); if (now - last_read_ms >= READ_INTERVAL) { last_read_ms = now; cached_value = analogRead(FORCE_SENSOR_PIN); cached_pressure = classify(cached_value); bool is_pressed = (cached_value >= 40); if (is_pressed && !prev_pressed) { pressure_event = true; Monitor.print("Pressure detected: "); Monitor.println(cached_pressure); } else if (!is_pressed && prev_pressed) { Monitor.println("Released — no pressure."); } prev_pressed = is_pressed; } }

Python Code (Bridge)

/* * This Arduino UNO Q code was developed by newbiely.com * * This Arduino UNO Q code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-force-sensor */ # COPYRIGHT newbiely.com # AUTHOR: newbiely # This code is made available for public use without restriction. # For complete instructions, tutorials, and further information, visit: # https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-force-sensor from arduino.app_utils import * import time def loop(): value = Bridge.call("get_value") pressure = Bridge.call("get_pressure") print(f"Force value: {value} Pressure: {pressure}") time.sleep(1) App.run(user_loop=loop)

Detailed Instructions

  • Connect: Wire the force sensor and resistor as shown in the wiring diagram.
  • Open Arduino App Lab and create a new App named ForceSensorBridge.
  • Paste the MCU sketch into sketch/sketch.ino.
  • Paste the Python code into the Python file.
  • Install the library: Click the Add sketch library button (the open book icon with a + sign) in the left sidebar.
Add sketch library in Arduino App Lab on Arduino UNO Q
  • Search for Arduino_RouterBridge created by Arduino and click the Install button.
My Apps / DIYables Apps
Run
Bricks
No bricks added...
Sketch Libraries
No sketch libra...
Files
python
sketch
.gitignore
README.md
app.yaml
sketch.ino
Add sketch library
Arduino_RouterBridge Arduino

This library provides a simple RPC bridge for Arduino UNO Q boards, allowing communication between the board and other devices using MsgPack serialization.

0.4.1
Install
More Info
  • Upload: Click the Run button.
Click Run button in Arduino App Lab on Arduino UNO Q
  • Press the force sensor — observe the event and pressure level appear in both consoles.

App Lab Console Output

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
Message (Enter to send a message to "Newbiely" on usb(2820070321))
New Line
9600 baud
[2026-04-29 09:00:01] Arduino UNO Q Force Sensor Bridge ready [2026-04-29 09:00:06] Pressure detected: light_touch [2026-04-29 09:00:08] Released — no pressure. [2026-04-29 09:00:12] Pressure detected: big_squeeze [2026-04-29 09:00:15] Released — no pressure.
DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
[2026-04-29 09:00:02] Force value: 0 Pressure: no_pressure [2026-04-29 09:00:03] Force value: 0 Pressure: no_pressure [2026-04-29 09:00:06] Force value: 528 Pressure: light_touch [2026-04-29 09:00:08] Force value: 0 Pressure: no_pressure [2026-04-29 09:00:12] Force value: 3684 Pressure: big_squeeze

Telegram

Receive Telegram alerts when force is applied on the Arduino UNO Q force sensor, and query pressure levels remotely.

MCU sketch: Keep the same MCU sketch from the previous Bridge section.

Python Code (Telegram)

/* * This Arduino UNO Q code was developed by newbiely.com * * This Arduino UNO Q code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-force-sensor */ # COPYRIGHT newbiely.com # AUTHOR: newbiely # This code is made available for public use without restriction. # For complete instructions, tutorials, and further information, visit: # https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-force-sensor from arduino.app_utils import * import requests import time TELEGRAM_BOT_TOKEN = "YOUR_TELEGRAM_BOT_TOKEN" CHAT_ID = "YOUR_CHAT_ID" last_update_id = 0 def get_updates(): global last_update_id url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/getUpdates" params = {"offset": last_update_id + 1, "timeout": 5} try: response = requests.get(url, params=params, timeout=10) data = response.json() if data["ok"]: return data["result"] except Exception as e: print(f"Error getting updates: {e}") return [] def send_message(chat_id, text): url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage" payload = {"chat_id": chat_id, "text": text} try: requests.post(url, data=payload, timeout=10) except Exception as e: print(f"Error sending message: {e}") def loop(): # Auto-alert on pressure detection event = Bridge.call("get_event") if event == "pressure_detected": pressure = Bridge.call("get_pressure") value = Bridge.call("get_value") print(f"Pressure detected: {pressure} value: {value}") send_message(CHAT_ID, f"⚡ Force detected: {pressure} (raw: {value})") # Handle Telegram commands updates = get_updates() for update in updates: last_update_id = update["update_id"] if "message" not in update: continue message = update["message"] chat_id = message["chat"]["id"] text = message.get("text", "").strip() print(f"Received: {text}") if text == "/start": send_message(chat_id, "Arduino UNO Q Force Sensor Bot\n" "/value - Read raw ADC value (0-4095)\n" "/pressure - Pressure level classification\n" "Automatic alert when force is applied") elif text == "/value": result = Bridge.call("get_value") send_message(chat_id, f"Force sensor value: {result}") elif text == "/pressure": result = Bridge.call("get_pressure") send_message(chat_id, f"Pressure level: {result}") else: send_message(chat_id, "Unknown command. Send /start for help.") time.sleep(0.5) App.run(user_loop=loop)

Detailed Instructions

  • Replace YOUR_TELEGRAM_BOT_TOKEN with your actual bot token from BotFather.
  • Replace YOUR_CHAT_ID with your Telegram chat ID.
  • Paste this Python code into your App's Python file (keep the same MCU sketch).
  • Click the Run button — press the force sensor to trigger a Telegram alert.

App Lab Console Output

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
[2026-04-29 09:10:00] Waiting for Telegram messages... [2026-04-29 09:10:05] Pressure detected: light_touch value: 528 [2026-04-29 09:10:10] Received: /value [2026-04-29 09:10:15] Received: /pressure
Telegram
Telegram 12:45
Welcome to Telegram!
ArduinoBot 10:19
Chatting with Arduino...
telegram-botfather
BotFather Yesterday
Your bot has been created.

ArduinoBot

bot
Today
⚡ Force detected: light_touch (raw: 528)
10:15 AM
/value
10:16 AM ✓✓
Force sensor value: 0
10:17 AM
/pressure
10:18 AM ✓✓
Pressure level: no_pressure
10:19 AM
⚡ Force detected: big_squeeze (raw: 3684)
10:20 AM
/pressure
10:21 AM ✓✓
Pressure level: big_squeeze
10:22 AM

OpenClaw

...OPENCLAW

OpenClaw support for Arduino UNO Q Force Sensor is coming soon.

...OPENCLAW

Project Ideas

You can build many useful projects with the force sensor and Arduino UNO Q:

  • Smart Doorbell: Mount the FSR under a doormat — when someone steps on it, the MPU sends a Telegram alert "Someone is at the door!", making an invisible pressure-activated doorbell
  • Grip Trainer: Squeeze the FSR as part of a hand strength exercise — Python tracks the peak pressure value each session and sends a Telegram summary with your best squeeze of the day
  • Package Weight Monitor: Place the FSR under a package on a shelf — if the package is removed (pressure drops to zero), the MPU sends a "Package removed" Telegram alert immediately
  • Press Counter: Count how many times force is detected per hour — log the count to a CSV file and send an hourly Telegram report (useful for button presses in kiosks or machinery)
  • Bed Occupancy Sensor: Place multiple FSRs under a mattress — Python receives pressure events and sends a Telegram alert when the bed is occupied or vacated (useful for monitoring elderly or patients)

Challenge Yourself

Ready to go further with the force sensor on Arduino UNO Q? Try these challenges:

  • Easy: Add a /peak Telegram command: Python tracks the highest raw ADC value ever read since startup and returns it when asked — useful for finding the maximum force applied during testing.
  • Medium: Implement a force duration tracker: record the timestamp when pressure starts (value ≥ 40) and when it ends — send a Telegram message reporting the duration each time force is released.
  • Advanced: Build a tap counter with debounce: detect rapid force presses (taps) in Python by checking if the pressure_detected event fires more than once within 2 seconds — count sequences of taps and send a Telegram message like "3 taps detected!" for patterns you define.

Learn More

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!