PWM to RS232

Hi all,

Just wondering if there is such a thing out there to convert PWM signals into RS232 commands?


You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –


  • I think this might be what you're looking for.

    Let me know if you need anything else.
  • Hi Ryan,

    I've mentioned this before here at DIY drones (and I don't think I'm the only one to have done this ....)

    I have taken a stock ardupilot, soldered 2 wires on the back of the board to connect ch3 + ch4 to the mux input, and then have massaged, abused, and tweaked a version of the ardupilot firmware to do the following:

    1. Read 4 channels of PWM signal into the processor and store the most current values internally. The code uses an interrupt based approach so timing values are pretty tight and accurate, and PWM signals are read as fast as the receiver sends them. Thinking about how the system is laid out, I have additional DIO pins available so I think I could probably handle at least 6 channels in, maybe more if we really abuse the hardware design?

    2. At 50hz, the system broadcasts the PWM input (receiver) values out the RS232 port using a binary (or ascii) protocol. Currently I am modding my firmware to support a reading and reporting a couple of the available analog channels on the ardupilot. (i.e. pressure sensor, voltage sensor, etc.)

    3. The firmware also reads servo position commands (incoming on the serial port, from a host computer.) I don't let the ardupilot compute servo positions itself. All the autopilot / filter / pid / navigation / etc. smarts is upstream on the faster processor.

    4. The built in manual / autopilot safety switch function of the ardupilot is maintained. When in manual mode, the pilot has absolute direct control of all the servos at all times. In auto mode, the firmware positions the servos based on whatever the host computer is commanding.

    So this allows me to build an advanced autopilot around a higher power processor (like an ARM9 gumstix, or an MPC-5200 with hardware floating point). All the servo / pwm functionality is pushed out to a separate piece of hardware. I like this because my host computer can be just about anything that has a serial port (or a usb<->serial converter) ... my desktop PC, a laptop, a gumstix, maybe even god help us a Mac. :-)

    If your needs are more simple, there are plenty of devices that you can use to drive servos based on serial commands (search for instance.) However, to my knowledge, I haven't found anything that can easily read an RC receiver and broadcast those values out an RS232 port, accept servo commands via the same RS232 port, and have the auto / manual safety switch all built into the same hardware. The $25 ardupilot does all this if you only need 4 channels in and out. The ardupilot mega should be able to handle 8 channels in and out (but can only auto/manual switch the first 4 of those channels.) If you need to switch or read or control more channels you might consider pasting on a second ardupilot.


This reply was deleted.


Hiroki Tanaka liked Hiroki Tanaka's profile
Oct 13
Derrick Davies liked lisa TDrones's profile
Sep 23