Making galvos controled by 'sound'

Hello, i am trying to make something like rotating galvos for laser positioning, i have few questions regarding the design.

I posted it here cause ill be producing some kind of continous square waves.

I have for now few options in mind:

  • Use Tone function
  • use PWM
  • use single digitalWrite with a digital potentiometer

I already bought mono audio amplifiers to make sure ill output desired signal but boosted but they do have potentiometers that are adjustable with screwdriver, so maybe ill have to use digital potentiometer here too before connecting that directly to speaker

I just began to play with arduino and stuff like that, i don't know what kind of swuare wave arduino produces and does it vary between negative and positive voltages or id it just between 0..positive voltage
However i think i might be able to reproduce that using timed digitalWrite where i will be sending a signal - audio boost will change voltage from 5V to lets say 12 V then within potentiometer ill control the voltage to speaker so it will stay in one particular position for desired amount of time.
And here comes the thing i don't understand - meaning the frequency of dc voltage itself - do i have to worry about it too or if its higher than 100 KHz i can simply not to care ?
The reason i ask this is that i want to make a laser galvo which is something similar to a speaker and the voltage applied there needs to be constant for a desired amount of time ( i think for now it will be about 1/30 of second )

The second thing is that the potentilmeter is a resistor and as far as i know it doesnt work that way that i can simply change the voltage with it.

So lets make a summary:( this is a simplified case i want to talk about)
Imagine i have a speaker connected to arduino i want to apply a voltage between 0..5V to it by desired amount of time making it (the speaker) extend its membrane by some distance. How would i do it?

Thanks in advance.
I want to apply

does it vary between negative and positive voltages or id it just between 0..positive voltage

From zero to the working voltage of the processor, so 5V or 3V3 depending on the type of Arduino.

The second thing is that the potentilmeter is a resistor and as far as i know it doesnt work that way that i can simply change the voltage with it.

Yes it does, you connect the top of the pot to the signal, the bottom to ground and then the signal is taken from the wiper and is continuously variable depending on the pots position.

However you are misunderstanding things.

An audio amplifier will be AC coupled so you will never get DC through it.

A valve will not move in line with a square wave, it is a mechanical device and the response between a signal and the movement will not be a match. Your servo will act like a filter.

If you set a digital pin high and then after a time set it low, that is not a DC signal, it is in fact an AC one even though it doesn’t go negative. That is what the tone function does. PWM will also work because your galvo is acting like a filter.

You just need to preset your galvo here is no need to use a digital pot.

You should AC couple the output to a galvo otherwise you only get half the swing from it. This is as simple as putting the signal through a capacitor.

Thanks for claryfying things up, i have another question how i could use a digital potentiometer with voltage higher than 5V (actually i want to apply 12V here) and steer the value of resistance with arduino, or maybe i need to use something else for that?

ConcernedDude:
Thanks for claryfying things up, i have another question how i could use a digital potentiometer with voltage higher than 5V (actually i want to apply 12V here) and steer the value of resistance with arduino, or maybe i need to use something else for that?

What are you trying to do with this digital pot? Its rare to need one, DACs are usually what you want unless
you are actually adjusting volume of an audio/analog signal or similar.

I want.to apply voltage between 0..12V to the speaker and be able to control it(voltage) from arduino

ConcernedDude:
I want.to apply voltage between 0..12V to the speaker and be able to control it(voltage) from arduino

You should use the digital pot on the Arduino’s output ahead of a x2.5 operational amplifier. You are going to need an amplifier anyway to get to 12V so you might as well control the wave while it is small. A bigger concern is getting a bi-directional signal with a D.C. response.