Scaling image using ultrasonic sensor and Processing


As our WhatsApp group member has requested we are going to scale the size of an image using the distance value acquired from an ultrasonic sensor HC SR04. shower the distance smaller the image size and farther the distance bigger the size of the image.



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 the sensor to 5v of Arduino and GND to GND of Arduino.

 Arduino UNO 


 Digital 12  Trigger
 Digital 11  Echo
 5V  VCC

The Arduino code is a library example with a small change, We will be needing “new ping” library to compile our Arduino code. You can download it here




Hardware Required

ComponentsAmazon.inamazonAmazon.comamazonBanggoodbanggoodAliExpressali expressUtsource
utsource logo
Arduino UNOcart iconcart iconcart iconcart iconcart icon
HC SR 05 Ultrasonic Modulecart iconcart iconcart iconcart icon

To buy electronic components order from UTSOURCE

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top