• AVR Freaks

Hot!MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ??

Page: 12 > Showing page 1 of 2
Author
steve1428
Starting Member
  • Total Posts : 39
  • Reward points : 0
  • Joined: 2020/11/14 01:57:39
  • Location: 0
  • Status: offline
2020/11/29 10:14:52 (permalink)
0

MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ??

Hi Can anyone suggest an appropriate MCU to read 2     50 hz PWM signals that were supposed to be destined to hobby RC servos and be able to output 4 code derived variable analog voltage signals between 0.5V to 5 V at only 100 mA  as well as 8 digital (binary) outputs for control as well ?
The analog signals don't have to be audio quality, PWM synthesized analog works fine.
 
It needs to be automotive or even mil spec grade
 
Any help appreciated. 
 
Thanks
post edited by steve1428 - 2020/11/30 02:24:17
#1

22 Replies Related Threads

    BroadwellConsultingInc
    Super Member
    • Total Posts : 97
    • Reward points : 0
    • Joined: 2020/06/09 06:07:55
    • Location: 0
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/29 11:18:46 (permalink)
    4 (2)
    Any PIC can read the Servo input very accurately with the CCP module.  For the digital analog output, I'd suggest using a SPI or I2C DAC to generate the voltage, then run through an Op Amp to allow you to drive 100mA.  You'll want to use a crystal rather than internal oscillator for the most accurate servo readings.  The microchip MCP48FEB21 has 12-bit D/A output and a SPI interface that will be easy to implement.  If I had to pick a PIC, I'd suggest the new PIC18F16Q41 as there's a lot of interest in this micro and some nice development boards available for prototyping.  It has an internal 8-bit DAC you could use depending on your resolution requirements.  But again, you can solve this problem with nearly any PIC made in the last 20 years if you use an offboard DAC.  No PIC can drive 100mA directly from a DAC output.
    post edited by BroadwellConsultingInc - 2020/11/29 11:56:45
    #2
    steve1428
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2020/11/14 01:57:39
    • Location: 0
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/29 12:58:53 (permalink)
    0
    Thanks for the reply
     
    I thought for sure I saw a PIC with 100mA capability right from the pin out, I guess I was wrong.
    The analog requirements aren't very stringent, a simple buck runs it fine.  you can see one of my applications here in a hang glider winch (vid posted below)  I'm using it to control brushless hub motors like you see in electric bikes and scooters (simulating the hall sensor based throttle control).  It's another application actually where I'm reading servo info from an RC reciever.
     
    https://youtu.be/qu6SUUNkWHk
     
    So you're suggesting an off board DAC to create the analog signal then.
     
    I got one of those MikroE buck 14 click boards for this job and I also got the ADM00856, maybe not the right devices after all then
     
    https://www.mikroe.com/buck-14-click
    https://www.microchip.com...roductDetails/ADM00856
    #3
    steve1428
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2020/11/14 01:57:39
    • Location: 0
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/29 13:17:10 (permalink)
    0
    The PIC18F16q41 doesn't have an "automotive grade" version though, I think they are able to withstand vibration better, there is the high temp range "E/P version though.
     
     
    #4
    steve1428
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2020/11/14 01:57:39
    • Location: 0
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/29 13:30:53 (permalink)
    4 (1)
    I've got 3 digital inputs and 4 analog output requirements as well as 8 digital (binary) outputs for reversing and braking.  I don't think PIC 18F16Q41 has that many I/O
    Maybe I can find a 40 pin equivalent.
     
    Thanks for the info
    post edited by steve1428 - 2020/11/30 02:20:12
    #5
    BroadwellConsultingInc
    Super Member
    • Total Posts : 97
    • Reward points : 0
    • Joined: 2020/06/09 06:07:55
    • Location: 0
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/29 13:58:35 (permalink)
    2 (1)
    When you say analog, do you mean true analog (i.e. a stable signal at a controllable voltage) or PWM (Pulse Width Modulation) (a digital signal that changes rapidly with a duty cycle with an controllable average voltage)?
    #6
    steve1428
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2020/11/14 01:57:39
    • Location: 0
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/29 14:55:49 (permalink)
    0
    I think I can get away with "simulated" analog via PWM, if you look at my video I think that's all you get from those buck converters, they are a switching type power supply aren't they?
     
    If I understand correctly, I don't think I need audio quality analog signals, just the ability to make 0.5 to 5 volts at 100 mA, I guess I can use a voltage follower circuit to make sure I don't go under current for transient loads.
    #7
    steve1428
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2020/11/14 01:57:39
    • Location: 0
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/29 14:58:21 (permalink)
    0
    I forgot to add, I really only need 4 variable analog outputs, the other 8 can be just binary digital outputs
    #8
    steve1428
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2020/11/14 01:57:39
    • Location: 0
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/29 15:18:46 (permalink)
    0
    I've got the microchip curiosity LPC, the HPC and also the explorer 16/32 as well as an easyPIC V8 and that ADM00856 as far as dev boards go, if there is something else I should get for this project please let me know
    #9
    BroadwellConsultingInc
    Super Member
    • Total Posts : 97
    • Reward points : 0
    • Joined: 2020/06/09 06:07:55
    • Location: 0
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/29 16:22:42 (permalink)
    0
    And only one servo input?  
    #10
    steve1428
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2020/11/14 01:57:39
    • Location: 0
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/29 16:54:10 (permalink)
    0
    One servo input for steering, that will be divided into the 4 different wheel outputs (analog)
    One "servo" input for throttle that will again be used to determine an overall speed of the 4 wheels.
     
    To make it even more fun there will be a heading hold gyro (MEMS accelerometer) that governs all steering and maintains a straight course when the steering control is in the neutral position, just like you see on an RC helicopter.
     
    Yes I know the code will be a tall order but I can start with simple control at first and add functionality later.
     
    In addition to the analog outputs for speed on the hub motors, there will be a digital output for a relay that accomplishes motor reversing by switching the order of two of the 3 phase lines coming from the inverter and also a digital output for applying regenerative braking to the hub motor.
     
    It's not so crazy, no one has figured out how to use these low cost, widely available hub motors from scooters and bikes for robotics, you don't see it anywhere. 
     
    Not only are they cheap and easy to find, they are VERY robust, designed to carry heavy fellows all day long up and down hills and over potholes...in the rain and snow.... try that with a shaft output stepper motor.
     
    It can be done and it will be a showcase project for people involved in mechatronics.
    post edited by steve1428 - 2020/11/30 02:17:17
    #11
    steve1428
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2020/11/14 01:57:39
    • Location: 0
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/29 16:56:05 (permalink)
    0
    sorry the reversing is not a servo, it's just a relay that switches the order of two of the 3 phase wires to the hub motor from the inverter.
    #12
    davea
    Super Member
    • Total Posts : 585
    • Reward points : 0
    • Joined: 2016/01/28 13:12:13
    • Location: Tampa Bay FL USA
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/29 17:28:05 (permalink)
    0
    all you need is a pic with 4 PWM's to generate your .5 - 5v and
    a RC network to convert to a analog signal, and a buffer OP amp (that can drive 100ma)
    and your done 
     
    edit
    you will need the buffer V+ to be >7 volts
    post edited by davea - 2020/11/29 17:34:07
    #13
    steve1428
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2020/11/14 01:57:39
    • Location: 0
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/29 18:23:53 (permalink)
    0
    I think PWM 0.5 to 5V will run the brushless motor controller, it doesn't have to be true analog, I just need to step it up to 100 mA and put a voltage follower on it maybe.
     
    I think the PWM on MCU pinout is limited to 30mA although I thought for sure I saw a PIC that was capable of producing 100 mA PWM for an automotive application.
     
    If I can't get a PIC to directly produce the 100 mA signal I was going to use the MikroE Buck 14 click to get more power, microchip has bucks too I could use.  I got an ADM00856 but I think that's overkill for a cpu power supply maybe.  The MikroE click boards are supposed to work seamlessly with the PICs
     
    At least now I know I can get any PIC to read the 50 Hz servo signal from the RC receiver now.
     
    I'm still at a loss as to what PIC to try, I'm not sure the previous suggestion of the PIC 18F16Q41 was a best choice but maybe it will work.  I just want to choose a PIC and learn that one inside and out and get to writing code for it.
     
    I'm going to use Spektrum surface controller and reciever.  It's a solid spread spectrum UHF system ready to go and they actually encourage third party applications of their devices.
     
     
     
    #14
    Antipodean
    Super Member
    • Total Posts : 1984
    • Reward points : 0
    • Joined: 2008/12/09 10:19:08
    • Location: Didcot, United Kingdom
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/30 04:14:38 (permalink)
    0
    steve1428
    I think PWM 0.5 to 5V will run the brushless motor controller, it doesn't have to be true analog, I just need to step it up to 100 mA and put a voltage follower on it maybe.
     
    I think the PWM on MCU pinout is limited to 30mA although I thought for sure I saw a PIC that was capable of producing 100 mA PWM for an automotive application.
     
    If I can't get a PIC to directly produce the 100 mA signal I was going to use the MikroE Buck 14 click to get more power, microchip has bucks too I could use.  I got an ADM00856 but I think that's overkill for a cpu power supply maybe.  The MikroE click boards are supposed to work seamlessly with the PICs
     
    At least now I know I can get any PIC to read the 50 Hz servo signal from the RC receiver now.
     
    I'm still at a loss as to what PIC to try, I'm not sure the previous suggestion of the PIC 18F16Q41 was a best choice but maybe it will work.  I just want to choose a PIC and learn that one inside and out and get to writing code for it.
     
    I'm going to use Spektrum surface controller and reciever.  It's a solid spread spectrum UHF system ready to go and they actually encourage third party applications of their devices.
     

     
    I would look at a PIC24 series chip. These can have four 16 bit PWM outputs as well as some CCP inputs. (PIC24FJ256GAxxx family come to mind, or PIC24FJ256GBxxx if a USB interface would help configure it).
    A suitable amplifier to drive 100mA could also have feedback around it to make an active filter to do the PWM filtering. You could probably run the PWM fast enough that a simple filter will provide enough attenuation to the PWM frequency.

    Do not use my alias in your message body when replying, your message will disappear ...

    Alan
    #15
    steve1428
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2020/11/14 01:57:39
    • Location: 0
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/30 05:22:46 (permalink)
    0
    Thanks for your response, I'm still wondering if getting to the variable 100 mA signal is best done with something like the Buck 14 click board, but then I would need 4 of them.
     
    The other think I was thinking about was a digi pot.
     
     Creating the analog signal with the buck could be slow and cause response time issues maybe, this is supposed to be a real time control for a buggy type of vehicle, and the gyro oversight of steering has to be fast.
     
    ....... or choose to add an amp to a PWM output.
     
    Maybe I'll have to try all and experiment.
     
    Regardless.... from looking at the chip selector guide I don't think anything exists with this output capability built in.
    #16
    Antipodean
    Super Member
    • Total Posts : 1984
    • Reward points : 0
    • Joined: 2008/12/09 10:19:08
    • Location: Didcot, United Kingdom
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/30 07:01:02 (permalink)
    4 (1)
    steve1428
    Thanks for your response, I'm still wondering if getting to the variable 100 mA signal is best done with something like the Buck 14 click board, but then I would need 4 of them.
     

    I can't get my head around why you need 100mA for an analogue input signal.
    Perhaps a link to whatever it is you are attempting to drive is in order.
     
    steve1428
    The other think I was thinking about was a digi pot.
     

     
    If you are envisioning the sort of device I am thinking of then I suspect these will be totally unsuitable.
     

    Do not use my alias in your message body when replying, your message will disappear ...

    Alan
    #17
    steve1428
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2020/11/14 01:57:39
    • Location: 0
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/30 07:37:17 (permalink)
    0
    I'm going to control my hang glider winch with XBee or Lora
    #18
    steve1428
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2020/11/14 01:57:39
    • Location: 0
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/30 07:39:15 (permalink)
    5 (1)
    It doesn't want to let me post my youtube links
     
    you can see them on my channel............embedded fabrication
     
    it shows the buck controlling the scooter hub motors, it's mimicking the hall sensor based throttle control for these eBike eScooter systems
    #19
    steve1428
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2020/11/14 01:57:39
    • Location: 0
    • Status: offline
    Re: MCU to read 50 hz servo PWM signal and output custom analog between 0.5V and 5V ?? 2020/11/30 07:43:22 (permalink)
    #20
    Page: 12 > Showing page 1 of 2
    Jump to:
    © 2021 APG vNext Commercial Version 4.5