Building an alarm system for my motorcycle

Hi, I’m a software developer and I have in mind a huge project (at least for me :P) and I would really appreciate if you could help me keep in the right path.

My idea is to build an alarm system for my motorcycle and a deceleration detector, which will activate the brake light automatically (both using the same arduino).

I’ve been learning a lot from internet about eletronics but there’s so many components and compatibility conditions that I’m a litte worry about the components that I chose, especially the relay and resistors.

(I’m also posting the links from where I’m buying these components in case you want to see more information about it)

=> Motorcycle Battery: YTZ10/FTZ10S 8.6Ah MF
=> Arduino Nano

=> Relay 5v 4 channels:
→ Connects to buzzer and motorcycle lights
https://www.electrofun.pt/componentes-eletronicos/modulo-rele-5v-4-canais

=> 8v 1.5A Regulator:
→ connection between 12v battery and arduino
Regulador de tensão - -8V 1.5A - L7908CV-DG

=>Resistors 10K:
→ Arduino will turn off all the sensors as soon as it detects that the battery is low.

=> RF controller kit:
→ Arm and disarm the alarm
https://www.electrofun.pt/comunicacao/kit-emissor-receptor-controlo-remoto-wireless-rf-12v-10a

=> Vibration Sensor:
→ When activated, turns ON the buzzer 1 time (just to warn). If the sensor is activated for 3 times in 5 minutes, it will activate the buzzer permanently.
Módulo Grove - Sensor de vibração Piezo (LDT0-028) - Seeed

=> Accelerometer ADXL 345:
→ Every time the alarm is activated, the arduino saves the current XYZ position. If someone moves the bike and the position changes, it will turn ON the buzzer.
→ While riding, if the accelerometer detects a big deceleration (my motorcycle brakes a lot just with the engine), it will blink the brake light.
https://www.electrofun.pt/sensores-arduino/modulo-acelerometro-adxl345-3-eixos-i2cspi

=> Bluetooth HC 06:
→ Arm and disarm the alarm
→ Activate and deactivate sensors
→ Check current battery level
→ Activates the buzzer
https://www.electrofun.pt/comunicacao/modulo-bluetooth-arduino-hc06

Buzzer piezo SYR-08A 120db:
Artigo não encontrado!

I was also thinking of putting a GPS tracker and a GSM SIM800L module to send a message everytime the alarm is activated and to send me the coordinates in case it is stolen, but it would be really difficult because I would need 2 more TX and RX ports, right?

So, what do you think?
Everything seems right to me but I’ll really appreciate if you guys could check if it is done properly. I’m just not so sure about the RF 433Mhz connections.

Thank you so much!

Put a polyfuse at the start of every power wire.
Use a 5v switching voltage regulator designed for automotive use.
It takes two resistors to make a voltage divider.
Assume there will be 60v spikes on the 12v rail.
You may have to modify the Nano to reduce the idle power consumption.
Make sure that every board you include has some kind of power saving or sleep mode.

Don't use the String class no matter how often you see it in examples. It will make you sad.
If you use the delay() function outside of setup() people will laugh at your code.
Beware of libraries with blocking functions.

I don't see any advantage in using 2 radio systems (433Mhz/bluetooth) but a nRF24L01+ 2.4Ghz module is a much better choice over 433Mhz. Simple nRF24L01+ 2.4GHz transceiver demo

I would also choose an Arduino with built in bluetooth over using a seperate module. There are several to choose from.

TelmoF:
=>Resistors 10K:
--> Arduino will turn off all the sensors as soon as it detects that the battery is low.

As noted in reply #1 you want a voltage divider (two resistors in series between 12V and Gnd) to sense voltage. To minimize current drain on the battery they should probably be on the order of 100k rather than 10k.

The diagram doesn't show how you propose to turn off all the sensors.

I like the idea of blinking the brake light on throttle deceleration, but it may be difficult to differentiate between that and the normal dynamics of riding. You could start with a prototype of Arduino, accelerometer, and a simple status display, perhaps just a single LED emulating the brake light to tune this code.

In the interest of minimizing hardware, it's not clear that the vibration sensor adds useful capability that couldn't be implemented with the accelerometer and software.

You've picked an interesting project.

TelmoF:
and a deceleration detector, which will activate the brake light automatically

What will cause the deceleration apart from your foot pressing the brake pedal? AFAIK the brake light is already operated by pressing the brake pedal. And I believe the pedal switch actually operates the light fractionally before the brakes are applied which gives following traffic a little more warning time compared to a system that only operates after the brakes have been applied long enough, and sufficiently hard to trigger a deceleration sensor.

