Connect with us

Code in setup section of a sketch

Discussion in 'Microcontrollers, Programming and IoT' started by NMNeil, Oct 13, 2014.

Scroll to continue with content
  1. NMNeil

    NMNeil

    110
    10
    Oct 3, 2014
    Can it be done?
    I am learning to use the Ardunio Uno as I work on my project and believe this may be an easy way round a problem.
    I am working on the ignition of my old tractor and will be using hall effect sensors to fire IGBT's.
    My stumbling block is: what if when I turn on the ignition the hall sensor is over the magnet, which powers the IGBT and starts overheating the coil if it's left on too long.
    My though was to put code in the setup to read the hall sensor and if it was on, to wait 20 milliseconds,(dwell at idle should only be about 4-5 milliseconds) and if it was still on to turn of the IGBT before moving into the main loop.
    Don't forget I'm a complete newbie at the Ardunio;)
     
  2. Bluejets

    Bluejets

    5,615
    1,188
    Oct 5, 2014
    Then the program moves to the main loop after 20ms and finds the hall is still on so it turns the output back on again.
     
  3. Bluejets

    Bluejets

    5,615
    1,188
    Oct 5, 2014
    Probably best to use a change of state on the hall effect input pin or an interrupt on the same.

    Ignitions systems can be a noisy environment though so be prepared for some unexpected interference.

    I've found it best to put a small capacitor 0.01uf right on the base of the supply terminals of the hall effect switch(recommended by most manufacturers) and also protect the supply lines to the same with a 100R resistor and series zener (obviously supply to the hall coming off the zener).12v zener if using 12v supply

    Hall switch I use by the way is Allegro A1120.

    Many helpful and knowledgable people at the arduino forum also just as long as you are prepared to give some effort and not expect anyone to do the programming for you. Easy to join.
    http://forum.arduino.cc/
     
    Last edited: Oct 13, 2014
  4. NMNeil

    NMNeil

    110
    10
    Oct 3, 2014
     
  5. NMNeil

    NMNeil

    110
    10
    Oct 3, 2014
    As I said, I'm still learning, and have a long way to go:D
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-