Microcontroller on a motorcycle - General approach and selection of platform/OS

Discussion in 'Embedded Systems and Microcontrollers' started by HeisenbergFromHeidelberg, Aug 23, 2016.

  1. HeisenbergFromHeidelberg

    Thread Starter New Member

    Aug 23, 2016
    5
    0
    Hey, i am thinking hard about a project involving a mC board (eg. raspberry, arduino, etc.) for use in a motorbike. The application would be to connect some sensors over GPIO and a display, i haven't decided yet if text only or maybe pixel based because this is not my main concern. Some ASCII data logging will be happening at low data rates, preferably to USB or other removable storage for easy retrieval. So far no problem.
    For the system to be properly integrated into the normal usage of the bike i want to hook it up to the ignition switch. There are of course many approaches to this. I came up with some ideas, would love to hear your thougts on these:

    • Wire mC with DC/DC converter to 12V source controlled by ignition switch
    • needs os/software to be fully tolerant of power on/off cycling without proper shutdown, to prevent corruption of data partition. Maybe ubuntu iot core or other os with read only mounting of system partitions and apps, or C coding without OS and without write access to the internal flash where code is stored
    • No additional power use when bike ignition is off
    • Wire mC with DC/DC conv to battery directly via a relay and control the relay with the mC and some external cirquitry, so that the 12 V supply switched by the ignition only serves as a control input for startup / shutdown of the system
    • But how...?

    How would you make it safe to cut power at any time without the risk of corruption of data of the system/application?
    Corruption of the ASCII files on removable storage could be tolerated / worked around.

    Regards, Max
     
  2. blocco a spirale

    AAC Fanatic!

    Jun 18, 2008
    1,438
    368
    I would use either battery or capacitor back-up so that when the ignition feed is removed the system can save its registers and shutdown properly. It will also require brown-out protection (there are chips for this) for when the power source dies.
     
    Last edited: Aug 23, 2016
  3. HeisenbergFromHeidelberg

    Thread Starter New Member

    Aug 23, 2016
    5
    0
    Capacitor would have to be very large though, assuming that we need eg. 400 mA for a busy raspi over some tens of seconds...
     
  4. NorthGuy

    Active Member

    Jun 28, 2014
    604
    121
    Pi is a huge overkill unless you want to do fancy graphics. A small MCU can read sensors and do the logging just fine. So, if you want to conserve power, that is the way. And falling asleep will take few ms, not tens of seconds as for Pi.
     
  5. blocco a spirale

    AAC Fanatic!

    Jun 18, 2008
    1,438
    368
    I would expect that the whole thing could happen in a few seconds if you work slowly. Very large capacitors are not a problem these days and, I don't know what you are trying to achieve, but a PI is probably excessive.
     
  6. HeisenbergFromHeidelberg

    Thread Starter New Member

    Aug 23, 2016
    5
    0
    Ok, so you are saying an Arduino with an SD Card Shield would do the job and avoid the shutdown issue altogether, because you can basically pull the plug anytime and the worst thing you may get is a corrupted SD card, but the code on the MCU stays intact?

    I have to say that the idea of using the pi for the task also came to me because i happen to have an unused model B. By the way for anyone interested in using a raspberry pi shutdown with ignition there is a nice board at http://www.mausberrycircuits.com/collections/car-power-supply-switches , unfortunately they are out of stock at the moment.
     
  7. HeisenbergFromHeidelberg

    Thread Starter New Member

    Aug 23, 2016
    5
    0
    If the arduino has integrated brown out detection working properly, that might be really a simple solution...
     
  8. dannyf

    Well-Known Member

    Sep 13, 2015
    1,811
    362
    Use brown out detection, either through the chip or a dedicated power monitor.
     
  9. blocco a spirale

    AAC Fanatic!

    Jun 18, 2008
    1,438
    368
    I don't think it's possible for a micro-controller's program memory to become corrupted due to power on/off cycling. It may temporarily lock up but brown-out reset will prevent this.
     
  10. HeisenbergFromHeidelberg

    Thread Starter New Member

    Aug 23, 2016
    5
    0
    Nice! Thanks to all of you, especially blocco!
     
  11. blocco a spirale

    AAC Fanatic!

    Jun 18, 2008
    1,438
    368
    Glad to be of assistance:)
     
  12. Picbuster

    Member

    Dec 2, 2013
    374
    50
    Hi,
    the ignition coil could produce spikes at your 12V main battery as high as 100V. ( positive and negative)
    This will go worst when battery goes bad.( higher internal resistance)
    Please be aware of that effect.
    Picbuster
     
  13. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    You need not be concerned about turn off data loss if you control the power from your controller.

    You will need a voltage regulator to convert the vehicle power down to what the controller needs. If you use a regulator with an enable YOU control when power goes on and off.

    Connect the regulator direct to the battery power. Make an enable line from switched power that can enable the regulator and be sampled by the controller. Then OR the power enable with a similar enable from the controller.

    When switched power is lost the controller can recognize this and take appropriate actions before shutting its own power off.
     
Loading...