Ultrasonic and H-bridge at the same time

09 Dec 2010

Hi,

I'm building a robot using the mbed as controler. The robot uses IR to avoid collisions with objects. Now I want to use an Utrasonic transmitter / receiver pair to avoid collisions. For this i need a pwm period of 25 us (40 Khz). My h-bridge for motor-control (L293d) works best with a period of 0.01 secs. The problem is that mbed uses the same period for all PwmOut pins, so it is 25 us for ultrasonic and then i'm afraid to fry my h-bridge or 0.01 secs and then i don't have an ultrasonic signal. Same goes for concurrent IR (tsop) communication and h-bridge control.

Anyone with an idea to solve this dilemma?

 

TIA Bon

10 Dec 2010

You could use this

you can read it with analogin or the "pwmin" software. (Search forums for PwmIn)

Lerche

10 Dec 2010

Hi Christian,

 

I considered that, however, I still have to find a solution for IR communication and h-bridge pwm.

Regards Bon

11 Dec 2010

from the datasheet (http://ics.nxp.com/support/documents/microcontrollers/pdf/user.manual.lpc17xx.pdf page 509)

Pulse period and width can be any number of timer counts. This allows complete
flexibility in the trade-off between resolution and repetition rate. All PWM outputs will
occur at the same repetition rate.

from my understanding, this means that you can only have one PWM period.
running at a higher frequency than specified for the Hbridge won't fry it, unless the current draw of the motors is to high. if this is the case you need a Hbridge that can take a higher current draw anyway. however at too high a frequency, the Hbridge will effectivly read as an analog input. this just changes the apparent voltage on the load, as opposed to rapidly switching it on and off. the result it a loss of torque, and really messy speed control

an option is to get an IR module that comunicates via serial, as opposed to PWM.