1. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  2. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  3. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

Showroom FlyPT - 6DOF Brushless DIY Actuators

Discussion in 'DIY Motion Simulator Projects' started by pmvcda, Aug 29, 2017.

  1. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    1,530
    Location:
    Portugal
    Balance:
    11,787Coins
    Ratings:
    +1,642 / 13 / -0
    My Motion Simulator:
    6DOF
    Thank's!
    I think PETG is good enough and easy to print. It's my choice for now.
    For the motor, I think it's enough, but if not, they will have to be changed.
  2. Spit40

    Spit40 VR Flyer

    Joined:
    Nov 3, 2016
    Messages:
    338
    Location:
    United Kingdom
    Balance:
    2,862Coins
    Ratings:
    +194 / 3 / -0
    My Motion Simulator:
    3DOF
  3. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    1,530
    Location:
    Portugal
    Balance:
    11,787Coins
    Ratings:
    +1,642 / 13 / -0
    My Motion Simulator:
    6DOF
    So it seems that's going to work fine.
    But forget what I said before about interrupts and resolution.
    Resolution will be less than 1mm ( 0.833333mm = 5/6 ). I can achieve a positioning of 60º.

    How the it works:

    Limit switches are still present and the pot will be replaced by a simple resistance.
    I will keep it working with an analog read, where 0 is obtained when the minimum is pressed and 4095 when the maximum is pressed.
    When not pressed it should return a value in the middle.
    They will be used for calibration, for safety and also to detect and correct missing counts with the hall sensors.
    So if after calibration it touches maximum, it corrects current position to maximum, and the same at minimum.

    Arduino was replaced with an ESP32. Way faster and cheaper (8.95€).

    The BLDC motor has 3 hall sensors inside. They are used by the controller to adjust speed.
    So I connected those hall sensors to 3 ports on the ESP32, but not directly, since the BLDC 8015-A controller feeds them with 15V.
    So I had to convert them from 15V to 3.3V. This was done with a level shifter (5 items, each with 4 canals for 3.75€):

    s-l1600.jpg

    Instead of interrupts, I had to use a simple loop, because at high rpm, there are so many interrupts that the code was unable to run on the main loop.
    Some "tricks" are needed for that, since I will loose some info between readings.
    First, we get the hall sensors info. It's 3 bits (from 3 pins) converted to decimal. I call it an angle.
    Rotating clockwise, it generates the following sequence:

    101 = 5
    001 = 1
    011 = 3
    010 = 2
    110 = 6
    100 = 4

    Knowing the last value I can know how many are between the last and the current value and increment the position by that value.
    But that's not so simple. At low rpm, we can get the sequence, but above a certain value (around 50 in a scale of 0 to 255) we start to skip more than 2 values and we don't know anymore what is the direction of rotation.
    So I have to analyse it depending on the rotation speed. For slow speed I use one lookup table and for high speed another one.
    In the slow table we can skip only 3 values, but on the high speed we can skip 6.
    Also, to skip 3 values on the slow speed we have to know the direction of rotation. We can know that looking at the last increment, if it's positive or negative.
    Use the motor speed is wrong, since we might want a slow speed and the actuator moves the other way because of load, introducing errors. We should always look for the hall sensors, unless we are at high speed with high torque.

    All this is working with the PID of the code for potentiometers.

    I'm right now looking for optimisation and cleaning of the code to show it and make a video with one actuator working.
    I had to disconnect the motor from the ballscrew to avoid some kind of damage on the actuator or controller.

    Future problem might be to achieve 6 actuators in one ESP32. I see it nearly impossible for speed reasons, but also lack of pins.
    Also, I have right now the need of 3 different voltages:

    15V for the hall sensors
    3.3V for the ESP32
    5V to control speed and direction in the controller

    To many level shifters. It's going to be crazy for 6 actuators. I have to look for a solution, maybe with a large breadboard.

    Hope to show something tomorrow.


    EDIT:
    Forgot to say that the ESP32 has two cores.
    So it gives me the possibility to implement interrupts (maybe) in one core and the main loop in the other one.
    Or even speed up the code sending the position calculation or other code to another core.
    Last edited: Jun 28, 2018
  4. Spit40

    Spit40 VR Flyer

    Joined:
    Nov 3, 2016
    Messages:
    338
    Location:
    United Kingdom
    Balance:
    2,862Coins
    Ratings:
    +194 / 3 / -0
    My Motion Simulator:
    3DOF
    ESP32 is new to me. Looks very powerful for the money. I don't follow your Pot/resister modification but I'm sure all will become clear. Are you saying you'll rely on the hall sensors to determine revolutions completed and match that to actuator position with the occasional reset by going to the full length?

    All in all this is some impressive software and hardware engineering.
  5. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    1,530
    Location:
    Portugal
    Balance:
    11,787Coins
    Ratings:
    +1,642 / 13 / -0
    My Motion Simulator:
    6DOF
    Yes :)
    The reset to calibration values is made only if we reach the limits. If we reach them, it's because something was lost...

    For the limit switches you can see my wiring diagram on the first page.
    It was the solution to use only one pin to receive info about the pot and limit switches. This allows the use of 6 actuators with one Arduino Uno.
    Minimum switch actuated, circuit to GNG, 0 value.
    Maximum switch actuated, circuit to 5V (In Arduino Uno), 1023 value
    No limit switch activated, we get the pot value.
    Removing the pot and replacing it for a fixed resistance, makes the same effect, but without the variation of the pot. Now I wont need the variation, just maximum and minimum.

    The ESP32 is very capable and cheap.
    We can program it with the Arduino IDE, with the same commands.
    For a comparison chart, look here: https://hilo90mhz.com/arduino-esp32-esp8266-101-speed-test-comparison-chart/
    And don't forget this is a dual core... we can make "threads"
    For a basic guide to use the Arduino interface, look at this video:
  6. Thanos

    Thanos Building the Future one AC Servo at a time... or 6

    Joined:
    Jul 6, 2017
    Messages:
    1,175
    Occupation:
    Electronics Engineer
    Location:
    United States
    Balance:
    4,199Coins
    Ratings:
    +920 / 9 / -0
    My Motion Simulator:
    AC motor, Motion platform, 4DOF, 6DOF
    No way to use interrupts for encoders for six motors. Been there, tried, failed to do in single microcontroller, not because of speed or pins only, but because you will be missing pulses and execution loops because of priority of IRQ.

    I end up using 7 networked microcontrollers on my 6dof controller for servomotors that each reads in real time up to 120000 per second quadrature pulses, so it can be used with large 500mm/s actuators.

    Each servo module reads the encoder and limit switches and also handles safe disconnects and servo enable functions.



    It was worth the trouble making it as it managed to fully control this:




    Perhaps you can use one ESP32 per actuator, but one to do all... nope.
    • Informative Informative x 2
    • Like Like x 1
  7. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,340
    Location:
    London
    Balance:
    9,001Coins
    Ratings:
    +296 / 8 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    would the particle photon be the right tool - i think it has 6 processors

    https://www.particle.io/products/hardware/photon-wifi/

    most industrial applications use dedicated counting chips that communicate with the main processor - you can buy shields for the arduino dedicated to high speed counting
  8. Thanos

    Thanos Building the Future one AC Servo at a time... or 6

    Joined:
    Jul 6, 2017
    Messages:
    1,175
    Occupation:
    Electronics Engineer
    Location:
    United States
    Balance:
    4,199Coins
    Ratings:
    +920 / 9 / -0
    My Motion Simulator:
    AC motor, Motion platform, 4DOF, 6DOF
    I tried a couple of these high speed counting chips but still require interrupts to read them and their data transfer takes processing power from the micro, increasing the latency. Usually they have 8bit bus that takes lots of pins. Also still remains the issue of having to deal with additional inputs outputs for limit switches and activation of the servos.
  9. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,340
    Location:
    London
    Balance:
    9,001Coins
    Ratings:
    +296 / 8 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    your solution for the 6x servo motors is a good one - it would be a lot easier to use a 0-5v sensor for position like the a linear potentiometer, but they are not cheap !
  10. Thanos

    Thanos Building the Future one AC Servo at a time... or 6

    Joined:
    Jul 6, 2017
    Messages:
    1,175
    Occupation:
    Electronics Engineer
    Location:
    United States
    Balance:
    4,199Coins
    Ratings:
    +920 / 9 / -0
    My Motion Simulator:
    AC motor, Motion platform, 4DOF, 6DOF
    You can make your own...
    https://www.thingiverse.com/thing:1926226
    • Like Like x 4
  11. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    1,530
    Location:
    Portugal
    Balance:
    11,787Coins
    Ratings:
    +1,642 / 13 / -0
    My Motion Simulator:
    6DOF
    So, after some idiotic code errors, it's...

    Working!
    So glad.

    I made some crazy lookup tables depending on motor speed, but it was simpler than I thought.
    No interrupts. I don't need them, just a fast loop.
    We can loose some readings, but using one lookup table I can loose up to 3 and recover. Seems to be enough for my motors and one actuator with one ESP32.
    I will try with more actuators.
    First, some cleaning on the code and a video to show the results...
  12. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    1,530
    Location:
    Portugal
    Balance:
    11,787Coins
    Ratings:
    +1,642 / 13 / -0
    My Motion Simulator:
    6DOF
    So here's the video:

    (blue tape marks the middle position...)
    Trying to show actuator go to middle position after some movements with simtools.
    (The Arduino hanging upside down is just to feed 5V for the speed control)

    And the code (still needs work):
    Still quite some work needed. Can be optimised!
    Maybe the most important part:
    Those are the lookup tables.
    Hall codes go from 1 to 6 (not sequentially).
    The order is:
    101 = 5
    001 = 1
    011 = 3
    010 = 2
    110 = 6
    100 = 4

    We store the last code read on the hall sensors.
    Then with the old one and the new one (current), we look at the table with those coordinates and get the number of steps we have between them.
    I had 4 tables, those 2 and 2 more for higher speeds, but they are not needed.
    Also, I have values from 0 to 7, not only 1 to 6, because the hall sensors might return a 0 or a 7 very occasionally (it's a bad reading).
    So this allows us to loose up to 3 steps and still recover the correct position.
    The best part is that we can make it really fast. No if's or switch case....

    No more POT's:p
    • Creative Creative x 2
    Last edited: Jul 2, 2018
  13. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    1,530
    Location:
    Portugal
    Balance:
    11,787Coins
    Ratings:
    +1,642 / 13 / -0
    My Motion Simulator:
    6DOF
    Agree, but I'm using only the hall sensors inside the brush less motor.
    They generate 6 impulses by turn, and with those motors, they can go up to 4500 rpm.
    So it's a maximum of (4500*6)/60=450 impulses per second.
    Resolution is not as good as an encoder, but 1 turn=5mm. so I have a resolution of 5/6mm, less than 1mm, more than enough for this kind of application in my opinion.
    Could use a gearbox to increase resolution and torque, but at the cost of speed and money.
    Maybe I need 1 ESP32 for each actuator, but at 8.35€ each one, it's really not a problem in the big picture.
    That is my next test.
    • Like Like x 1
  14. Spit40

    Spit40 VR Flyer

    Joined:
    Nov 3, 2016
    Messages:
    338
    Location:
    United Kingdom
    Balance:
    2,862Coins
    Ratings:
    +194 / 3 / -0
    My Motion Simulator:
    3DOF
    I'm all for pragmatism so coping with unpredictable readings and lost data points sounds fine to me if it produces a neater engineering solution. Can it handle 6 actuators is the question I guess or did you say you'd use 6 ESP32 ?
    • Agree Agree x 1
  15. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    1,530
    Location:
    Portugal
    Balance:
    11,787Coins
    Ratings:
    +1,642 / 13 / -0
    My Motion Simulator:
    6DOF
    It's a controlled lost data...
    And the code has no limits control to re calibrate the actuator.
    After many test's, I never lost positioning.
    If needed, I will use 6 ESP32, but I will test.
  16. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    1,530
    Location:
    Portugal
    Balance:
    11,787Coins
    Ratings:
    +1,642 / 13 / -0
    My Motion Simulator:
    6DOF
    Current electronics schematic:
    Electronics for 1 actuator no pot.png
  17. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,340
    Location:
    London
    Balance:
    9,001Coins
    Ratings:
    +296 / 8 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    What is the processor speed of the esp32 ?

    Does it not have 2 processors ? Perhaps one can do the counting and one the main program ?
  18. Thanos

    Thanos Building the Future one AC Servo at a time... or 6

    Joined:
    Jul 6, 2017
    Messages:
    1,175
    Occupation:
    Electronics Engineer
    Location:
    United States
    Balance:
    4,199Coins
    Ratings:
    +920 / 9 / -0
    My Motion Simulator:
    AC motor, Motion platform, 4DOF, 6DOF
  19. Spit40

    Spit40 VR Flyer

    Joined:
    Nov 3, 2016
    Messages:
    338
    Location:
    United Kingdom
    Balance:
    2,862Coins
    Ratings:
    +194 / 3 / -0
    My Motion Simulator:
    3DOF
    Hi @pmvcda - how's it going? I'm following this thread with great interest as I'd love to make an actuator just like it when I can find the time. I'm curious about brushless. I read that you get more torque-per-watt than brushed. Do you have an idea how powerful a brushed motor would need to be to achieve the same performance?
  20. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    1,530
    Location:
    Portugal
    Balance:
    11,787Coins
    Ratings:
    +1,642 / 13 / -0
    My Motion Simulator:
    6DOF
    Hi,

    Got some days at the beach :cool:, but I'm back.
    I was able to put two actuators working with one ESP32 and I want to test with 3.
    I also want to make some tests with interrupts for the limit switches, so I can make the code run faster instead of reading the limits at each loop.

    But it's a big mess in wires right now.
    So I ordered some PCB's, wires and plugs to make it clean and nice. Still waiting...

    When I decided for the brush-less motors, it was for 3 reasons:
    1: Smaller for the same torque
    2: Internal hall sensors
    3: Durability (no brushes)

    At start I didn't used the sensors for positioning (my original idea) because I only had Arduino boards and didn't know of the ESP32.
    But now with the ESP32 and after destroying at least 4 pot's (3 of the blue ones and 1 of the expensive ones because I mounted the belt in the wrong position....), I decided to go that way.

    This makes the actuators cheaper, since I don't need the pot, the belt, the pulleys and also the ESP32 is cheaper than Arduino.
    I can even simplify the entire design of the 3D printed parts to make it lighter and use smaller aluminium profiles.

    So, just wait for news. I'm waiting for the material to make some visible progress.
    I have to make a load test, but I have to make something to hold the actuator and get some weights to test it.
    • Like Like x 1