PDA

View Full Version : More Pump controlled action



Interactives
06-11-2005, 01:25 AM
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.

Paul Baker
06-11-2005, 03:46 AM
Sorry to hear you had difficulty with the PULSIN method, but I am happy that you got the COUNT method working. How is the pump speed controlled? An analog voltage or pulse width modulating the DC supply to the pump?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Interactives
06-12-2005, 11:08 PM
I'm bringing my camera to work tomorow so I can get a picture of this set up to post here, because I'm clearly doing a bad job of explaining. The pump is hand pumped, the idea being that kids have more fun pumping this bellows type device, than they would have pushing a boring old icky push button. As of Friday, using the COUNT command, and several if then statements (like: IF {countin > 10} THEN led1) Ive been able to have the pumping control three different leds. One for 0-10 pulses counted, one for 11-19, and one for 20- 59). So that part of the project is done (thankfully!) and I believe that that was the most difficult part. Now I have to control an electric blower according to how hard the kids are pumping. I was thinking about removing the LEDS I already have hooked up, sending the output signal from the stamp through a darlington array (ULN2803A) and then to some relays that would control the blower speed. I was thinking I could construct some sort of voltage divider, and each relay would tap from different points of that cicuit depending on how hard the kids are pumping the thing. But maybe a servo controlled valve would be easier. I'll keep you updated.

KenM
06-13-2005, 12:45 AM
My understanding of DEBUG is only to see or display what the Basic Stamp sees. It allows you to see "inside" the stamp in order to troubleshoot your program, or use it EXACTLY as you have.

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.



' {$STAMP BS2}
' {$PBASIC 2.5}
cycles VAR Word

Main:
PAUSE 500 'wait 0.5 seconds
COUNT 0,100,Cycles 'get fan speed

SELECT Cycles

CASE 0 TO 10
GOTO eventA 'or all the actions of eventA could be placed here

CASE 11 TO 20
GOTO eventB

CASE 21 TO 30
GOTO eventC

CASE ELSE
'do some other action if cycles was not in the range of 0 to 30
ENDSELECT

eventA:
'do stuff
GOTO Main

eventB:
'do stuff
GOTO Main

eventC:
'do stuff
GOTO Main

Post Edited (KenM) : 6/12/2005 4:54:33 PM GMT

KenM
06-13-2005, 03:14 AM
For your blower speed control, there is a very simple method that is very common in the automotive industry to control the speed of your heater/air conditioning fan.

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

Paul Baker
06-13-2005, 11:34 AM
Sorry, It was my fault for using the wrong term, I was asking about the blower. Ken's circuit is the best given what you are trying to do.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Interactives
06-14-2005, 12:03 AM
Ken & Paul: Thank you so much for the help. After finally getting the thing working, an enormous weight has been lifted from my shoulders. And the help I've received here has everything to do with that! Ken, as for your schematic, are those MOSFETs? I've got a pile of bipolar transistors in the shop, but I have not yet dived into the modern world of FETs or UJTs. If the gate is connected to ground via a resistor, where is the signal from STAMP? I'm so close to having the final project here- it seems like this schematic is a voltage divider, using transistors as a switch to tap of different voltages- genius! I have a 12 VDC blower here- does it hurt the motor to vary the power?

Interactives
06-14-2005, 12:23 AM
If Im doing the whole attachment thing right, here is a picture of the pump.

Paul Baker
06-14-2005, 12:28 AM
Interactives said...
Ken, as for your schematic, are those MOSFETs?
yes they are


Interactives said...
I've got a pile of bipolar transistors in the shop, but I have not yet dived into the modern world of FETs or UJTs.
you can swap out the MOSFETs with BJTs if they are biased properly by adding a series base resistor.


Interactives said...
If the gate is connected to ground via a resistor, where is the signal from STAMP? I'm so close to having the final project here- it seems like this schematic is a voltage divider, using transistors as a switch to tap of different voltages- genius!
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).


Interactives said...
I have a 12 VDC blower here- does it hurt the motor to vary the power?
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

Interactives
06-14-2005, 01:03 AM
Thanks so much!

KenM
06-14-2005, 03:23 AM
·Interactives,

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

Interactives
06-14-2005, 04:47 AM
Wow! I had no idea how tidy I was until I saw those posts! My boss makes fun of me because I like my pegboard hooks spaced equadistantly. There are benifits to being so anal, but on the downside: I curl up into a little ball and rock back and forth if my favorite screwdriver is'nt in the right spot. I'm posting a picture of my work-hole. In addition, I have one more question.My fan says it's 12 VDC @.64 Amps. If watts= amps X volts, then my fan is running at 7.8 watts! That kinda sucks for someone with a whole mess of 1/8 watt resistors. Is my math correct?

steve_b
06-14-2005, 07:04 AM
Psst...you have a screwdriver there that isn't sitting straight in its holder! ;)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·

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."

KenM
06-14-2005, 09:17 AM
Interactives said...
I have one more question.My fan says it's 12 VDC @.64 Amps. If watts= amps X volts, then my fan is running at 7.8 watts! That kinda sucks for someone with a whole mess of 1/8 watt resistors. Is my math correct?
Your math is correct (12v*.64amps is indeed 7.8 watts). But you will not need 7.8 watt resistors.
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.

Interactives
06-14-2005, 10:27 PM
Does 4520 ohms sound right? I got a reading of 4.52 ohms, while the meter was in the 20K position- I’m not used to reading resistances with my meter- usually I know the resistance. My meter has four positions for reading resistance: 2k, 20K, 200k, and 2M. Pathetically, I'm not too clear on the meaning of all that. But besides that, I went to radio shack last night, and was shocked to actually find what I needed. I have 10 ohm, 100 ohm, and 50 ohm resistors, all rated for 10 watts. (Which, apparently, I do not need) I'm also happy to announce that I have purchased my very first MOSFETs! I'm a big girl now!!

Chris Savage
06-14-2005, 10:32 PM
Interactives said...(trimmed)
Does 4520 ohms sound right? I got a reading of 4.52 ohms, while the meter was in the 20K position- I’m not used to reading resistances with my meter- usually I know the resistance. My meter has four positions for reading resistance: 2k, 20K, 200k, and 2M. Pathetically, I'm not too clear on the meaning of all that. But besides that, I went to radio
Hello,

·· In the 20K position, that would mean the value was 4.52K or 4,520 ohms.


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

Interactives
06-14-2005, 11:04 PM
THanks Chris, good to know.

Chris Savage
06-14-2005, 11:07 PM
Hello,

·· 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 (mailto:csavage@parallax.com)

KenM
06-14-2005, 11:11 PM
Interactives,

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