Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

PIC Microcontroller in a custom Harley motorcycle project.

  1. Dec 15, 2011 #1
    Hi guys... be kind as I am a software engineer by trade and this is my first little side-project in EE.

    So I'm building a custom motorcycle from the ground-up and it is nearly complete. I decided for the brake light and various indicator lights, that I would control them using a pic microcontroller for which I have already written and tested my program. Everything seems to be working wonderfully on the bread-board. I have a 12v DC power supply running the circuit (although I think on the motorcycle, the voltage may be around 14v) and the microcontroller is behind a voltage regulator to give it the 3.3v it requires. For the indicator lights, I have a bunch of LEDs that I blink or fade using PWM as necessary, and there is a small transistor paired with each of them which helps the pic switch them on/off. The circuit will certainly draw less than 3 Amps altogether. All of that seems to have been pretty straightforward.

    Here is the part that I'm scratching my head over. I know that in automotive applications, the electrical system is a very harsh one with EMI, voltage spikes from the ignition system, overvoltages, undervoltages, and various gremlins which I may be unaware of.

    How can one best protect a microcontroller in such an environment? I'm assuming that I'll need to put the voltage regulator and microcontroller behind a filter of sorts but I don't know how to design that piece. I have also read that there are some chips designed specifically for this purpose but I don't know much about that.

    Also, how can one protect the pins of the microcontroller where they connect to various switch inputs? (eg: low oil pressure sensor, neutral switch, directional switch, etc.)

    I hope I have provided you with enough information but please let me know if you would like more details. Any recommendations you can provide will be thoroughly appreciated.


    The motorcycle in case you are curious.
  2. jcsd
  3. Dec 15, 2011 #2


    User Avatar

    Staff: Mentor

    Welcome to the PF. And very nice quality work so far! :smile:

    Designing an Engine Control Computer (ECC) and hardening it against electrical transients and RF interference is very non-trivial. Is your motorcycle intended to be licensed and ridden on public roads? Or will it be more of a show vehicle?

    The area of Electromagnetic Compatibility (EMC) is quite large, and involves a lot of design and fabrication techniques. Here is a Google search with typical web pages with EMC info:


    But to really do a good job at hardening your ECC and the bike's electrical system, that may need you to partner with somebody who has a lot of experience in this area.

    And beyond the EMC hardening aspects, there is also the issue of processor execution reliability and rider safety. The system needs to have some "fail safe" aspects built into it, and it would be best if there were redundancy of critical processing components like the PIC. One design technique would have 3 PICs all running the same program simultaneously, and "voting" on the outcome of that processing via an external control circuit. I'm not sure if commercial ECCs use multiple processor redundancy to increase reliability, though. In things like plane flight computers and such, I think it is relatively common.

    Others will hopefully chime in with thoughts as well. But a lot hinges on whether you want to license this for public road riding, I think.
  4. Dec 15, 2011 #3
    Thanks for the compliment Berkeman.. and all of the info as well!

    Just to clarify one point, this microcontroller will be running only indicator lights for now. If I find it to be stable, I may think about controlling the brake light and blinkers with it too. But as far as the engine is concerned, it has its own ECC that I bought from a company called TwinTec which specializes in that. I'm not that brave. ;) So even if my chip becomes toast, I'll only lose indicator lights and I have a mechanism to switch them over to analog like they had in the old days. ...just in case. Also, this is not ever going to be productionized. This is going in my bike only.

    Mainly I'm using this project as a learning experience for myself. If this microcontroller remains part of the motorcycle for the long term, I'll be tickled. But I am prepared to accept defeat in the face of too many major instability problems.

    Anyway, this seemed like the place to gather more info for this next electrical system noise hurdle. Thanks again.
  5. Dec 15, 2011 #4
    Opto-isolators, perhaps?
  6. Dec 15, 2011 #5
    I may have a few of those lying around, actually. Thanks, that seems like a good idea.
  7. Dec 18, 2011 #6

    jim hardy

    User Avatar
    Science Advisor
    Gold Member

    check out automotive voltage regulators

    they're three pin just like everyday 7805 but have protection against reverse polarity and overvoltage from botched jumpstarts...

    national's selector guide will lead you to them
  8. Jan 12, 2012 #7
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook