8 years, 4 months ago.

Airpump(motor) should run for atleast 1 minute....How to do it?Please help

Please tell the instruction to do it?

2 Answers

8 years, 4 months ago.

What hardware do you have?

using FRDM board(Freedom board)

posted by vishwas nagekar 15 Dec 2015

P3=1; pc.baud(115200); Pwm1.period_ms(20); Pwm3.period_ms(20); Pwm2.period_ms(20);

intr.fall(&ISR); t1.attach(&task,0.5); start timer counting t2.attach_us(&task2,4000); ts.attach(&task3,12); Pwm1.pulsewidth_ms(15); Pwm3.pulsewidth_ms(20); Pwm2.pulsewidth_ms(20);

posted by vishwas nagekar 15 Dec 2015

If it is a slow device then yo do not need to use the pwm. Simply use an digital out put as per the sample blink code. I do not understand your question in full but with a simple timing loop using the RTC you can control the pump start and stop times etc. Maybe say a little more what you are trying to do

posted by Erastus Coetzee 15 Dec 2015
8 years, 4 months ago.

A few comments - if your goal is to just turn on a motor then you do not need to be complex with your coding with PWM (pulse width modulation). The use of PWM is necessary for stepper motors where you are being specific on the angle of rotation of the shaft of the motor and soft turn on of the motors. Basically, precision of the stepper motor angle is obtained with PWM. For simple, ON / OFF of the motor, you should apply a logic compatible (ie. 3.3 volt logic level as this is necessary to connect to the GPIO pins on the Freedom board - be sure to check the datasheets before interfacing) - recommend the use of solid state relays. There are many on the market and select one that can support the current your motor will sink (consume when ON including the surge current which is the spike current when you first turn on the motor). Google around for typical schematics for such topics including how to remove / reduce inductive currents so the interfaces are not damaged. Again, if your time to turn ON and duration for how long the motor will be ON is not accurate then you can even use nested for-loops to create this delay. Just play with the nested for loops and insert printf statements to kill time till you reach the desired delay you are after. The key requirement is for you to condition the GPIO pins on the MBED board as most motors cannot be directly driven by the very low current, low voltage GPIO pins.

Be sure to check the datasheets for the solid state relays including what is required to turn on the relay; the loads the relay can support (current & voltage and if AC or DC loads are supported).

http://www.element14.com/community/thread/13647/l/have-a-question-about-solid-state-relays-and-their-applications-ask-me?displayFullThread=true

https://developer.mbed.org/users/4180_1/notebook/relays1/

Have fun !!