Maker Pro
Maker Pro

Digital Pot setup


Ok, who the hell is Tina!:eek:

Can we keep this simple,,,there are lots of numbers flying around now (Cocacola) and Chris, you brought womens names into the fray, now thats going to start making things "messed up!" LOL.

I took a look at "voltage divider":p, I couldn't find anything useful on this forum:(, (I might of missed it!) but I did find some stuff on google and I get it! but I don't get how it will work with our project?:confused:

Justin

PS Im dissapointed, I field tested the new motor today, that I have been waiting for 3 weeks to arrive. It was NO GOOD!. it seemed great at home but when assembled with the drive shaft and diamond head it was not powerful enough and kept stopping. I've already ordered a more powerful version but Chris,,,the well is looking very very dry at the moment!!! Not a good result :(
 
Last edited:
Ok, who the hell is Tina!:eek:

Design and simulation package...

http://www.tina.com/English/tina/

Can we keep this simple,,,there are lots of numbers flying around now (Cocacola) and Chris, you brought womens names into the fray, now thats going to start making things "messed up!" LOL.

In electronics numbers fly, it comes with the territory...

Cut and paste this link (does seem to work as an automatic hyperlink) in your browser it should run a real time simulation of the numbers I tossed up in the previous post (they where just hypothetical numbers (I had a toddler tugging on one arm and a baby begging attention in the other room no brain for real math) study it for a bit and see if you get the idea of a voltage divider... It's a Java applet so it might take a bit to fire up... Notice the last stage that I adjusted to to about 5.0 volts with a 13 volt battery, that is pretty much where you want to be heading if you are going to be measuring your existing battery with a 5 volt referenced ADC...

Code:
http://www.falstad.com/circuit/#%24+1+5.0E-6+10.20027730826997+63+10.0+62%0Aw+96+64+224+64+0%0Ar+224+64+224+224+0+2700.0%0Ar+224+224+224+384+0+1000.0%0Aw+96+384+224+384+0%0AO+224+224+288+224+1%0AO+352+224+416+224+1%0Aw+224+64+352+64+0%0Aw+224+384+352+384+0%0Ar+352+64+352+224+0+3000.0%0Ar+352+224+352+384+0+1000.0%0AO+480+224+544+224+1%0Aw+352+64+480+64+0%0Aw+352+384+480+384+0%0Ar+480+64+480+224+0+10000.0%0Ar+480+384+480+224+0+1000.0%0AO+96+224+160+224+1%0Av+96+384+96+224+0+0+40.0+13.0+0.0+0.0+0.5%0Aw+96+224+96+64+0%0Ax+-2+310+76+314+0+16+13v+Battery%0Aw+480+64+592+64+0%0Aw+480+384+592+384+0%0Ar+592+384+592+224+0+1000.0%0Ar+592+64+592+224+0+1600.0%0AO+592+224+656+224+1%0A
 
Last edited:
In electronics numbers fly, it comes with the territory...

Your not kidding!:eek:

I took a look at your simulation, its great, thanks for that it, helps make it all make a bit of sense.

I had a look on the web and I found this site :

http://hyperphysics.phy-astr.gsu.edu/hbase/electric/voldiv.html

Its also pretty explanatory and I thought it helped me understand!!


Now lets test???????

The reference we need is going to come from the fact we are going to use a 5V reference and the battery will always give us a 5V ref using a Voltage regulator?????:confused: (please note the punctuation on this paragraph,,,its a question!,LOL)

Justin
 
Yes the micro will use Vcc as reference that in your case with a 5 volt regulator is 5 volts...

CocaCola

ok, Thanks

So in this case we know the battery will be flat when it reaches 9V as this is when the battery electronics will cut the supply. We know the battery at full charge measures 12.51V

The difference 12.51V - 9V = 3.51V Therefore the range we have to measure across is 3.5V

With this in mind please can you elaborate a little more is I'm not really getting it yet!:p and don't really know where to go from here.

Thanks

Justin
 
You use a 2:1 divider, which gives you 1/3 the battery voltage on the lower leg. This is what you feed into the micro. The micro converts this voltage into a digital number in the range of 0..1023 with 1024 meaning 5V. So When the battery is at 12V you will get 4 volts at the divider and your ADC will read 1024 * 4 / 5 = 819. When the battery gets down to 9V it will have 3V at the divider and the ADC will read 1024 * 3 / 5 = 614.

See, that math is not all that bad.

Bob
 
on the lower leg.

Thanks Bob

What do you mean "on the lower leg":confused:

I am beginning to understand it now. It makes sense and I'm going to pick up the necessary components today which I don't have to hand.

I think? I need a 1K and 2K resistor to make this circuit which will give an ouput voltage when fully charged of 4.17 volts (ie battery full 12.51V) and 3V when we reach the 9V thresh hold (battery cut off). Therefore we will measure the pin, at Low = 614 and Full = 854

Is this correct do I need a 1k and 2k resistor.:confused:

Thank you guys for help your help.

Chris,,,,has your pc died??

Justin
 
The voltage divider consists of 2 resistors, one from V+ to the the PICAXE input, and the other from the PICAXE input to ground. By on the lower leg, I mean across the resistor going to ground. This will be the smaller resistor.

1K and 2K would work, but I would use more like 10K and 20K to limit the amount of power it is using. Put a 0.01u capacitor across the 10K. This helps provide the burst of current needed when the ADC samples and also suppresses noise.

Bob
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
<snip>Chris,,,,has your pc died??

Justin

No, I downloaded the new Picaxe M2 parts software after you did, so I've been reading through the new manuals. I just want to be certain that information that I give you (or anyone else) is current and correct. Some of what's been posted doesn't sound correct to me, so I'm verifying.

Chris
 
HI
I have just spent all night playing with Picaxe and soldering up my OLED as is comes in a kit. I've got some results with it and its pretty easy to use. As you said Chris using the OLED to reference which level of power we are at is going to be easy.

I have also purchased a great book Picaxe projects for the Evil Genius by Ron Hackett, so far I haven't put it down. Its an easy read and very well structured. I recommend it!

There is a section on battery measurements I've been fiddling with. I couldn't make sense of the readings I was getting using Bobs advice and I have just realised that I had the resistors in the wrong order. I had 10k and then a 20K, it should have been 20k and then a 10k, that way I get the correct voltage divider!!!:p

Anyway, off to bed, a fresh head on for tomorrows learning curve;)

