Ultrasonic Haptics project help

Ask questions about projects relating to: aerodynamics or hydrodynamics, astronomy, chemistry, electricity, electronics, physics, or engineering

Moderators: kgudger, bfinio, MadelineB, Moderators

Post Reply
amyCC
Site Admin
Posts: 405
Joined: Wed Apr 01, 2020 4:02 pm
Occupation: Moderator
Project Question: *
Project Due Date: *
Project Status: Not applicable

Ultrasonic Haptics project help

Post by amyCC »

Posted on behalf of student
Student is using Science Buddies kit
Project: https://www.sciencebuddies.org/science- ... c-feedback

---------------------------------
I am doing the Ultrasonic Haptic Project.

I followed all the instructions and bought all the listed parts. But no vibration is coming out of the transducer. What are common problems and their solutions.

To try and give more detail, I followed the tutorial provided by Science Buddies to build the circuit and I also downloaded the code straight from their website only changing the numPulses variable (which my science fair is focused on). See images provided below.
thumbnail_IMG_1329.jpg
thumbnail_IMG_1329.jpg (884 KiB) Viewed 3986 times
thumbnail_IMG_1330.jpg
thumbnail_IMG_1330.jpg (986.08 KiB) Viewed 3986 times
thumbnail_IMG_1331.jpg
thumbnail_IMG_1331.jpg (482.89 KiB) Viewed 3986 times
bfinio
Expert
Posts: 964
Joined: Mon Aug 12, 2013 2:41 pm
Occupation: Lead Staff Scientist, Science Buddies
Project Question: Expert
Project Due Date: n/a
Project Status: Not applicable

Re: Ultrasonic Haptics project help

Post by bfinio »

Hello,

Your H-bridge does not have power. Carefully look at FIgure 4 in the project procedure:

https://www.sciencebuddies.org/science- ... c-feedback

and notice how the wire going to the lower left corner of the H-bridge (H-bridge pin 8) is going to the power (red) bus.

In your picture, the orange jumper wire on the left side (breadboard row 17) is going to the ground bus, and it should be going to the power bus.

I believe everything else looks correct - let us know if that fixes the problem.
misobower123
Posts: 14
Joined: Mon Oct 06, 2025 2:40 pm
Occupation: Student

Re: Ultrasonic Haptics project help

Post by misobower123 »

Hello,
Please see images of my circuit and code. (the motor driver now has power)

The "on" LED on my arduino is on, i verified and uploaded the code. How do I make sure the Arduino is "producing" the frequencies?

I know the arduino shown is an R4 but i have since switched to an R3. How would i change the code to use the tone fonction if that would be easier than the current code.

[Administrator note / linked images have been attached directly.]
circuit.jpg
circuit.jpg (835.71 KiB) Viewed 3284 times
code.jpg
code.jpg (82.92 KiB) Viewed 3284 times
transducer.jpg
transducer.jpg (911.38 KiB) Viewed 3284 times
misobower123
Posts: 14
Joined: Mon Oct 06, 2025 2:40 pm
Occupation: Student

Re: Ultrasonic Haptics project help

Post by misobower123 »

My code for the Arduino Uno R3

const int trigPin = 3;
const int delayTime = 10;

const int numPulses = 100;

const int digitalWriteTime = 2;
const int offTime = 2*(digitalWriteTime+delayTime)*numPulses;
const float frequencymod = 208.33;

void setup() {
pinMode(trigPin,OUTPUT);
}

void loop() {
for(int i=0; i<numPulses; i++){
tone(trigPin, 40000);
delayMicroseconds(delayTime);
tone(trigPin,frequencymod);
delayMicroseconds(delayTime);
}
delayMicroseconds(offTime);
}

My code keeps giving me errors that. Every time I solve one another one pops up.
I tried to DIY it because the original was not working. I don't know if I made it worse or better.

Image

Thank you
bfinio
Expert
Posts: 964
Joined: Mon Aug 12, 2013 2:41 pm
Occupation: Lead Staff Scientist, Science Buddies
Project Question: Expert
Project Due Date: n/a
Project Status: Not applicable

Re: Ultrasonic Haptics project help

Post by bfinio »

Hello - a few things:

1. Unfortunately, unless you have access to an oscilloscope (which lets you view a graph of voltage on an Arduino pin), there's no easy way to tell whether the pin is actually producing the signal. One possible option would be to connect an LED with a current-limiting resistor (see our Arduino tutorial series) directly to the pin, instead of connecting it to an H-bridge, and you should see the LED light up when the signal is on.
2. One of your pictures did not attach properly in your last message, so I'm not sure what you had there.
3. See procedure step 2a for using an R3, but here is a hint for the loop section of your code. You do not need the for loop at all - that was for manually turning the pin on and off to generate the ultrasonic signal on the R4.

loop{
tone(trigPin, 40000); // this turns the ultrasonic signal on at 40kHz
delay(onTime); // this leaves the ultrasonic signal
// on for onTime milliseconds
noTone(trigPin); // this turns the ultrasonic signal off
delay(offTime); // this leaves the signal off for offTime ms
}

You can adjust the onTime and offTime variables to adjust the modulation frequency and duty cycle.
Post Reply

Return to “Grades 9-12: Physical Science”