collapse

Author Topic: 10 K potentiometer  (Read 2763 times)

jinx

  • calling from free Europe
  • Sr. Member
  • *****
  • Posts: 469
10 K potentiometer
« on: November 11, 2015, 03:33:12 AM »
10k main.PNG
*10k main.PNG (169.46 kB . 703x257 - viewed 305 times)
  potentiometers come in all shapes and sizes and the 10k is the defacto pot for controlling servo's once you conquered the scaling, it's easy to identify it have the  value written on it which means that we can vary its resistance from 10 to 0 Ohm . A movable wiper is rotated clockwise or anticlockwise direction that changes the resistance of the potentiometer. .

  wiring:
pot wiring.PNG
*pot wiring.PNG (40.14 kB . 323x444 - viewed 326 times)

example #1 nothing more than what's in the manual except here am displaying data in the terminal window
Code: [Select]
'10K pot scaling
'3.3V
#picaxe 28x2
#no_data
#no_table
#freq m4

'########## pots #############################
symbol pot1   = S.A1             'center pin of the pot to picaxe
symbol potval = w0               'place the reading into a word variable
symbol delay    = 100

 main:
    do
  readadc10  S.A1,potval                  ' reads and places the pot value 
  pause 10
  sertxd(" Pot value",#potval,13,10)
  pause delay
 
       loop

example #2 replace the main section of code from example one  give the pot  31 steps, turns one input into thirty and possibly  used in conjunction with the case select  command
Code: [Select]
main:
  do
  readadc10  S.A1,potval                    ' reads and places the pot value 
   potval = potval / 5 * 23 / 150                 '
  pause 10
  sertxd(" Pot value",#potval,13,10)
  pause delay
 
loop

example #3 scales the pot for servo control through the range 80-219 should prevent you hitting the endstops.
Code: [Select]

'10K servo control
'3.3V shield
#picaxe 28x2
#no_data
#no_table
#freq m4



symbol pot1   = S.A1             'center pin of the pot to picaxe
symbol potval = w0               'place the reading into a word variable


symbol pan = b.7
symbol lft = 80
symbol rgt = 200
symbol cen = 130

symbol MINS   = 80               '-+ minium travel
symbol MaxS   = 22               '-+ for max travel

int:
    servo pan,cen
    pause 30
 main:
  do
  readadc10  S.A1,potval                  ' reads and places the pot value 
  potval= potval*3/MaxS+MINS                  ' scales the pot range between 219-80
  servopos pan,potval
  pause 30
  sertxd(" Pot value",#potval,13,10)
  loop

  but I need more servo control not a problem just duplicate what you done  and remember to add the symbols for the second servo.
Code: [Select]
do
  readadc10  S.A1,potval                  ' reads and places the pot value 
  readadc10  S.A2,potval1                  ' reads and places the pot value 
  potval= potval*3/MaxS+MINS                  ' scales the pot range between 219-80
  potval1= potval1*3/MaxS+MINS                  ' scales the pot range between 219-80
  servopos pan,potval
  servopos tilt,potval1
  pause 30
  sertxd(" Potpan ",#potval," pottilt ",#potval1,13,10)
  loop


 test vid:

links:
erco fun :http://www.picaxeforum.co.uk/showthread.php?27489-Servo-Record-amp-Playback&highlight=servopos

http://www.geofex.com/article_folders/potsecrets/potscret.htm
« Last Edit: November 12, 2015, 04:30:55 AM by jinx »
I build bots

erco

  • Member
  • *
  • e
  • Posts: 205
Re: 10 K potentiometer
« Reply #1 on: November 12, 2015, 11:23:10 AM »
Beautimous pan/tilt, jinx!

I posted this video on pots & servo control last month.



erco

  • Member
  • *
  • e
  • Posts: 205
Re: 10 K potentiometer
« Reply #2 on: November 12, 2015, 01:32:18 PM »
Another fun fact about servos & pots. Having hacked numerous servos for continuous rotation, I can say that all or most of them use 5K pots internally for position feedback. I normally replace the pot electrically with a voltage divider made from a pair of 2.7K fixed resistors, keeping the overall value around 5K. But I used 100K resistors in the last pair of HXT900 servos I modified, and they worked just the same. In fact, they were the best-matched pair of servos I have ever seen, in terms of null point, which is obviously not adjustable using fixed resistors.


 

* Search


* Recent Topics

NanOMeter by Protowrxs
[January 01, 2020, 12:59:44 PM]


Investigating the VL53L0X Laser Rangefinder by erco
[December 30, 2019, 10:45:44 PM]


PS4 Single Handed Controller Deployed (part 7 of 7) by Gareth
[December 30, 2019, 09:52:29 AM]


"D" -Pad Workio just like Magic (Will Merlin stay or Go) (part 6 of 7) by Gareth
[December 30, 2019, 09:51:27 AM]


PS4 Joystick Digitals 4,5,6,7,10 - Analog's Lx,Ly,Rx,Ry Workio (part 5 of 7) by Gareth
[December 30, 2019, 09:50:37 AM]


Menu Workio ! (part 4 of 7) by Gareth
[December 30, 2019, 09:49:49 AM]


L1 trigger design Workio (Hori controller) (part 3 of 7) by Gareth
[December 30, 2019, 09:48:50 AM]


Hori aka PS4 Joystick Mappings (part 2 of 7) by Gareth
[December 30, 2019, 09:47:17 AM]


PS4 Single Left-Handed Controller (part 1 of 7) by Gareth
[December 30, 2019, 09:44:58 AM]


Time of Flight >>> Rounded Corners !!! by BaldwinK
[December 04, 2019, 05:46:08 PM]


The unnamed (yet) quatruped spider project by maelh
[December 04, 2019, 08:38:58 AM]


American Civil War Robot by kingart3
[November 27, 2019, 06:39:47 PM]


2D Side Scroller Cyberpunk themed by Killer Angel
[November 12, 2019, 07:56:15 AM]


Ebot SL by erco
[October 31, 2019, 04:27:36 PM]


Discord anyone? by tinhead
[October 20, 2019, 05:35:59 AM]

* Recent Posts

NanOMeter by Protowrxs
[January 01, 2020, 12:59:44 PM]


Re: Investigating the VL53L0X Laser Rangefinder by erco
[December 30, 2019, 10:45:44 PM]


PS4 Single Handed Controller Deployed (part 7 of 7) by Gareth
[December 30, 2019, 09:52:29 AM]


"D" -Pad Workio just like Magic (Will Merlin stay or Go) (part 6 of 7) by Gareth
[December 30, 2019, 09:51:27 AM]


PS4 Joystick Digitals 4,5,6,7,10 - Analog's Lx,Ly,Rx,Ry Workio (part 5 of 7) by Gareth
[December 30, 2019, 09:50:37 AM]


Menu Workio ! (part 4 of 7) by Gareth
[December 30, 2019, 09:49:49 AM]


L1 trigger design Workio (Hori controller) (part 3 of 7) by Gareth
[December 30, 2019, 09:48:50 AM]


Hori aka PS4 Joystick Mappings (part 2 of 7) by Gareth
[December 30, 2019, 09:47:17 AM]


PS4 Single Left-Handed Controller (part 1 of 7) by Gareth
[December 30, 2019, 09:44:58 AM]


Re: Time of Flight >>> Rounded Corners !!! by BaldwinK
[December 04, 2019, 05:46:08 PM]


Investigating the VL53L0X Laser Rangefinder by BaldwinK
[December 04, 2019, 05:35:57 PM]


Re: The unnamed (yet) quatruped spider project by maelh
[December 04, 2019, 08:38:58 AM]


Re: The unnamed (yet) quatruped spider project by Nemesis
[November 28, 2019, 12:58:18 PM]


Re: The unnamed (yet) quatruped spider project by tinhead
[November 28, 2019, 10:09:46 AM]


Re: The unnamed (yet) quatruped spider project by Bajdi
[November 28, 2019, 08:44:38 AM]