This lesson uses: Arduino UNO R3 board, TinkerBlock TK59 Piezo-Ceramic Sensor module, jumper wires (or breadboard). Use analog input to read the piezo sensor; outcome: serial shows the vibration value (0–1023); a tap makes it jump.
1. Wiring
Connect TK59 Piezo-Ceramic Sensor to Arduino:
- GND → Arduino GND
- SIGNAL → Arduino A0
- The two NC pins stay unconnected. The block has no VCC pin: the disc makes its own voltage, and the pad printed VCC beside the disc is its red lead, not a supply.

2. New sketch
- Arduino IDE: File → New (or Ctrl/Cmd + N) to create a blank sketch
- Confirm board and port are selected (same as Lesson 01)
- Type the code below into the default
setup()andloop()yourself
3. Program structure
Same as last lesson: two fixed blocks setup() and loop().
setup(): Start serial; runs once.loop(): Keep repeating “read analog value → print to serial → wait → repeat”.
Tap the piezo and the serial value will jump—upload and try.
4. Code to write
Type the code below into setup() and loop() (do not copy-paste; typing it yourself helps you remember):
// Piezo sensor on A0; pressure/vibration changes output voltage, ADC 0-1023
#define PIEZO_PIN A0
void setup() {
Serial.begin(9600);
Serial.println("Piezo sensor program started");
}
void loop() {
int val = analogRead(PIEZO_PIN); // Read A0; more pressure/vibration = higher value
Serial.print("Pressure: ");
Serial.println(val);
delay(100); // Poll every 100 ms
}Program notes
Overall idea: The disc makes a voltage when it is bent, and only while it is changing: a 1 MΩ resistor drains it, so a steady press reads close to 0. A0 reads it; a harder tap gives a higher value. This lesson only prints the raw value; you can use it for thresholds or simple strength comparison.
| Code | In this lesson |
|---|---|
analogRead(PIEZO_PIN) | Read A0, 0–1023; a harder tap reads higher |
5. Hands-on
- After entering the code, click Verify (✓) to compile
- Click Upload (→) to upload to the board
- Open Serial Monitor (Tools → Serial Monitor, baud 9600)
- Watch serial: close to 0 at rest
- Tap the sensor and see the value jump
Expected result:
Serial monitor:
Piezo sensor program started
Pressure: 0
Pressure: 0
Pressure: 368
...
A tap makes the value jump, then it falls back. A reading every 100 ms catches only part of a tap, so the same tap can read high one time and low the next; the TK59 handbook samples fast enough to catch the peak.
Note: TK96 Mechanical Key LED is different (key + LED); you can try it.
Proceed to Lesson 37.
Edit this page — content/guides/tinkerblock-workshop/36-piezo-sensor.mdx
Questions about this product
See what other owners have asked, and read their solutions.
Piezo-Ceramic Sensor
Loading discussions…
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.