1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. 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!
  3. 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
  4. 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

Aircores & Ardurino Controller

Discussion in 'DIY peripherals' started by wimpo`, Jun 15, 2010.

  1. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
    Re: Custom dashboard-stepper motor / LCD / servos / 7-Seg / leds

    Well... I got it!!! :youvegotaPN: Its simple amazing built and I really like the screwshield wings !!!! :clap:

    I did a quick program to see its PWM capabilities... Again stand amazed!!! I watched the onboard LED fading on-off at 62Khz PWM frequency!!!! Measured the pulse on my portable DSO NANO!!! :yippiee:


    I still cant believe I have 12 PWM channels available on this little thing to play with!!! :freu:


    THANKS!!!

    Thanos
  2. wimpo`

    wimpo` Member

    Joined:
    Jul 27, 2008
    Messages:
    89
    Occupation:
    metselaar
    Location:
    nederland, twente, vroomshoop
    Balance:
    178Coins
    Ratings:
    +5 / 0 / -0
    Congratulations :yippiee:
    And I hope that the porting from amc to arduino won't be to difficult.

    :cheers:
  3. herctrap

    herctrap Member

    Joined:
    Apr 5, 2010
    Messages:
    88
    Location:
    Ilion / Pylos
    Balance:
    243Coins
    Ratings:
    +0 / 0 / -0
    Arduino Power

    αυριο παω να βρω και γω το δικο μου κοντερ
  4. wimpo`

    wimpo` Member

    Joined:
    Jul 27, 2008
    Messages:
    89
    Occupation:
    metselaar
    Location:
    nederland, twente, vroomshoop
    Balance:
    178Coins
    Ratings:
    +5 / 0 / -0
    hey thanos quick question about tough subject.
    if i want to use pid controll on dc motors than is this a close calculation.
    begin.
    old position -or+ new position.
    increment number to new position (speed 0 to 255)
    again.
    I've tried to read you bs2 code but its gibberish to me :blush:
  5. herctrap

    herctrap Member

    Joined:
    Apr 5, 2010
    Messages:
    88
    Location:
    Ilion / Pylos
    Balance:
    243Coins
    Ratings:
    +0 / 0 / -0
    you want a arduino code

    to move the dc to a certain position

    and the position of the what dc moves comes from an pontesiometer?

    ??????????
  6. herctrap

    herctrap Member

    Joined:
    Apr 5, 2010
    Messages:
    88
    Location:
    Ilion / Pylos
    Balance:
    243Coins
    Ratings:
    +0 / 0 / -0
    if so

  7. wimpo`

    wimpo` Member

    Joined:
    Jul 27, 2008
    Messages:
    89
    Occupation:
    metselaar
    Location:
    nederland, twente, vroomshoop
    Balance:
    178Coins
    Ratings:
    +5 / 0 / -0
    new position is from serial, say 80
    old position is readout from potentiometer hooked up to dc motor, say 20
    so than calculate the difference between motor position and new position.
    80-60= 20 difference
    than move to new position with desired speed without overshooting it.
    i think i got the basics but the calculation on wikipedia are not readable to me hahaha.
    [​IMG]

    i guess that this is the calculation from tronic's basic stamp code
    so yeah something like that :highfive:
  8. herctrap

    herctrap Member

    Joined:
    Apr 5, 2010
    Messages:
    88
    Location:
    Ilion / Pylos
    Balance:
    243Coins
    Ratings:
    +0 / 0 / -0
    why dont you use the above code

    i just wrote it

    its not tested but it should work if you play with the -1 +1 for the overshooting

    i will try to make one with pwm later
  9. wimpo`

    wimpo` Member

    Joined:
    Jul 27, 2008
    Messages:
    89
    Occupation:
    metselaar
    Location:
    nederland, twente, vroomshoop
    Balance:
    178Coins
    Ratings:
    +5 / 0 / -0
    yeah i am already using it for testing, but i will smack myself in the head if it was this simple.
  10. wimpo`

    wimpo` Member

    Joined:
    Jul 27, 2008
    Messages:
    89
    Occupation:
    metselaar
    Location:
    nederland, twente, vroomshoop
    Balance:
    178Coins
    Ratings:
    +5 / 0 / -0
    I made a little mistake about P.I.D it supposed to check where the motor is and where it should be, so you can make up for the overshooting.
    little arduino code i found about PID
    Code:
    int val = analogRead(potPin); // read the potentiometer value (0 - 1023)
    int target = map(val, 0, 1023, 0, 3600);// set the seek to target by mapping the potentiometer range to the encoder max count
    int error = encoder0Pos - target; // find the error term = current position - target
    // generalized PID formula
    //correction = Kp * error + Kd * (error - prevError) + kI * (sum of errors) //<- this being the calculation what i was talking about
    
    // calculate a motor speed for the current conditions
    int motorSpeed = KP * error;
    motorSpeed += KD * (error - lastError);
    motorSpeed += KI * (sumError);
    // set the last and sumerrors for next loop iteration
    lastError = error;
    sumError += error;
    
    but i also found that there is a pid library for the arduino, but that doesn't make sense so far
  11. herctrap

    herctrap Member

    Joined:
    Apr 5, 2010
    Messages:
    88
    Location:
    Ilion / Pylos
    Balance:
    243Coins
    Ratings:
    +0 / 0 / -0
    what pid means?


    the pontesiometer (i_am_at_this_potision) checks where the motor or the chair is

    the (potision) is the serial read for where the motor should be
  12. wimpo`

    wimpo` Member

    Joined:
    Jul 27, 2008
    Messages:
    89
    Occupation:
    metselaar
    Location:
    nederland, twente, vroomshoop
    Balance:
    178Coins
    Ratings:
    +5 / 0 / -0
    yeah but the trick is how farther away from the new position the faster you go to it. (setting max speed)
    but along the way measuring the distance to go, so that you will slow down when you are near the new position. (setting minimum speed)
    http://abigmagnet.blogspot.com/2008/10/dc-motor-control-part-one.html
    this is some great documentation about it (i was searching for it all day)
  13. herctrap

    herctrap Member

    Joined:
    Apr 5, 2010
    Messages:
    88
    Location:
    Ilion / Pylos
    Balance:
    243Coins
    Ratings:
    +0 / 0 / -0
    ok let me make somethink with pwm
  14. herctrap

    herctrap Member

    Joined:
    Apr 5, 2010
    Messages:
    88
    Location:
    Ilion / Pylos
    Balance:
    243Coins
    Ratings:
    +0 / 0 / -0
    *why i had write POTISION???
  15. wimpo`

    wimpo` Member

    Joined:
    Jul 27, 2008
    Messages:
    89
    Occupation:
    metselaar
    Location:
    nederland, twente, vroomshoop
    Balance:
    178Coins
    Ratings:
    +5 / 0 / -0
    5ms at the moment and no delays in code
  16. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0

    Perhaps from potentiometer or you have a girlfriend from Patisia or you are just tired as its getting late... My mind was turned to Frappe trying to educate myself in C and the new command set... I'll have to do a quick format at my brain soon... heading for the bed! :keepawake:
  17. herctrap

    herctrap Member

    Joined:
    Apr 5, 2010
    Messages:
    88
    Location:
    Ilion / Pylos
    Balance:
    243Coins
    Ratings:
    +0 / 0 / -0
  18. wimpo`

    wimpo` Member

    Joined:
    Jul 27, 2008
    Messages:
    89
    Occupation:
    metselaar
    Location:
    nederland, twente, vroomshoop
    Balance:
    178Coins
    Ratings:
    +5 / 0 / -0
    haha i didn't notice either, a well it is quite tough to think in English let alone write in it.
    I don't type without my spelchecker on.
    I've lost the ability to concentrate so I'm going to stop now.
  19. egoexpress

    egoexpress Active Member

    Joined:
    Dec 13, 2006
    Messages:
    3,839
    Location:
    Germany - Frankfurt/M
    Balance:
    421Coins
    Ratings:
    +10 / 1 / -0
    ;D
  20. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    Looks like some new controllers are going to surface for X-Sim very soon! Good to see you guys working on the arduinos.

    Judging by the code, the programming environment seems to have a fairly higher level instruction set (even Mickey Mouse could write a program with it :D ), but the speed of the micro controller should make up for it. Just make sure to avoid delay(); in the code.