⚠️ This forum has been restored as a read-only archive so the knowledge shared by the community over many years remains available. New registrations and posting are disabled.

All times are UTC + 8 hours




Post new topic Reply to topic  [ 164 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 11  Next
Author Message
 Post subject: Re: Electronics 101
PostPosted: Oct 31st, '11, 08:31 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
I use linux so sing out if I can be of any assistance.

there is an interesting free electronics simulator called ktechlab and a stack of other free electronics stuff

I run Ubuntu, which is as close to a windoze interface as you would want.


Top
 Profile  
Reply with quote  
    Advertisement
 
 Post subject: Re: Electronics 101
PostPosted: Nov 25th, '11, 09:24 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
I need a lesson on voltage dividers, with focus on how my PICAXE chip can give me a reading of the voltage on a pin between 0 and 255 no matter what value variable resistor I'm using.

Is the chip using a reference voltage at its + and - pins or is there just some simple, normal every day magic involved? From the tutorials I've looked at online, it seems that there is no need for a reference voltage.

There doesn't seem to be enough information supplied to the chip to always range from 0 to 255, without any need for calibration or anything.

Please help! It's driving me nuts.


Top
 Profile  
Reply with quote  
 Post subject: Re: Electronics 101
PostPosted: Nov 25th, '11, 11:32 
Newbie
Newbie

Joined: Sep 18th, '10, 19:15
Posts: 28
Gender: Male
Are you human?: yes
Location: Perth, WA
Hi bullwinkle,
I just started a topic you may be interested in
http://www.backyardaquaponics.com/forum/viewtopic.php?f=50&t=11072
But ill try to answer your question with an example form my project.

Firstly reference voltage is almost always ground. So everything is measured from ground. If the potential is 2V less than ground its -2V with respect to ground. If its 5V greater than ground, that point would be +5V.

With a voltage divider using for example a photoresistor (variable resistor based on luminosity).

look here for a schematic:
http://dl.dropbox.com/u/19981222/MicroSD%20Datalogger/Screenshot%20at%202011-11-24%2022%3A18%3A01.png

-the circuit on the far right.
-I think this particular photoresistor has resistance between 1K - 10K ohms

so using the formular Vrv= Vt(Rv/(Rv+Rc) //c = constant 10K ....v = variable photoresistor

when it is completely light
Rv = 1K ohms Vrv = 0.4545 Vrc = 4.5455
so from the schematic the arduino pin reads 4.5455

when completely dark
Rv = Rc 10K Vrv=Vrc =2.5V
so arduino pin reads 2.5

this is segmented into 1024 resolution, so then dividing by 1024 and multiplying by 100 with this code...
Code:
 lightLevel = (lightLevel*100.0)/1024.0;

gives me the light level as a percentage.

You may be wondering why the voltage the arduino reads is actually the voltage over the constant 10K resistor rather than the variable photoresistor? (remembering that because all voltages are measured with reference to ground the data pin is reading the voltage over the 10K not the photoresistor).
This is only so that 100% = 100% light. Otherwise 100% would = 100% dark which is counter intuitive.

I hope this sums it up pretty well. If you have any questions let me know


Top
 Profile  
Reply with quote  
 Post subject: Re: Electronics 101
PostPosted: Nov 25th, '11, 11:40 
Newbie
Newbie

Joined: Sep 18th, '10, 19:15
Posts: 28
Gender: Male
Are you human?: yes
Location: Perth, WA
Oops you've already seen it.


Top
 Profile  
Reply with quote  
 Post subject: Re: Electronics 101
PostPosted: Nov 25th, '11, 13:37 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
re: -" Vrv= Vt(Rv/(Rv+Rc) //c = constant 10K ....v = variable photoresistor"

Can you write this out as a paragraph in english. My eyes gust glazed over :)

And I'm not even sure if it's been answered :) Perhaps I'll rephrase my question.

I thought the reason it was working was because I was just using the example circuit offered by PICAXE and I figured it simply at all the voltage by the end or it's range because it was the correct component to do so.. So I got a little freaked when I tried a 100k pot and it still worked perfectly.

How is it that I can put a 10 k variable resistor to pin 3 and read between 0 and 255, and if I use a 100k variable resistor, I still get a reading between 0 and 255. My head says the 10k one should give me readings from 0 to 25 or something. This started because I was suspicious of the fact that I was seeing the full range at all, when my pot was reading 5% low at the top.

