2 Replies Latest reply on Jan 19, 2015 7:10 PM by LamarLattrel

    Porting Arduino project to Edison to speed up serial comms and PWM - worthwhile?


      Short version:


      What duration of time could an Edison receive 8bytes of information over USB (any which way) - 1ms ?  10ms ? less, more ?

      How many servos running at a PWM rate of 400Hz could the Edison hardware accommodate and address concurrently ?


      Longer version:


      I have a project using two Arduino Megas connected by USB to a PC. Each Arduino Mega is running 8 digital servos with a PWM refresh of 200Hz (as opposed to the standard 50Hz), I am restricted to 200Hz, but 400Hz would be preferred.


      The goal is that the PC sends 8 bytes of data to each of the Arduinos at 120Hz - i.e. every 8.3ms each Arduino has all it's servo positions updated in the 8 bytes they receive (each servo uses  a byte for it's position data). The issue being that the time taken to send the 16bytes (2*8) is on average longer than the 8.3 period I have available i.e. I am not running at 120Hz but more like 80Hz.


      I'm looking for alternatives to the Arduino set up, basically I want to be able to send 16 bytes as fast as possible (so I have processing time available within the 120Hz period for other tasks), and then I need to run 16 servos at 200Hz + PWM (higher then better up to 400Hz).


      I'm aware of the power requirements of the servos and would manage them - this query is more regarding serial (input) and PWM (output) data rates


      Any insight greatly appreciated


        • 1. Re: Porting Arduino project to Edison to speed up serial comms and PWM - worthwhile?

          I would perhaps instead of the arduino's driving the servo's consider something like an adafruit 16 channel servo controller.


          By playing with the prescale, I believe you could get the desired servo frequency.


          Then it is just a question on how fast you can get the i2c data to the servo controller.


          There is somewhere a variant from another manufacturer (in the UK I believe) that uses a secondary external crystal on the controller chip (Can't for the life of me remember which chip it is). ANyway the external crystal is supposed to be more accurate.


          I have just submitted the upm libraries to Brendan for the adafruit controller so hopefully they should be in the dist soon - these are not however arduino libraries - but from memory, I think the adafruit libraries will work on the Edison with little if any changes.



          • 2. Re: Porting Arduino project to Edison to speed up serial comms and PWM - worthwhile?

            It would seem that this might solve the PWM issue - I'd need 2 however, only running 8, as to send all 16bytes to one arduino over 8.3ms results in a serial buffer overflow.


            Even with two, the input serial rate is still an issue ...


            Maybe I could have mentioned this earlier but the sensor that the PC is working with only gives at most 8bits resolution anyway, so, in addition 12bits would unfortunately be wasted on me 


            Still though, it's nice to know about the product.