Maker Pro
Maker Pro

Digital Pot setup

CDRIVE

Hauling 10' pipe on a Trek Shift3
On a single chip there's no reason to use 'ReadADC' because we have our 6 steps stored in B1. So making an LCD display "Stopped", "Low 1", "Low 2", "Medium", "High" and "Max" is just a matter of reading B1 and writing the Serial code.

I'm glad you're experimenting and practicing on your own though. Exciting, isn't it?! ;)

Chris
 
On a single chip there's no reason to use 'ReadADC' because we have our 6 steps stored in B1. Exciting, isn't it?! ;)

Chris

Chris,

Its so simple, once its pointed out!:p Of course all we do then is ouput to the display depending on what we are outputting to the Pin ie B1,,,brilliant, simple and yes it is exciting stuff!!

I like it!:D

However, now I'm puzzled as to how the input its calibrated? ie <90 >90 what does it mean?:confused:


Justin
 
However, now I'm puzzled as to how the input its calibrated? ie <90 >90 what does it mean?:confused

The readadc command is going to return an 8 bit value ( 0 - 255 ) that is theory a returned value of 0 is 0 volts and a returned value of 255 is 5 volts..

<90 = LESS than 90
>90 = GREATER than 90

You are splitting it at roughly 1.76 volts...
 
You are splitting it at roughly 1.76 volts...

HI

I just put a meter on it and thats it, your right! I get it thanks..:rolleyes:

I assume it sets 0 to be 0v and 255 to be 5V as deafult since these are the +V of the chip. Could I set the calibration to be from 0v - 4.12V. If yes, do you know the correct syntax.

Regards

Justin
 
Last edited:
The ADC works from a reference voltage. By default this is Vdd, but I can be input on a pin. To make it's range 0 to 4.12V you would have to provide a 4.12V reference.

Bob
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
HI

I just put a meter on it and thats it, your right! I get it thanks..:rolleyes:

I assume it sets 0 to be 0v and 255 to be 5V as deafult since these are the +V of the chip. Could I set the calibration to be from 0v - 4.12V. If yes, do you know the correct syntax.

Regards

Justin

Bob explained it but why do you want to do this?

Chris
 
Hi

Thanks Bob, I thought there may be a way to set the V using a command, but I understand now.

To Chris

I'm just fiddling Chris, changing different values and settings in an attempt to understand how it all works.I haven't a clue about the finite requirements such as a capacitor here and there and a 10K resistor over there and by here!! but at least I can try to get to grips with the Picaxe setup and porgramming.:D

As you said Its fun to play with. I'm looking forward to your help on the display setup and the battery meter. (I've looked into that a little and its light years beyond my current knowledge!)

Thanks

Justin
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
Justin, we're going to be using ReadADC but not to read the your speed control output. It will be used to monitor your battery voltage.

Chris
 
Justin, we're going to be using ReadADC but not to read the your speed control output. It will be used to monitor your battery voltage.

Chris

Hi Chris

I though that might be the case. I will be interested to see how we create a reference from the battery. As if this is the case, how do we do that? as surely the reference will decrease as the battery exhausts? thus giving a false reading.:confused:

Justin
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
Justin, when your 12V battery is at full charge what is the unloaded voltage? Typically, lead-acid batteries (automobiles etc) are regulated @ 13.8V but can be a bit higher. I forget what type of bat you're using. I will probably be basing full charge at 14V.

Chris
 
Hi Chris

I have looked at the spec of the batteries but there is not mention of full charge voltage. It does say that the battery has a discharge cut off voltage of 9V. Its Lithium Ion.

I will carry out a full charge, measure the voltage and get back to you. The manufacture will be closed until tomorrow so its just as quick to do it this way.

Regards

Justin
 
Hi Chris

The battery has completed the charge cycle and its measure 12.51V

I haven't used these batteries before so I'm not sure if it will take any more of a charge. The battery comes with a charger which switches off once the battery reaches a certain level, In this case it switched off at 12.51V

Regards

Justin
 
Hi Chris

The battery has completed the charge cycle and its measure 12.51V

I haven't used these batteries before so I'm not sure if it will take any more of a charge. The battery comes with a charger which switches off once the battery reaches a certain level, In this case it switched off at 12.51V

I just went back and glanced as several pages of this thread and couldn't find any reference to your battery...