Chris, my wife wants a word with you as she thinks you have got me addicted to Picaxe! and she hasn't seen me for days!!:D

Thanks guys
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
HI
I have just spent all night playing with Picaxe and soldering up my OLED as is comes in a kit. I've got some results with it and its pretty easy to use. As you said Chris using the OLED to reference which level of power we are at is going to be easy.

<snip>
Chris, my wife wants a word with you as she thinks you have got me addicted to Picaxe! and she hasn't seen me for days!!:D

Thanks guys

Justin, tell your bride that she should feel blessed. After all, she could be married to a brain dead jock. Instead, you're exercising your dendrites and expanding your mind. We live in an intensely high tech world but 99.99% of the world's population are just drones. They use this technology with no clue or care of how or why it works. That same 99.99% idolize vastly over paid actors and sports "heroes" (NOT) who haven't contributed a single thing that directly effects their daily lives.

Yes, I must admit that I'm enjoying this thread immensely. Metaphorically speaking, you're a Marlin who's swallowed the hook and I'm the guy holding the rod. Fortunately, since I don't eat Marlin, you're strictly 'catch and release' and destined to not be counted as a drone. :D

Chris
 
Hi

This is what I have been working on.. I got some of the code from the book I mentioned and the rest has been manipulated by myself. Its a bit all over the shop and I'm sure that a pro could do a much better job. I have added some rem statements in to help others follow!


I used 3 * 10K resistors on my bread board.

i.e

12V battery (+) -> 10k -> 10K -> voltage divider -> 10K -> Ground ( - )

The reference came from after the 5V regulator and on the v+, I got 4.8 volts hence the value 52..

c.4 is connected to the voltage divider directly

V+ is fed from the 5V regulator

common ground.


I came up with this lot after reading Ron Hackett's book "Picaxe Micro-controller projects for the Evil genius"

Anyway, it all seams to work ok. I have a small probelm, maybe you guys can help on.