I say suspicious because I figured there was something going on that I didnt understand. Or I should say something going on that I understood even less than I expected :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Electronics 101
PostPosted: Nov 25th, '11, 13:43 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
erbey, does the international date format on your screen grab indicate that we are using that in education these days?

I've just re-read your post a few more times and I suspect it _does_ answer my voltage divider question (I'm really new to all this)


Top
 Profile  
Reply with quote  
 Post subject: Re: Electronics 101
PostPosted: Nov 25th, '11, 14:17 
Newbie
Newbie

Joined: Sep 18th, '10, 19:15
Posts: 28
Gender: Male
Are you human?: yes
Location: Perth, WA
Well ill get to the " Vrv= Vt(Rv/(Rv+Rc) //c = constant 10K ....v = variable photoresistor"

I haven't read the whole thread just sort of jumped in so not sure what you know about electronics.
I just skimmed through and had a look and ill try add some stuff i think is important, that should make it alot easier to understand some of the other stuff. I also hope I'm not 'impeding' (nudge nudge) on any SuperVeg's thread here.
But a few thinks i think are important:

1)Kirchoffs Voltage Law
KVL essentially says the sum of all voltages around a circuit must equal zero...might sound strange untill you think of in and out being opposites.
So in the schematic i was showing earlier. There was a total of 5V over the circuit. Therefore 5V must come out of the circuit. It just so happens that voltage is spread over the resistors depending on size, so the larger resistor takes more voltage than the smaller resistor.
This should help you understand if your having trouble :
http://www.wisc-online.com/objects/ViewObject.aspx?ID=DCE3002
http://www.allaboutcircuits.com/vol_1/chpt_6/2.html

This is also why with my circuit as if gets dark the photoresistor resistance increases, therefore starts taking more of the voltage (while the constant resistor loses voltage, because the sum of the voltages must always =5V) and because the arduino measures voltage over the constant resistor, which is going down. It knows that light must also be going down

In regards to always getting a reading between 0 and 255 thats because the voltage recieved is divided into a resolution of 2^8 = 256 (255 because in programming you start from 0). this means you can get more accurate with your measurement....the 0-255 has very little to do with the ciruit, its how the program divides the input into a resolution.


Top
 Profile  
Reply with quote  
 Post subject: Re: Electronics 101
PostPosted: Nov 25th, '11, 14:28 
Newbie
Newbie

Joined: Sep 18th, '10, 19:15
Posts: 28
Gender: Male
Are you human?: yes
Location: Perth, WA
Oh that date, no I've never used it like that. Thats the default file name given from the screenshot program. Was it you I saw was Using Ubuntu Linux? It's the default for the gnome-screenshot package.


Top
 Profile  
Reply with quote  
 Post subject: Re: Electronics 101
PostPosted: Nov 25th, '11, 15:06 
Newbie
Newbie

Joined: Sep 18th, '10, 19:15
Posts: 28
Gender: Male
Are you human?: yes
Location: Perth, WA
Oh, after explaining how the larger resistor gets a greater share of the total 5V than the smaller resistor...this brings about the equation...nearly forgot sorry.
2x resistors R1 and R2
Vr1 = voltage over R1
Vr2= voltage over R2
and Vt = the 5V
x = either 1 or 2 depending on what voltage you want....
Vrx = Vt * ( Rx/ (R1+R2) )

This table shows that with a total resistance of 20ohms the voltage over each resistor as you change their values. (imagine 2x 20Kohm max trimpots in series)

R1 R2 Vr1 Vr2
20 0 5 0
15 5 3.75 1.25
10 10 2.5 2.5
5 15 1.25 3.75
0 20 0 5

This table will show the situation with a photoresistor

photo 10k Vp Vr
1 10k 0.45 4.54
2.5 10k 1 4
5 10k 1.66 3.33
7.5 10k 2.14 2.85
10 10k 2.5 2.5


Top
 Profile  
Reply with quote  
 Post subject: Re: Electronics 101
PostPosted: Nov 25th, '11, 19:33 
A posting God
A posting God
User avatar

Joined: Oct 16th, '11, 06:12
Posts: 2019
Gender: Male
Are you human?: 0110010110
Location: Brisbane, qld
BullwinkleII wrote:
I need a lesson on voltage dividers, with focus on how my PICAXE chip can give me a reading of the voltage on a pin between 0 and 255 no matter what value variable resistor I'm using.

