Arduino powered speed car

Discussion in 'Welcome to the DARK side' started by TSeiver, Feb 7, 2022.

  1. TSeiver

    TSeiver Full Member

    Messages:
    4
    Likes Received:
    8
    Joined:
    Feb 7, 2022
    A little while ago, a mate asked if its possible to build a wagon that can measure speed. I thought it may be an interesting excercise and it may be useful longer term for speed matching locos ..so.. challenge accepted!

    I figured all thats needed is an old wagon, arduino, hall effect sensor, small magnet glued to axel, some form of display + a good measure of maths.

    I sourced a Hornby 4 wheel wagon (cheers Martin!) and started the build. I really wanted it to be powered from the track, so I made wipers for track pickup which is then fed into a bridge rectifier (Jaycar ZR1350) and buck converter (Jaycar XC4514) for correct input voltage to the arduino. The hall effect sensor was taken from a hall effect module (Jaycar XC4434), and mounted directly above the axel. I took the magnet from an old motor and cut to size with a dremel and epoxy glued it to the axel. The display came in the form of a 4 digit LCD display (Jaycar XC3715). I added plugs so that the display, main circuit board and chassis could easily be seperated.

    Early testing revealed the need for capacitors to maintain a constant power supply. I added 5 super capacitors and a similiar circuit to a keep alive. I also added a 1uF tantalum cap (Jaycar RZ6628) to filter any potential noise coming into the circuit. Once charged, the supercapacitors are able to supply enough current for roughly 30 seconds.

    I played around with some of the variables and found 20 rotations to be suitable (which equates to 88 cm travel). Because it can take the wagon some time to travel 88cm - I also added an indicator to show if the wagon is accelerating or not.

    It was a interesting summer project. Now that its built, one change I would consider should I have my time again are to power from a battery rather than track.

    For anyone interested, you can find my code on https://github.com/jtseiver/speed-car

    [​IMG]

    [​IMG]
     
    Rob Pulham, Echidna and Jim Freight like this.
  2. ianvolvo46

    ianvolvo46 Staff Member Moderator

    Messages:
    5,364
    Likes Received:
    1,642
    Joined:
    Dec 8, 2015
    ????? :faint::faint::faint::facepalm:
     
  3. Toto

    Toto I'm best ignored Staff Member Founder Administrator

    Messages:
    15,419
    Likes Received:
    3,842
    Joined:
    Dec 5, 2017
    There is a certain Mod who will no doubt be interested in this. :facepalm: I think you are going to get along just fine. :avatar:

    Toto
     
    TSeiver likes this.
  4. paul_l

    paul_l Staff Member Administrator

    Messages:
    9,866
    Likes Received:
    5,927
    Joined:
    Dec 5, 2015
    That is a neat and professional looking project. :tophat: :thumbup:
    Just ignore the ludites above, one is busy trying rest the bottle of wine from his goat, the others an ex sparky, need I say anymore. :avatar:

    Just downloaded the software - thanks, now to try and understand it - it's been a couple of years since I've looked at an arduino sketch so am very rusty, but do need to get back up to speed, as I need to re-write the Traverser sketches.

    Thanks for posting

    Paul
     
  5. TSeiver

    TSeiver Full Member

    Messages:
    4
    Likes Received:
    8
    Joined:
    Feb 7, 2022
    Thanks for you kind comments.

    I always struggle to read someones code, so I've tried to add comments as much as possible. Let me know if you need any help.
     
  6. gormo

    gormo Staff Member Administrator

    Messages:
    6,035
    Likes Received:
    4,236
    Joined:
    Dec 5, 2015
    Ah !!!! ..... I see we have another practitioner in the dark arts with us.
    Well done TSeiver..........:thumbs::thumbs::thumbs::thumbs::thumbs:
    :tophat:Gormo
     
  7. paul_l

    paul_l Staff Member Administrator

    Messages:
    9,866
    Likes Received:
    5,927
    Joined:
    Dec 5, 2015
    Often it's a bit like a Suduko puzzle, the answer is there it's just getting into the way that the creator has solved the puzzle, and can often be enlightening, unless of course it's looking at my code a couple of years later, knowing it did work but how the hell does it manage it, cause even I can't work out what I was thinking :facepalm:

    Paul
     
    TSeiver likes this.
  8. Jim Freight

    Jim Freight Full Member

    Messages:
    1,137
    Likes Received:
    929
    Joined:
    Sep 9, 2019
    Next, a WiFi version!

    Add a serial port to wifi adapter module to the wagon and receive with a laptop or iPod, as a web browser page do I feel another distraction coming on, the only thing that keeps me away from the dark side is that I am a 3D object, a 4th would be useful :hammer:

    Jim
     
    TSeiver likes this.
  9. Jim Freight

    Jim Freight Full Member

    Messages:
    1,137
    Likes Received:
    929
    Joined:
    Sep 9, 2019
    IME that is when you find out how well you have really documented your code, got plenty of those tee-shirts and sore heads :headbanger:

    Jim
     
    paul_l likes this.
  10. Andrew Laing

    Andrew Laing Full Member

    Messages:
    365
    Likes Received:
    550
    Joined:
    Jan 19, 2020
    Interesting little project, I haven't dabbled with Arduino for a few years now.
    P.S. I'm an Avionics engineer
     
    TSeiver likes this.
  11. Jim Freight

    Jim Freight Full Member

    Messages:
    1,137
    Likes Received:
    929
    Joined:
    Sep 9, 2019
    And I was :thumbup:
     
    TSeiver likes this.
  12. TSeiver

    TSeiver Full Member

    Messages:
    4
    Likes Received:
    8
    Joined:
    Feb 7, 2022
    I had thought of using a ESP32 and using either wifi or bluetooth to send speed/acceleration information to a phone or external display... or better yet.. using 2 speedometers that send data back to a PC/RPi with JMRI + funky python scripts to auto-magically speed match by comparing speed steps to actual speed...
     
  13. Jim Freight

    Jim Freight Full Member

    Messages:
    1,137
    Likes Received:
    929
    Joined:
    Sep 9, 2019
    Just looked up what an ESP32 is, sounds even better, I'm not up to date on all these new whizzo modules.

    Most of the gadgets I would hobby build 30 years ago were with the old 8031 microcontrollers and a 68000 eval board.
    Good luck, please post here if you do :tophat:

    Jim
     
  14. Gary

    Gary Wants more time for modelling.... Staff Member Administrator

    Messages:
    7,344
    Likes Received:
    3,898
    Joined:
    Dec 5, 2015
    I knew this thread would gain some interest Terry ! :thumbs::thumbs::thumbs:

    Cheers, Gary.
     

Share This Page