But, the numbers you posted above are consistent with a 3 cell 11.1V LiPo pack... The nominal voltage of the LiPos is 3.70 (thus 11.1V) with a max charge voltage of 4.20, thus they would be charged 100% peak at about 12.6 volts...
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
Justin, thanks for making the measurments. CocaCola, thanks for confirming it.

Chris
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
Justin, this is just to warn you that my laptop may be on it's last leg over here. I just hope that I get another PC and transfer all my stuff before it gives up the ghost.

I do all my computing in my screen room. No matter how hot it gets at this time of the year I can't stand being trapped inside the house with air conditioning. I'd like my next laptop to have an internal temperature readout, so I know when it's getting near dangerously high. This old girl just shut itself down today because we had a blistering hot day. At this time of the year, whenever the winds don't come off the ocean they blow from the west off of the Everglades and it's nasty when that happens. I thank God it's seldom. So, If I disappear on you, that's why.

Chris
 
Hi Chris

That's not good news..I wish I could help, I have a couple of machines under the stairs here you are welcome to have but Its a long drive to pick em up!! Have you checked for blocked air vents?

If you do disappear I'll hang on as if your like me you wont be able to last long without buying a new computer to fill the void.

I'm afraid I pre-empted your shopping list and my new OLED arrived today along with a couple of PICAXE chips. I'm going to rig it up tonight after work and see "what this baby can do!".:D

I have got a bit of an idea :p of how to get the reading for the step 0 to 5 but I'm completely stumped on the battery level indicator as I can't work out how you can get a reference from an already flattened battery.

Well, I hope you can stick around and thanks for the heads up.

Thanks

Justin
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
Justin, as it turns out there may be more life left in the old girl after all. When my laptop shut itself down yesterday I was simulating the code found here..
http://www.picaxe.com/docs/frm010.pdf

I had put the simulator in 'Break' mode while I was reading the pdf data on this chip. I then started surfing around to see if this Picaxe package is what was the same one that's included on your protoboard. All this time the simulator was still in Break mode and must have totaled over 45 minutes. After my PC cooled off I crossed my fingers and turned it on, posted my last message to you and ran that code again and placed it in Break. As I suspected. my CPU was running @ 100%. So, now I know that placing the simulator in Break does not relieve the demands on the CPU. I'm still shopping for a new laptop though. ;)

Chris
 
Last edited:

CDRIVE

Hauling 10' pipe on a Trek Shift3
Justin, regarding use of the ADC to monitor your battery voltage: What is your familiarity with 'Ohms Law'? Ohms Law is ground zero for all the building blocks of electron theory and design. Understanding and mastering it is essential and one of the first things covered in basic electronics courses.

To monitor your battery voltage using the ADC function and then outputing that data to the LCD via SerOut, you must first divide the battery voltage down to a safe voltage for the Picaxe to read. The most common method to do this is with a resistive voltage divider. In your case the most convenient division ratio would be 10:1. Search the forum for "Voltage Divider".

Chris
 
In your case the most convenient division ratio would be 10:1. Search the forum for "Voltage Divider".

Using a 10:1 and dropping 12 volts to a 1.2 and then using a 0 - 5 (8 bit) ADC really lowers your resolution to only a few steps between full charge and low (dead) battery...

Doing a 1:3 is just as easy and gets you a 0-4 reading, while a 1:2.7 would even be better as it would get you about a 0 - 4.8 @ 13 volts...

Using a 3k and a 1k to get a 3:1 ratio isn't harder than using a 10k and a 1k to get a 10:1 ratio or a 2.7k and a 1k to get a 1:2.7 ratio...

The issue is to monitor the battery you are not even all that concerned with the entire range, the difference between a fully charged 12 volt battery and a low one is only a few volts to start with, you are not measuring the entire 0 to 12 volts swing you are measuring the 12 volt to 10 or 11 volt swing as the difference between a fully charged and dead battery for most purposes...
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
Using a 10:1 and dropping 12 volts to a 1.2 and then using a 0 - 5 (8 bit) ADC really lowers your resolution to only a few steps between full charge and low (dead) battery...
<SNIP>

Regarding this statement and the stuff I snipped: I totally agree!. ;)
BTW, because I'm so stuck on Tina, who, as I said, doesn't supply Picaxe models yet, I've been reading up on blank PICs, PicBasic and .ASM files, which Tina does support. Though I still wouldn't recommend them for Justin at this point in time. He doesn't have Tina anyway. :D
 
Top