Is the chip using a reference voltage at its + and - pins or is there just some simple, normal every day magic involved? From the tutorials I've looked at online, it seems that there is no need for a reference voltage.

There doesn't seem to be enough information supplied to the chip to always range from 0 to 255, without any need for calibration or anything.

Please help! It's driving me nuts.


Hi Bullwinkle,
Are you just connecting a single pot (variable resistor) to your ADC input so that when you turn it fully one way you get a 0 and when you turn it fully the other way you get 255 ?

Do you understand that the values of the resistors in a voltage divider don't really matter (for the theory) but its the ratios that are important.
ie: a 10ohm/1ohm divider is exactly the same as a 1000kohm/100kohm divider ?

Z = resistor

5v(input)
|
Z
|___output
|
Z
|
0v

So if you turn a pot fully one way you are basically connecting the output to say 5v (so output = 5v or value of 255.
If you turn the pot fully the other way, the output is then connected to 0v, value 0.

If you turn the pot exactly half way, then the resistance between the output and input and between output and 0v is equal and output will be half of the input. In this case 2.5 volts or value 128 on the ADC.


Top
 Profile  
Reply with quote  
 Post subject: Re: Electronics 101
PostPosted: Nov 25th, '11, 20:02 
A posting God
A posting God
User avatar

Joined: Oct 16th, '11, 06:12
Posts: 2019
Gender: Male
Are you human?: 0110010110
Location: Brisbane, qld
Did that help by the way?
Did I even answer the right question?


Top
 Profile  
Reply with quote  
 Post subject: Re: Electronics 101
PostPosted: Nov 29th, '11, 21:21 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
yeah Superveg I think you understand my lack of knowledge. I suspect Erbey does as well but I cant tell because I dont understand this electronics caper and struggle to follow... well ... everything :)

And yes its a pot with 5v at one side, 0 at the other, and the centre pin goes to the chip.

I understand that it doesn't matter what value pot I use but cant quite wrap my head around why. And how the chip is ... self calibrating.... regardless of the input voltage. Or is the input voltage always the same at say the half way point on the pot.

I keep thinking there is not enough reference info for the chip to decide what the value should be.

ok here's a question that might make sense.

Q. How does my chip return the same value for a 10k pot and a 100k pot, both set at the halfway point?

I know the answer is probably "Well, how doesn't it?" but that wont help me :)

The challenge here is to figure out which bit it is that I'm missing, because as hard as I try, I cant tell what it is that I dont understand :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Electronics 101
PostPosted: Nov 29th, '11, 21:36 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
I've just been re-reading and I'm pretty sure my question has been explained, but there is a space in my brain where the knowledge should be.

So to recap...

AAAggghhh!


Top
 Profile  
Reply with quote  
 Post subject: Re: Electronics 101
PostPosted: Nov 29th, '11, 21:37 
Almost divorced
Almost divorced
User avatar

Joined: Nov 11th, '09, 03:13
Posts: 1004
Gender: Male
Are you human?: The top half is
Location: Chiang Mai, NW Thailand.
Think of a pot as a potential divider (cos that's what it is...)
I'm assuming you have +5v at 1 end, 0v at the other and the chip input in the middle.
If you had 2 x 10k resistors in series between the supplies, you would get 50% of the supply voltage at the mid-point (series connection)
If you had 2 x 1M resistors in the same circuit, you would get the same voltage at the same point.
Depending on the position of the shaft, a certain percentage goes to your ADC, the remaining goes to ground (0v)
So regardless of the value of the pot, you get 50% of the applied voltage at the halfway point.

You can use a pot in 2 pin configuration and use it as a variable resistor, but if you are using the 3 pins, you have a variable voltage divider.


Top
 Profile  
Reply with quote  
 Post subject: Re: Electronics 101
PostPosted: Nov 29th, '11, 22:37 
Moderator
Moderator
User avatar

Joined: May 6th, '11, 12:06
Posts: 12206
Gender: Male
Location: Northern NSW
I think my brain just exploded.... :upset:


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 164 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 11  Next

All times are UTC + 8 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group
Portal by phpBB3 Portal © phpBB Türkiye
[ Time : 0.043s | 14 Queries | GZIP : Off ]