Log vs Linear Potentiometer

mdunk

New Member
Hello all,

Can anyone advise me on the following?

I am building a picaxe 18 based project to move some solar panels. One of the functions I would like is the ability to sense the position of the panels. I am thinking of using a potentiometer that rotates with the movement of the panels, but I have hit a snag.

At the shop I was presented with linear or log potentiometers. Which would be more suitable if I want to divide my panel positions into about 20 or so discreet position intervals using the readac function? Also, am I right in assuming that around 10k is optimal?

It would be nice to get a set of "linear" responses from a coding perspective, but my very faint memory of such things makes me think I would actually need a log potentiometer for that, although this may be something to do with audio.

Thank you,

Matthew
 

Ralpht

New Member
" It would be nice to get a set of "linear" responses from a coding perspective, but my very faint memory of such things makes me think I would actually need a log potentiometer for that, although this may be something to do with audio."

You pretty well answered it right there Mathew.

Log pots are for audio, usually volume controls purely because of the way the human ear works.

A linerar put will do the trick for you but I would go for around the 50K - 100K range.
 

mdunk

New Member
Righto, linear it is, thanks for the quick response.

Thank you also for the 50 - 100k resistance note, is there a particular reason for this?

I could not find anything in the otherwise excellent documentation anywhere that suggested a good figure and settled on 10k as I found a few people using those in their projects.

OK, so not a very scientific method, but it was all I could come up with. My electronics knowledge has always been a little patchy.
 

westaust55

Moderator
Log vs Linear Potentiometer and value to use

Ralph is correct and Linear is definitely the way to go.

I have been using a 20kΩ linear Potentiometer as the manually controlled analogue voltage signal device without problems. Believe that the 10kΩ pot should not present you with any problems in itself.

If the wiring is long, there may be voltage drop along the wires which will reduce the min and max voltage seen at the ADC input. A higher value potentiometer would in that case have some advantage albeit likely small.
With reference to scientific methods of determining the optimal resistance for ADC inputs, I did some tests with series resistances with LDR’s connected to PICAXE ADC inputs back in April 08.
http://www.picaxeforum.co.uk/showthread.php?t=9265

While the Microchip PIC datasheets suggest the max input impedance as 10KOhm, and the Rev Ed documentation have figures ranging from 1kΩ to 100kΩ in sereis with LDR's (quite a range there) my findings were that accuracy was not severely hampered by a higher resistance as some had predicted. Part of my investigation at that time was looking at how to maximize the voltage range into the PICAXE ADC input with various LDR’s.
 
Last edited:

womai

Senior Member
Microchip recommends a source impedance of 10 kOhm or less (of course I am sure this number includes some hefty guardband). If you want to stay within this spec you can use a potentiometer of up to 40 kOhm - the ADC input "sees" an effective source impedance (Thevenin equivalent) equal to the parallel combination of the two parts of the potentiometer left and right of the wiper; the worst case is when the wiper is in the middle, then it is

R_source = 1/(1/(R_pot/2) + 1/(R_pot/2) = 1/(1/20 + 1/20) = 10 kOhm

This also explains why other people get away fine with potentiometers in the 50 to 100 kOhm range.

Since there is guardband for sure, you should easily get away with a 50 kOhm potentiometer of you are worried about idle power consumption due to the shunt current through the potentiometer. If not, then I'd add some juice by going to a 10 kOhm pot. Also in any case I'd decouple the ADC with a small capacitor (10 - 100 nF) between the ADC input and ground to reduce noise at the input.

Wolfgang
 
Last edited:

Ralpht

New Member
Between 50 - 100K is purely a personal preference. I tend to lean to 50K (as I have quite a few lying about, as well as few 100K pots).
As Westaust55 implied, in reality it may not make much difference from 10K up to about 100K as to what value you use.

The larger values may maximise the voltage range you can use, but is dependant on other components around your circuit.

You won't go wrong using anything between 10K to 100K. As long as it's linear. Try one each of 10K, 20K and 50K and see which one gives you the best result.

Good Luck.
 

Ralpht

New Member
Womai is spot on.

I was reluctant to throw maths around as lots of people go "glassy eyed" when that happens.

As an engineer, to me math is Good, but then reality sets in and anything you design correctly will work on the bench and then not work out in the field. Good old Murphy.

Sometimes its just more fun to grab a component and see if it works. Then when it does, use maths to explain why it did work.

Womai also had a good point about the cap to decouple the ADC.
 

BeanieBots

Moderator
Stick with your 10k linear POT.
Going above 50k is likely to give you issues when using ReadADC10.
Keeping the impedance low will help with noise immunity.
Don't forget, for accurate ReadADC10 you will need to use the enhanced download circuit as well.
 

mdunk

New Member
Ah ha! You see, I knew I was in trouble here.

The clue was, I had to go to the shop for my potentiometer. I don't actually HAVE any lying around. I think I might be out of my league. Even reading some of this has given me a mild headache.

I shall go to the shop and buy a 20k pot as a kind of compromise, being the sum of all the recommended resistances, divided by the number of people with good suggestions, rounded off to the nearest good suggestion.

Arithmetic mean I can work with, parallel resistance calcs always leave me slightly dazed, and when phrases like the following appear -

"Also in any case I'd decouple the ADC with a small capacitor (10 - 100 nF) between the ADC input and ground to reduce noise at the input."

- I have to step outside for a quick breather.

Thank you all for your excellent assistance.

Matthew
 

McTaggart

New Member
AMCT

Buy a "Servo" pot. If you are using long leads use a small value say 5k to keep the input impedance as small as possible and thus the noise immunity high. Both RS and Farnell have suitable types which are highlighted in their printed catalogs. These are wire wound pots and are a little more expensive than carbon film but for servo operation you get what you pay for.

When you write your software include a filter function to stop hunting. This will be kinder to the mechanical components of your equipment and they should last longer.
 

manuka

Senior Member
Mdunk-take heart! If you only "have to step outside for a quick breather",then ponder the attendant angst when the rhetoric is initially penned.
 

Dippy

Moderator
Matthew, pots are a lovely idea but is this for long-term outdoor use?

You may be able to get something working using pots you have lying around, but there is no way I'd trust a system using second hand cheap carbon pots for example.
You will have to use something robust. That means SPENDING some money. Or using some other kind of method such as optical or magnetic.

If you don't want to spend any money then stick with your day job :)
 

McTaggart

New Member
Pots are fine for outside use if they have protection from dust and rain. They are routinely used in industrial environments.( oil,water,dust vibration etc.)There are better ways of doing the job but is the extra cost warranted? You just need to buy reasonable quality.
 

moxhamj

New Member
10k pot is my suggestion.

Decoupling = a fancy term. Grab a capacitor. For this application, anything from 0.1uF to 1000uF would work. I'd guess 0.1uF. Put it between the wiper of the pot and the ground of the pot. It just smooths out the output, and it makes a big difference to the readings as you then get the same number each time you readadc.

Re weather - in general terms you need to keep the rain out. So bring things like mechanical inputs from the underside of objects. Eg, take a metal can, tip it upside down, put your componenent like a pot inside, and then bring your mechanical connection up into the tin. Paint the tin. Of course, your mechanical linkages will also need to be weatherproof.

Solar is a bit tricky, because while the height of the sun might go from 0 degrees to 90 degrees (straight above) or even a bit further, the east west angle can change more than 180 degrees. It depends where you live, but consider the extreme case of living on the top of the north pole where the sun goes round and round just above the horizon.

You can't use the pot as the bearing, so you need a robust bearing, then some sort of linkage to the pot. I'm not quite sure the best answer, but rather than a pot, I think it might be something like a disc of aluminium with holes drilled in it to indicate angles in a binary code and IR leds/phototransistors looking through the holes, then for fine tuning, using two light sensors, with a vertical little wall between them eg 10cm high. If the device is pointed directly at the sun, there will be no shade on either light sensor. If the device is slightly off angle, one will be shaded.

You can take the principle further with 4 light sensors, and a two shading walls. Eg, looking down at it, it would be a + with 4 sensors, one in each of the 4 quadrants. All 4 will read equally when it is pointed directly at the sun.

So get it roughly to the right spot with the metal disk (within a few degrees) then fine tune it using the shading principle.

There are lots of designs out there. The weather is a big problem esp rain. It is like walking into your electronics lab and squirting a hose everywhere and then seeing how much of the electronics is still working.

Another concept - work out the decrease in output if the device is 10 degrees off where it should be. There is some trig maths here, but it ends up being only a tiny change. So if you accept that it only has to be within 10 degrees, it could be better to use no sensors at all, and use a picaxe with a real time clock, and program in the angles for different seasons, and use the clock to advance the motors.
 
Last edited:

mdunk

New Member
Dear all,

These are good points again. Some clarification for you all, with the aim of more good feedback.

The tracking bit is nicely sorted at the mechanical level, I am lucky enough to have an aluminium fabricator as a friend. Thus I have over 400kg of solar panels able to be tilted to follow the sun at my latitude, using only my little finger to change the azimuth, elevation still needs a winch, albeit a small one.

It has been the tracking at the software level that got me thinking a bit. I had seen the photovoltaic principle Dr_Acula mentioned, and had come to the conclusion that I'd rather be more empatic than that, to avoid all the hunting issues that seem to crop up on cloudy days. This is why I went for the clock principle instead as he suggests (Rats, I thought I was the first to think of that!). So I have settled on the Picaxe 18x with an I2C slaved clock (DS307 I think it is called?), and preloaded positions in one of the I2C slaved memory chips. (Oh yes, and if I can justify it to myself, I'll also add the lcd display so that I can see what is going on.) With the help of a neat little java script I found on the web I have all of the sun position data for my latitude and longitude for a whole year, in 15 minute intervals, hence the simple principle of looking at the date and time and moving the array to the appropriate position.