On the other hand, false brake indications just caused by gentle deceleration (when the throttle is released but the brakes are not applied) will just confuse and irritate following traffic. A blinking light will be assumed to be an indicator.

Road safety relies to a large extent on long-established predictable behaviour (so people can apply what they learned in driving school) and new gizmos that are not widely publicised are more likely to cause problems than to solve them.

...R

Robin2:
What will cause the deceleration apart from your foot pressing the brake pedal?

The effect of engine braking on a high revving 4-cycle motorcycle is much more pronounced than a typical car. Some riders (me at least) will momentarily depress the brake lever enough to activate the brake switch when using the throttle to slow significantly and being followed by other traffic.

It's not shown in the original poster's diagram, but one would want to wire the brake light relay in parallel with the motorcycle's brake light switches. Normally there is a switch on the hand brake (front wheel) and a parallel switch on the left foot brake (rear wheel), so the relay would be the third switch in parallel. This is relay "wired or" logic.

@MrMark. You are perfectly right. Driving the first bike being followed by a newbie biker I heard that at the first stop, "Blink the brake lights". Depending on the gear, engingine braking action is significant.

Regarding power saving, pick up the +12 volt near the ignition system. That way the key switches it off and if a bad guy is bypassing the key lock he will supply Power to the ignition, unless they use trucks and wisches….

Thinking more…. I remember there was a discussion in the past whether cars should show how sharp the brakes were applied. Even engine braking due to a released accelerator, was debated.

mikb55

_> Polyfuse? Do you know a good place to buy it? I searched on google but there's so little information about it.
_> Good advice, I didn't know that I needed so many precautions to use the battery from my motorcycle.
_> I thought I only needed one to divide the battery voltage, I'll update my diagram.
_> Modifying the Nano? How? Can you give me an example?
_> Yep, that's probably the 3rd or 4th step, I will buy a multimeter and then I will measure the consumption and try to lower it.
_> Thanks! That's another thing a need to look for, code optimization.