1) The voltage is not allways exact +/- > .15V at worst. (is this to be expected?)
However at the lowest reading I require ie 9V the reading is correct and at the highest ie 12.51V the reading is correct....ODD,, just some inconsistencies in the middle?
Code:
	symbol ADCval = b5			
	symbol    Vin = w3   		


   #com 6									
   #picaxe 08M2						
   #terminal 2400				

do
												
	readadc c.4,ADCval						

	
	pause 500												
		
	Vin = ADCval * 100 / 52	;52 here, as the ref voltage is 4.8 multiply by 100 as deciamls not allowed	

      vin=vin*3  ;multiply by 3 so as to get the proportion back to origianl voltage!

      bintoascii Vin,b4, b3, b2, b1, b0	;split up the value here
      
	;sertxd (b2,".", b1, b0," volts",cr,lf)   remmed this out as not using the terminal screen
	
	
	serout c.0,n2400,(254,1)                   ;all this code sends the output to the OLED, this line clears screen
	serout c.0,n2400,(254,128) ; this line put the cursor at the start of line 1
	serout c.0,n2400,(b4,b3,b2,".", b1, b0," volts")         ;this line output the results
	serout c.0,n2400,(254,192)                                ; this line moves to the next line of the OLED
	serout c.0,n2400,(#ADCval, " adc val")                     ; this line tells me what he figure is at the c.4 pin variqable ADCval
	
	
	pause 500		
loop

To Chris,

Thanks Chris for introducing the Picaxe to me. At the start of the thread I was a little unsure as to which way or route to follow. I have to say, hands down that Picaxe is fun, interesting and structured. Its like learning a new programming language back in the 80's a thrill I have been missing! Cheers.;)



Thanks

Justin
 
Last edited:

CDRIVE

Hauling 10' pipe on a Trek Shift3
Justin, you may find this attachment useful and very easy to use. It's very handy when using ReadAdc and related code.

Chris
 

Attachments

  • AxeConvertVarToVolts.zip
    4.9 KB · Views: 56
Hi Chris

Thanks for that, it would be useful..

Are you still looking into a solution for the battery voltage and output meter?

I was hoping you might come up with a schematic as mine is a little "all of the shop!"... I know I need caps in there and resistors to ground,,,,,but I don't know where.

Regards

Justin
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
I wrote that app back in 2008 before senility started rearing its ugly head. I forgot that I had it! I've been up on the Picaxe website getting a thorough explanation of it. That's when I discovered that I totally understood it 4 years ago!!! :eek:

Dividing your battery voltage down for ReadADC is no big deal. I just needed a refresher on the nVolts to nADC, as the ReadADC sees it. That app spells it out for you though. Do you understand it? By the way, I'm in the process of creating an updated version of that app. It will include the new ReadADC10 function, resistive divider calculator and a few other goodies.

I'll post a voltage divider later today.

Chris
 
Hi Chris

I have a problem:eek: and I ask this question from behind the sofa!

What if!:rolleyes: I needed my input into the Brushless motor controller to be 0v - 10V,,,,would there be an easy way to achieve this..ie could we attach a transistor or something to the output from the 08m2 so that the voltage could be 0V 10V depending on the voltage 0v - 5v coming from the 08m2.

Why:mad: I hear you ask??

Well there is a problem,, the controller has arrived and its no good for the given task,,,(No torque/current control, which I need!!!:eek:)

I have ordered a replacement from MAXONMOTOR P/N 306089 Here is the PDF http://www.maxonmotor.com/medias/sy...06089_DEC_70_10_Operating_Instructions_En.pdf

this was the controller I was originally intending to purchase but I thought I could getaway with the Anaheim controller (Big mistake!) So its back to the Maxon controller. (4 times the price:()

Regards

Justin
 
You won't get 0-10V out of the micro. But an op amp could multiply it by 2 to put it back in the range you need.

Bob
 
Hi Bob

Would you be able to give me a specific item no. I have looked at OP AMPS before but I got a little "lost in translation!"

Regards

Justin
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
As already stated, an OpAmp with a gain of 2 (easy to do) is what you'll need.

Here's the divider you asked for earlier. Run my app to get a direct 'b' value for the ReadAdc.

Chris
 

Attachments

  • VdivAdc.JPG
    VdivAdc.JPG
    35.8 KB · Views: 157
You will need a supply of at least 12V for the opamp. And you need one that can include ground in the input and output, an LM358 would work fine.

Bob
 
Top