Controlling H7 LEDs (bike) via Arduino

Jumping straight to the problem; I would like to make a flashing function on my enduro dirtbike. It would only need to trigger the high beam H7 LED light on the bike. On the bike there's a dedicated button to flash the high beam bulb, it's a momentary on-off type of switch, as soon as you release it the high beam light is off. I'd like the Arduino to start a flashing sequence when pressing this switch so I don't have to flash lights manually.

I'm a beginner so please point me in the right direction, I'll try to learn as I go, I just bough my first soldering iron the other day and replaced all the oem SMD leds on the bike gauge cluster, so now I'm trying to go for this challenge if possible. Could Arduino and some fast switching device, mosfet I presume, be able to do this?

A logic level N channel MOSFET will do that.

Sounds like a 12V DC system, so a MOSFET will be able to do the trick just fine.

What is fast for your eyes is slow for a MOSFET or Arduino.

Thank you for the replies guys! I'm collecting all breadcrumbs of information I can get and I'll try to get the whole puzzle like this, and hopefully learn something along the way.

Just looked up logic leven N channel Mosfet, this is the first google result - N-Channel MOSFET 60V 30A - COM-10213 - SparkFun Electronics - and the description goes like this; *if you've ever wondered how to control the headlight of a car from a microcontroller, a MOSFET is what you need. *

It annoys me to be ignorant like this, but what makes this specific mosfet so, well...specific. It has "control car headlight" as its main use case scenario, which seems very narrow niche to fill. I guess I'd ask what would differentiate this mosfet from any other mosfet, what makes this one work perfect for car headlights?

So this particular mosfet would be the starting point for this idea of mine, what else would I need?

That FET has capacity for current and voltage as well. Go for it.

OK so since I'm a beginner I have to ask beginner questions, don't bully me pls :smiley: what I'm curious is the inner works of this contraption I'm trying to make, it does sound silly to most of you but I'm an empty vessel when it comes to electronics.

So, first question, how will this mosfet communicate with the Arduino? Who will tell the Arduino if the headlight is already on or off? Would I need a step down power converter for Arduino, 5v I presume? The thing about this is that a friend of mine already gave me a schematic for this but it's so convoluted, I can't read into it, it has logic gates and whatnot and I figured there must be a "simple" way to do it, via Arduino I wrong about this?

Digging around the forum I found a thread that has similar proposition to mine, with the schematic attached.

Question - if I recreate this schematic in Eagle free or similar software, will I be able to see that it actually works and make it switch/flash the headlight (I presume that's the LOAD on the schematic).

I think for learning purposes having this visualized in a piece of software would help me with understanding this.

After you have succeeded, you will see that it is simple.

No one is born knowing any of this stuff, so don’t worry, take your time.

It looks like you are on a good path and bring a good atitude; it’s just that the path may be a bit longer than you might think.

There may be rough sections on the path also. Again, don’t worry. Rough or no it is well trodden.


Those transistors are in an odd configuration, the left one inverting the input for the right one, not contributing to switching the current. With the emitter of the left one connected to the base of the right one (your really should annotate the parts, makes it much easier to talk about it) you'd get a Darlington configuration which in the old days was commonly used for switching larger loads.

Nowadays we use a MOSFET. IRLZ44N or IRL540N are good logic level ones. Much less losses.

For more details see this tutorial. Of course instead of a motor you have a string of LEDs as load, so you don't need that flyback diode.

In the OP’s circumstances high side switching may be more practical to implement.


One does suspect that on a bike of any sort the actual lamp will be high-side switched.

What we do not know is how the present control button is actually wired to "flash" the high beam bulb and it would be useful to know the actual rating of that bulb.

Only given those details can we start to work on the circuit.

Why do you want to flash the headlight? It is one of the most dangerous things on the road that drivers do and in the UK at least, it is frowned upon unless to avoid an accident etc, like the horn. For other motorcyclists like myself, it tends to encourage other drivers to manouvre against the flow of traffic etc, without looking properly which is why it is so dangerous.

I don't see what it would achieve off road either, bar irritating and confusing others?

I don’t understand the point of your comment. I know this thread and what I’m asking is a tall order given my levels of knowledge, but questions like yours are really pointless, is it a UK thing, I know they banned selling knives in stores there, so maybe you’re just over-protective culturally.

Why do I want to flash the leds? Ummmm it’s a project bike that almost never leaves the garage, excuse me sir may I ask the council for the loicense to flash me own headlights in me own shed?

Wow! This discussion is getting a bit lively!

The original description as a dirt bike seemed to me to assuage concerns about on-road use; I can imagine that it might be useful to identify yourself with a flash or otherwise communicate.

On the road, I see daytime headlights and in fact, the present profusion of bright daytime running lights, a major nuisance, let alone flashing. The overwhelming majority of driving is on built roads with centre markings if not dividers or split carriageway, so there is quite negligible requirement to be aware of oncoming traffic at any distance.

On the contrary, these lights in daytime simply contribute to visual fatigue and a tendency not to examine the oncoming traffic stream and be less likely to notice if a vehicle is pulling out from that stream to overtake the leader.

Not to mention that this effectively nullifies the provision that motorcycles and emergency vehicles do drive with headlights on; if a significant number of vehicles already have bright daytime running lights, then there is simply no distinction to motorcycles and emergency vehicles.

Some people are able to "see" the concern here, while there seems to have been a tendency for regulators to say "you are more visible with lights on so it must be safer", completely ignoring the actual nuances.

In Sweden it's mandatory to use the low headlights on day and night. The low hight of the sun makes it difficult to see another vehicle and there lighted headlights improves safety.
All blinking vehicles, fire brigade, police, ambulance.. uses blue flashing lights and sirens.
Blinking "headlights" are not allowed, not even on a bike as I've got it. Out in the nature I suppose it can be used.

How did this thread turn from project guidance to road assistance is beyond me.

Still, if anyone is on topic and willing to give me a crumb of knowledge, I was reading some beginner books yesterday and I think the most help I could get with this is if someone would break down the process of my device, step by step.

I guess if someone could describe it as if it's 5000x slow motion and you're commenting on the flow of current, that way I could understand what happens when and why. Tall order I know, but hey, gotta try. Thanks!