Hutkikz
_> I want to use a bluetooth module to control arduino (turn ON/OFF the alarm without the controller, turn ON/OFF modules...) with an android app (that I will create).
_> While researching about RF modules I found this 2.4Ghz module too, but thought it would be too powerful for what I want to accomplish (arm and disarm the alarm from far away, where the bluetooth doesn't have range)
And with less range I also limit the interference that could happen.
_> What do you think? Should I really use the 2.4Ghz module?
_> You're right, I'm thinking of changing to ARDUINO NANO 33 BLE right now, it's probably the best option.
It has bluetooth, an accelerometer, a gyroscope, and a magnetometer with 3-axis resolution each.

MrMark
_> That's true, I don't need to power the arduino with 5v just to measure the battery level.
_> You're right, that part is missing and I don't have nothing in mind at the moment.
I'll search and come up with a solution late.
_> That's one thing that I really need to test to know the best way to solve it, but I think I just need to measure X axis and then calculate the force.
_> That's a good idea too, I was thinking sending data to my smartphone through bluetooth with the time when the led was active and then compare with an action cam that I will put on my dashboard.
_> The goal of the vibration sensor is to detect if someone touches the bike.
The accelerometer can detect movement, but I don't think it will detect a touch.

Thank for your help!

Robin2
_> I have a sports bike and trust me, it slows down a lot just by letting go the throttle.
_> My goal is to blink the brake light but slowly, like 3 seconds ON and 2 seconds OFF, but I need to test it out.
Also, I will turn ON the brake light only when the sensor detects a high deceleration.

But I appreciate your concern and help. Thanks!

MrMark
_> Yep, that's what I do everytime just for being afraid that someone will hit me for not driving defensively or not paying attention.
_> Well, I thought I just needed to find the wire of the brake light and connect the wire from arduino (the wire from my relay that is connected to arduino).

Railroader
_> My plan was to connect directly from the battery, that would be really good if I could find a wire that gets the power cutted off every time the bike is running.
_> I'm not concern about someone trying to bypassing the key lock because my motorcycle has a protection for that, it's called Honda Ignition Security System (HISS).

Thanks!


I'll create a new diagram paying close attention for your tips and I'll post it as soon as possible.
Thanks for all the support

In my own tests I found it impossible to achieve reliable communication at anywhere close to the figures I saw online for both modules and often the authors noted that their published figures were under ideal conditions (direct line of sight, no obstacles, etc.) For my particular project 433Mhz was unusable for a fixed 60ft. distance with a window as the only obstacle. YMMV

The Nano 33 BLE does look to be ideal for your application.

Here is a link to an article describing the challenges faced in an automotive electrical system. I imagine a high revving motorcycle would be even worse. Note that those conditions can be present on both power and signal lines.

Re saving power... Connect to the battory +12. Place a fuse close to the battory. Run that cable up to a simple On/Off switch on the panel, or anyware You would like. Simple, stoneage but very reliable, not calling for sofisticated hardware nor for quite some software concern.

Thank you Hutkikz, I’ll use 2.4Ghz.

About the transmitter, it would be nice to have a nice looking key, do you know where I could buy from?

Thank you Railroader, I’ll make some tests on that.

So, I did a new diagram, from now on I’ll use Arduino Nano 33 BLE and I’m going to begin the tests as soon as all the equipment arrives.

In this diagram, I’m not mentioning the resistance of the resistors because (if I learned how it works properly) I need to measure the output amps first and then I’ll calculate the required resistance for arduino 3.3v analog port.
Also, I placed a 12v regulator before resistance just for controlling energy spikes.

I’ll keep you up to date.

All automotive systems battery voltage vary anything from 13.8v down to around 11.6v.

Regulators such as the L7908 are negative 8v regulators.

Circuits normally need 2 wires.

Vin normally needs some headroom voltage.

Other claims I doubt.

Google "noise" in automotive environments and look for proven filtering arrangements.
It will save a lot of headaches.

bluejets:
All automotive systems battery voltage vary anything from 13.8v down to around 11.6v.

Regulators such as the L7908 are negative 8v regulators.

Circuits normally need 2 wires.

Vin normally needs some headroom voltage.

Other claims I doubt.

Google "noise" in automotive environments and look for proven filtering arrangements.
It will save a lot of headaches.

But with a regulator like that I would get 4v, right?
Because 12v - 8v = 4v, or am I misunderstanding?

That's true, a positive and a negative wire, although I just need to connect the positive wire to the motorcycle lights because they already have the negative one connected.

I'll increase the vin voltage to 8v then.

Thanks!

Why not get a converter that supplies +5 out of the 11.6 - 14.4 volt bike voltage? The total power discipation will be the same but an external 5 volt adapter will be much more capable of handling the power discipation. The onboard Arduino 5 volt converter is very limited in handling the pwr loss.

TelmoF:
But with a regulator like that I would get 4v, right?
Because 12v - 8v = 4v, or am I misunderstanding?

That’s true, a positive and a negative wire, although I just need to connect the positive wire to the motorcycle lights because they already have the negative one connected.

I’ll increase the vin voltage to 8v then.

Thanks!

Google “negative” regulator.

You are obviously confused about regulators and how they work as the 12-8=4 , although mathematically correct, doesn’t make sense here.

Your diagrams do not match your claims or speculations.
You have obviously modified something but failed to update.

One always includes the return line in a diagram , whether a line to supply or indication of ground return, otherwise it is assumed a “mistake”.

Railroader:
Why not get a converter that supplies +5 out of the 11.6 - 14.4 volt bike voltage? The total power discipation will be the same but an external 5 volt adapter will be much more capable of handling the power discipation. The onboard Arduino 5 volt converter is very limited in handling the pwr loss.

I'm still a begginer in electronics and I'm learning a lot about it just right now.
About the voltage regulator, what do you think about thhe L7805CV ?

Thanks for the support.

bluejets:
Google "negative" regulator.

You are obviously confused about regulators and how they work as the 12-8=4 , although mathematically correct, doesn't make sense here.

Your diagrams do not match your claims or speculations.
You have obviously modified something but failed to update.

One always includes the return line in a diagram , whether a line to supply or indication of ground return, otherwise it is assumed a "mistake".

Sorry, I just started to learn about electronics one week ago and there's so many information and specifications, sometimes I get confused.

In my basic diagram, my only mistake was that I forgot to connect the negative wire to the motorcycle lights, right?

Thanks for your help!

If the RF controller operates from 12 volt, (11.6 to 14.4), yes. Personally I would like to add a capacitor of some 10uF or more and a fast 10 - 100nF cheramic, near the +input of the RF. This will keep electriacl noice away a bit better.

Before the great recession of 2008, my company built the electronic control for a motorcycle manufacturer. After testing the circuit board, we potted the board with it's connectors in epoxy. The company used commercial, waterproof automotive connectors and mounted the control box under the seat. All in attempts to completely waterproof the system. They were not always successful.

Please take note of the above in your design. Water driven by 90mph wind will find the smallest opening!

Paul

@Paul_KD7HB
You are perfectly right. Direct hits from water will find its way everware.
At the same time I remember a fuel volume hobby inpeller I used for a few years. The signal passed an OP-Amp on its way to the computer. The little Verobord was contained in a zip bag, placed in the engine bay, obviously not where the storm was at the worst.

In other words, it might work. Circuits might need to be exchanged after som year or years but the project is not totally hopeless.