Go Down

### Topic: how to make joystick control electricty? (Read 344 times)previous topic - next topic

#### TommyGunn

##### Feb 27, 2018, 07:18 pmLast Edit: Feb 27, 2018, 07:26 pm by TommyGunn
I would like to use a joy stick to control electricity up to 3 volts.

We are doing an experiment called galvanotaxis to control protozoa

They are attracted to negative voltage i would like to see id we can control their movements.

Normally in a very basic setup you have 2 poles Ether connected to a (platinum wire or lead from a pencil) at the opposite of each other as power increases they swim towards the negative.

up and down and left and right would be fine but 8 degree axis would be amazing!

does anyone have an example on how to do the controls for this?

Thank you

Tommy

#### rogertee

#1
##### Feb 27, 2018, 07:49 pm
you can use a joystick to control a servo or stepper motors there are a few tutorials around with joystick controllers

#### dindibo4

#2
##### Feb 27, 2018, 08:18 pm
I would like to use a joy stick to control electricity up to 3 volts.

We are doing an experiment called galvanotaxis to control protozoa

They are attracted to negative voltage i would like to see id we can control their movements.

Normally in a very basic setup you have 2 poles Ether connected to a (platinum wire or lead from a pencil) at the opposite of each other as power increases they swim towards the negative.

up and down and left and right would be fine but 8 degree axis would be amazing!

does anyone have an example on how to do the controls for this?

Thank you

Tommy

Hello and welcome to the forum.
If you want to control the voltage using a joystick you can run electricity from the Arduino to the joystick potentiometer and measure the output electricity by that you'll know the joystick location.
The schematic should look like this:

Afterwards, you can get the input on the Arduino by reading the voltage from pins A0 or A1
and then you can simply use the function:
Code: [Select]
`analogWrite(<pinNumber>, analogRead(A0) * 0.1494)`
and then the output pin will provide electricity acording to the joystick position when it's on the highest position it'll provide 3V and on the lowest 0V

#### GrooveFlotilla

#3
##### Feb 27, 2018, 08:51 pmLast Edit: Feb 27, 2018, 08:54 pm by GrooveFlotilla
Joysticks are often simply potentiometers.
Put three volts across one of the potentiometers, and the wiper connection will vary between zero volts and three volts.

No need for an Arduino.

Ignore what @dindibo4 said about analogWrite, it's rubbish, without extra hardware.
analogWrite produces only 0 volts or close to the supply voltage at a low frequency.

Not really good for anything, but they bring a smile to your face when pushed down the stairs.

#### Delta_G

#4
##### Feb 28, 2018, 03:01 am
and then the output pin will provide electricity acording to the joystick position when it's on the highest position it'll provide 3V and on the lowest 0V
No, that's not how analogWrite works.  It would put out a PWM signal alternating between 0V and 5V with an average value of 3V.  That wouldn't work for what the OP wants at all.
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

#### dindibo4

#5
##### Feb 28, 2018, 01:37 pm
No, that's not how analogWrite works.  It would put out a PWM signal alternating between 0V and 5V with an average value of 3V.  That wouldn't work for what the OP wants at all.
Depending on the applications he uses that for, it might work.
For example, dimming an LED controlling servo...

#### GrooveFlotilla

#6
##### Feb 28, 2018, 02:03 pmLast Edit: Feb 28, 2018, 02:17 pm by GrooveFlotilla
Depending on the applications he uses that for, it might work.
For example, dimming an LED controlling servo...
Did you even read the original post?

Not an RC servo, obviously.

Not really good for anything, but they bring a smile to your face when pushed down the stairs.

#### Delta_G

#7
##### Feb 28, 2018, 03:26 pmLast Edit: Feb 28, 2018, 03:26 pm by Delta_G
Depending on the applications he uses that for, it might work.
For example, dimming an LED controlling servo...
You need to work on your reading skills.  Go look at the OP.  This isn't about LEDs.  And no, this isn't the type of PWM that you would use for a servo.  The OP was quite specific about the application.
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

Go Up