The weathering issue is important, as I am only 300m from the beach, so everything cops a fair amount of salt along with the rain. To get around this I will run stainless steel bowden cables from the array into the house itself, and sense everything from there. So the pots will at least be out of the elements, although the azimuth drive motor have been in left to fend for itself. I have settled for welding the assembly in aluminium and then packing the moving bits with grease, and accepting that I might have to replace it once every couple of years. Fortunately, thanks to the aluminium fabricators nice mechanicals, the azimuth controller was able to be made from a $20 12V motor and gearbox from jaycar, along with a $5 threaded rod and about $10worth of aluminium tubing from bunnings, so that's pretty cheap to replace, the winch on the other hand looks like being at least $200 worth so I will run the cables for that into the house as well.

I had toyed with using a photosensitive diode and LED to count the number of revolutions the drive shaft made on the azimuth tracking motor and the winch, this gets around the pot problems, but I thought that the pot might be simpler, given the problems around weather proofing everything on the azimuth motor.

The code for the picaxe is running nicely at the simulation level in its component parts, I still have to combine the lot into one program and check that I can FIT the code on an 18x chip, I think it will be ok.

Now if all of this sounds a little over the top, I can admit that my delightfully tolerant wife accuses me of making things complicated from time to time, but she at least supports me while I am doing so. From an economic principle too, this whole project is crazy. The panels will be lucky to pay for themselves in ten years, though the tracking may pay for itself in a few years given we get a decent 44 cents for each kilowatt hour that we put back into the grid here in South Australia. I estimate I will get nearly 20% more out of the panels over the year with this setup.

But then, I suspect a significant number of the users of this forum, like me, do this stuff for the fun and challenge of it, NOT the economics.
 

mdunk

New Member
One additional point. At the moment I am using the Shed-Visit-Tracking-Principle. That is, I have the azimuth tracking wired to a two way switch near the back door, and every time I come back from the shed I take a quick peek at the panels and move them to a better position. This is a cause of some amusement for my neighbour, who has taken to listening for me leaving the shed and then watching the spectacle of me bobbing in and out from under the verandah to check the position of the panels. He even offers feedback from his slightly better perspective, he's to the North of me. "Bit further... more... that's it, stop there!"

Not sure how many KW hours this all translates to, but it is fun.
 

moxhamj

New Member
LOL enlist your neighbour to do the work for you!

I might be able to see your place from work - I'm up the top of the hill in Belair. Sounds like you have the mechanicals all sorted. Indeed you might be onto a design which others could find useful. How is the "stiffness" of the assembly - ie how does it behave in strong winds? 400kg of panels could well have more than that in terms of wind loading in a strong wind (I think engineers use a rule of thumb of 1000kg per square metre).

Re the clock vs light sensors etc, can you get a data cable back inside? Picaxes are easy to interface with a computer and it might be useful to collect data into a PC while you are setting it up, then program the picaxe based on the PC data. Mind you, it is a clock, you have sunrise times all programmed in, and you just advance it a certain amount each hour. With a pot or some other angle sensing system, it should work very well. The biggest problem might be the clock gradually losing or gaining time. Another reason why a PC interface could be handy - you can talk to it intermittently as needed.

You may not need a pot as you say. If you have a microswitch that detects the end of travel, and you have a photointerruptor that detects one revolution, you can count revs. Dot matrix and inkjet printers use this technique.

The 44c per kwh in South Australia is a bit unique to this state (I think Germany has a similar scheme), and with all the other rebates, and with the extra power from the tracking device, it might actually be starting to really get cost effective. I hope there won't be a temptation to cut down the neighbour's tree to get an extra half a kwh?!
 
Last edited:

mdunk

New Member
The neighbour algorithm is certainly simpler to implement, but he's off to bowls every time the weather is good.

As for strength of the frames, well I don't have figures, but the frames are constructed from a high tensile 40mm aluminium square tube that is used on high rise buildings for the safety ballustrades on the balconies. The corner joints are a special SOLID aluminium plug, again used for the ballustrading. The total area of the panels is just under 18 square meters, but due to the placement of the array, two thirds are shielded from the prevailing SW wind by the building. This leaves the panels fully exposed to a northerly if it should come sweeping down, but they are rare and the force would be downwards only. Sadly, no tree shadows to worry about, they've all been chopped down around here.

I'll use the laptop to get around the programming issue, mind you, I hadn't thought about clock drift, that could be annoying. I think that lends weight to the idea of an LCD panel down in the house, I can keep track of the time accuracy as well. So the order is now the Picaxe 18X chip, the AXE033 LCD panel, the AXE034 clock and one of the memory chips, yet to see which.

Back to programming in basic, a bit of a difficult change when you spend all day working in Visual Studio 2005 as part of your job. I kind of need to change heads when I get home.
 
Top