Arduino 101 - Lesson 3

Discussion in 'Welcome to the DARK side' started by paul_l, Nov 17, 2017.

  1. paul_l

    paul_l Staff Member Administrator

    Messages:
    6,322
    Likes Received:
    1,445
    Joined:
    Dec 5, 2015
    looks like you stood up too quickly, and ran out of Tinto :avatar:
     
  2. Brian A

    Brian A Full Member

    Messages:
    26
    Likes Received:
    33
    Joined:
    Jun 12, 2019
    Paul,

    Thanks for the tutorials, got my Arduino starter pack yesterday and did all 3 lessons, good experience.

    I cheated on the last one as I used a button to simulate the home position.

    Now onto new projects, picked up a free e-book "Arduino Development Cookbook" lots of inspiration in there.

    First next steps a potentiometer to select tracks and i2c LCD screen for display.

    Thanks

    Brian
     
    Last edited: Aug 3, 2019
  3. paul_l

    paul_l Staff Member Administrator

    Messages:
    6,322
    Likes Received:
    1,445
    Joined:
    Dec 5, 2015
    Hi Brian

    When using a pot or voltage divider, do a couple of tests with power supplies.

    If you have the power supply that will finally run the arduino, create a sketch where you read the voltage value on the input pin (eg A0), using only the usb connection for power, display the value in com window. Now connect the external power supply to the arduino and do the same again. Check what the value are from both experiments.

    //Analog inputs

    int analogPin =A0;

    void setup()
    {
    Serial.begin(9600);
    }

    void loop()
    {
    int rawReading = analogRead(analogPin);
    Serial.println(rawReading);
    delay(2000);
    }



    On Victoria Roads analog controled traverser, I used a voltage divider via a 6 position rotary switch, I got different sets of voltages depending on the supply voltage, giving inconsistant results. To overcome this I had to build in ranges for each position to accomodate the variation.
    One of the big advantages of the Sparkfun Big Easy Driver, is it's ability to provide a stable 5V dc power supply for the arduino from its main supply (in my cases 20V to 32V power bricks).

    I also incorporated an Authorize push button, so that the act of rotaing the rotary switch, wouldn't start the traverser moving untill I had selected the correct road.
    It also provided a cheat for the startup routine, before powering on I would check the track alignment and adjust if required (no homing routine was in place). Then the rotary switch would be set to the current track position. On power up the switch position was read, and the current position set to that value.

    Paul
     
  4. Brian A

    Brian A Full Member

    Messages:
    26
    Likes Received:
    33
    Joined:
    Jun 12, 2019
    Paul,

    Thanks for the hint, I was playing around today and found variation in the potentiometer and so put in some gaps to ensure I got consistent results. after seeing your Victoria Roads I also implemented the Authorise button concept. I don't have my final power supply yet. So I will look for one that can supply a stable 5V as well as the main supply. I will do a test with that supply for certain.

    Cheers

    Brian
     
  5. paul_l

    paul_l Staff Member Administrator

    Messages:
    6,322
    Likes Received:
    1,445
    Joined:
    Dec 5, 2015
    Up till now I have used the Big Easy Driver, and for Viccky Road an Ex HP printer 32V 4A power supply, and for the Toto Traversers (Mk 2 & 4) I have used ex IBM / Lenovo 19 & 20 V 7A power supplies. The big easy driver supplies the regulated 5V supply for the nano.

    If you have a 9 to 12V external power supply, you could use either a LM7805 voltage regulator or a DC to DC Buck Jumper circuit

    When I try the TB 6600 I will need to change my supply arrangements. I know MERG have now revised most kits to be supplied with 12V instead of 5V, and then use the 7805 to step the voltage down to 5V. They found the voltage drop on long 5v Busses gave stability issues.

    Paul
     
  6. Andy_Sollis

    Andy_Sollis Full Member

    Messages:
    1,081
    Likes Received:
    964
    Joined:
    Aug 4, 2018
    I think I’m going to have to go back to the beginning. I know once we’ve built the outdoor section of the layout, I’ll be coming back inside and building the yard and turn table. Plan is still to do the Peco OO turntable off a stepper motor and hopefully an Arduino but not sure yet if it will be pot controlled or dcc.
     
  7. paul_l

    paul_l Staff Member Administrator

    Messages:
    6,322
    Likes Received:
    1,445
    Joined:
    Dec 5, 2015
    With Toto's O gauge turntable, he bought a stepper with gearbox attached on to it, and rather than direct drive the plan was to use a GT2 drive belt with a 20T gear on the stepper final drive and a 120T gear on the traverser - the 120T gear was printed on the cTc printer.

    Paul
     
    Andy_Sollis likes this.

Share This Page