กลับไปหน้ารวมไฟล์
scaling-an-image-in-processing-with-ultrasonic-sensor-a9f593-en.md

Introduction

In this project we are going to scale the size of an image using the distance value acquired from an HC-SR04 ultrasonic sensor. The lower the distance, smaller the image size; farther the distance, bigger the image size.

Construction

As you can see in the circuit connect the trigger pin of HC-SR04 sensor to digital pin 12, echo pin to digital pin 11 and VCC of sensor to 5v of arduino and GND to GND of arduino.

  • Digital 12 to Trigger
  • Digital 11 to Echo
  • 5V to VCC
  • GND to GND

https://playground.arduino.cc/Code/NewPing#Download

EXPANDED TECHNICAL DETAILS

Interactive Spatial Graphic Interface

This project uses spatial depth to control the "Zoom" level of a digital image on a PC, creating a non-touch interactive display.

  • Proximity-to-Scale Mapping: The Arduino captures distance data from an HC-SR04 sensor and sends it over serial. On the PC, a Processing script receives this value and maps it to the image scale factor (e.g., 20cm = 1.0x, 5cm = 3.0x).
  • Smooth Transition Filtering: The Processing script applies a "Linear Interpolation" (LERP) algorithm to the incoming data, ensuring the image scales smoothly without the "jumping" effect caused by sensor noise.

Creative Strategy

  • Presence-Triggered Interaction: (Features) If the sensor detects a user within 1 meter, the display "Wakes Up" and begins the interactive scaling show, returning to a standby animation when the user leaves.

ข้อมูล Frontmatter ดั้งเดิม

title: "Scaling an Image in Processing with Ultrasonic Sensor"
description: "In this project, we are taking the distance value from an ultrasonic sensor and scaling the dimension of an image accordingly."
author: "najad"
category: ""
tags:
  - "communication"
  - "processing"
views: 10129
likes: 15
price: 299
difficulty: "Intermediate"
components:
  - "1x Ultrasonic Sensor - HC-SR04 (Generic)"
  - "1x Arduino UNO"
tools: []
apps:
  - "1x Processing"
downloadableFiles:
  - "https://gist.github.com/onajad/e53b1bccac30cf43645eeb90ae964a6a#file-ultrasonic_processing-pde"
  - "https://gist.github.com/onajad/e53b1bccac30cf43645eeb90ae964a6a#file-ultrasonic_processing-pde"
documentationLinks: []
passwordHash: "cdb786f616b4ea9b2cc9adcc38490d409cfccf570ecff15ba3cb68c684f4383d"
encryptedPayload: "U2FsdGVkX19gB2arHqyZ08IWBAluuaIFwCxQ/vU2zdkhuoqcp2xVzK71+zgRndkj2gUtTREO6pq/rPBxeaH/wLjHJY9bw0YP8NqhirqtBTQ="
seoDescription: "Scale images in Processing using real-time distance data from an Ultrasonic Sensor."
videoLinks:
  - "https://www.youtube.com/embed/WDUCyJpbbM0"
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/scaling-an-image-in-processing-with-ultrasonic-sensor-a9f593_cover.gif"
lang: "en"