More Pump controlled action
Interactives
Posts: 83
Hello again. I'm working on a project that is pump controlled. Ive got a bellows hooked up to a fan, that is in turn, hooked up to a IR emitter/transistor for checking the speed of the fan. I'm using the COUNT command to read the speed of the fan like so:
cycles VAR Word
Main:
DEBUG CLS, "Pump Speed",CR
PAUSE 500
COUNT 0,100,Cycles
DEBUG CR, "Speed:", DEC Cycles,CR
PAUSE 1000
GOTO Main:
so now when I pump the bellows, the DEBUG window reads from 0 to about 30, depending on how hard I'm pumping. Im having a hard time understanding how to take the next step here, which is how to take this info from the DEBUG window, and make the STAMP out put based on the input. I've heard that the STAMP cannot read a pin and out put at the same time, so I suppose I would have to read the DEBUG terminal, then out put, then read, then output, et cetera. Can anyone suggest some good reading material for me to get the info to make this work?
I've had many suggestions in the past for using the PULSIN command to read the speed of my fan, but I just couldnt get it working. The COUNT command seems much more simple, granted I can make it work while outputing info at the same time. The end result of this whole project is: pump the pump, and a much larger air supply is controlled. If you pump hard, lots of air comes out, if you pump gentley, much less air comes out. Sounds simple, but is not.
cycles VAR Word
Main:
DEBUG CLS, "Pump Speed",CR
PAUSE 500
COUNT 0,100,Cycles
DEBUG CR, "Speed:", DEC Cycles,CR
PAUSE 1000
GOTO Main:
so now when I pump the bellows, the DEBUG window reads from 0 to about 30, depending on how hard I'm pumping. Im having a hard time understanding how to take the next step here, which is how to take this info from the DEBUG window, and make the STAMP out put based on the input. I've heard that the STAMP cannot read a pin and out put at the same time, so I suppose I would have to read the DEBUG terminal, then out put, then read, then output, et cetera. Can anyone suggest some good reading material for me to get the info to make this work?
I've had many suggestions in the past for using the PULSIN command to read the speed of my fan, but I just couldnt get it working. The COUNT command seems much more simple, granted I can make it work while outputing info at the same time. The end result of this whole project is: pump the pump, and a much larger air supply is controlled. If you pump hard, lots of air comes out, if you pump gentley, much less air comes out. Sounds simple, but is not.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
That is to get a range of unknown values from a sensor. Now that you know the range of values from the sensor, you can write code to act upon the sensor output.
A good programmer I am not, but here is one of many ways you read the variable "CYCLES" then perform some action based on the result.
In the example below, I chose to perform three different events based on the value of CYCLES being 0 to 10, or 11 to 20, or 21 to 30, or do something else if not in the range of 0 to 30.
Hope this helps.
One other note......A good practice is to use only enough variable space as needed. If you are confident that the value of·CYCLES will never exceed 255 (via direct measurement or later manipulated by math), change the variable declaration to
CYCLES·VAR BYTE
P.S. I did not read your last post which indicates you already figured out how to use the result of CYCLES....making this post "old news" but if nothing else, it shows another command that can give similar results to IF statements and may seem more intuitive to some.
Post Edited (KenM) : 6/12/2005 4:54:33 PM GMT
The attached schematic will give three speeds, slow, medium and high. The value of resistors to use depend on the motor being used, and the resistors need to be a·high wattage rating (5 watts or maybe more) and be in the air stream of the of the blower.
To control the speeds you activate only one of the transistors depending on the desired speed. The schematic shown is not complete (needs resistors from gate to ground). The transistors could also be individual relays. In your car, the physical position of the fan switch replaces the transistors shown.
Many others will suggest using PWM which is also a valid method with other advantages such as less parts count and an almost infinate control of speeds ranging from stopped to full speed.
Ken
Post Edited (KenM) : 6/12/2005 7:18:23 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
you can swap out the MOSFETs with BJTs if they are biased properly by adding a series base resistor.
The gate of each FET is connected to a pin on the stamp. The circuit isn't exactly a voltage divide, but you are understanding the circuit correctly (the circuit is closer to a current divider by setting the load's resistance).
No harm is done to the blower by altering it's power, typically the speed of DC motors are set by PWM'ing the power to the motor. PWM adjustments means there is linearity between the input and the speed of the motor (50% duty cycle = 50% power). But PWM requires the complete attention of the stamp meaning you'd have troubles reading your input. So Ken's circuit permits you to set the speed of the motor without having to use PWM, your just not guarenteed that doubling the load's resistance with produce half the speed. But this is not an important criteria in your project so there are no issues with using Ken's circuit.
One additional note: Ken's circuit does not show the pull-(up/down) resistors that are standard on MOSFET biasing, typically a resistor in the 10kOhm range is tied to the gate and either Vdd or Gnd, this is to allow the gate to discharge under certain conditions.
Post Edited (Paul Baker) : 6/13/2005 4:31:50 PM GMT
Paul did a very good job answering your questions.......I have one comment to add.
Your workbench area looks very clean and organized. You should see some posts in this forum under the heading “This ole junkshop”
http://forums.parallax.com/forums/default.aspx?f=15&m=69395&g=69400#m69400
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Steve
http://ca.geocities.com/steve.brady@rogers.com/index.html
"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
That 7.8 watts is across the fan itself with a full 12 volts across the fan.
When resistors are added, some of the 12 volts will be across the fan, and some will be across the resistor(s).
When you put some resistors in series with the fan, the voltage across the fan will be decreased, and so too will the current, so the wattage goes down.
however,·I can almost guarantee that 1/8 watt resistors will quickly look like charcoal if you try to use them to make the fan run about 1/4 and 1/2 of full speed (slow and medium).
The resistor values and wattage can be approimated.
Can you disconnect the power to the motor and measure the resistance of the motor by connecting your meter across the leads that accept 12 volts?
Rotate the motor shaft to a few different positions and repeat. Based on the resistance readings, the resistor values and wattage can be approximated.
·· In the 20K position, that would mean the value was 4.52K or 4,520 ohms.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
·· Yes, I meant to say your guess was right, and clarify that whatever position you have meter in, the decimal point refers to that range.· In other words, if it's in the 2M range, and you have a reading of 1.20 that's 1.2Mohms.· I hope this helps everyone who wasn't sure on the readings.· But you were correct originally.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
The 10 watt resistors are a little overkill, but will still work.·The next steps require a little trial and error.
The 4.5k ohm resistance reading sounds strange (high), did you rotate the shaft to another position and get similar readings?
My suggestion at this point is to connect the 10 ohm resistor in series with your motor and see if the speed is near 1/4 or 1/2 full speed (or whatever your desired reduction).
Do the same with your other resistors.
K
Post Edited (KenM) : 6/14/2005 3:14:53 PM GMT