Project for motorcycle

LuckyTNT
Posts: 2
Joined: Fri Dec 02, 2022 8:38 am

Project for motorcycle

Postby LuckyTNT » Fri Dec 02, 2022 9:55 am

So I got idea for little project but not sure about lot of details.

What I was thinking is replacing my motorcycle battery with DIY LiFePO4 but adding esp32 inside as well.

ESP32 should monitors the state of the motorcycle battery and any movement from accelerometer (for security reasons, it's semi-public garage). All communication would go through MQTT while motorcycle is in garage.
Question is what hardware I need besides ESP32 to preferably run it from motorcycle battery and with sleep mode of some kind?

I'll just throw in all the questions on my mind so answer to any of them is welcome.
-Should I use simple voltage divider to measure 12V battery or there is better way?
-Is it better to have dedicated battery for esp32 or buck converter from motorcycle battery?
-Is MPU-6050 good choice for gyroscope and accelerometer?
-Can accelerometer monitoring even work while esp32 in sleep mode?
-Will dc-dc converter, accelerometer and voltage divider drain my motorcycle battery even when esp32 is in sleep?

I am open to changes to my idea if something is not possible or not the best idea.

Thanks for any tips, answer to my questions.

User avatar
mbratch
Posts: 298
Joined: Fri Jun 11, 2021 1:51 pm

Re: Project for motorcycle

Postby mbratch » Sun Dec 04, 2022 12:23 pm

Interesting project!

I can offer my opinion on some of your questions:
-Should I use simple voltage divider to measure 12V battery or there is better way?
I would use a voltage divider then into ADC. The battery voltage of 12V is nominal and there will be some kind of discharge curve. The ADC will give you detailed information.
-Is it better to have dedicated battery for esp32 or buck converter from motorcycle battery?
You would need a dedicated battery if (1) you need information via the ESP32 while the battery is discharged, or (2) you are concerned about the ESP32 draining battery power (although I do not believe that's a big concern necessarily... see below). Otherwise, I think you could use the motorcycle battery and a buck converter. However, you might want to put an oscilloscope on the battery power to check its behavior under various conditions (e.g., when the motorcycle is started, switched off, or other changes) to make sure that any voltage/current variations are tolerated by the buck converter.
...
...
-Will dc-dc converter, accelerometer and voltage divider drain my motorcycle battery even when esp32 is in sleep?
Of course it will drain some, but not very much. Without actually doing some calculation, my hunch is that it is negligible compared to normal motorcycle battery use.

LuckyTNT
Posts: 2
Joined: Fri Dec 02, 2022 8:38 am

Re: Project for motorcycle

Postby LuckyTNT » Mon Dec 05, 2022 11:16 am

mbratch wrote:
Sun Dec 04, 2022 12:23 pm
Interesting project!
Thank you, and thank you for your input.
I would use a voltage divider then into ADC. The battery voltage of 12V is nominal and there will be some kind of discharge curve. The ADC will give you detailed information.
I just started with electronics so sorry if its silly question but you think something like (from my fast google search) ADS1115 or ADS1015?
ADC provided in ESP32 analog pins is not precise enough for this purpose?

You would need a dedicated battery if (1) you need information via the ESP32 while the battery is discharged, or (2) you are concerned about the ESP32 draining battery power (although I do not believe that's a big concern necessarily... see below). Otherwise, I think you could use the motorcycle battery and a buck converter. However, you might want to put an oscilloscope on the battery power to check its behavior under various conditions (e.g., when the motorcycle is started, switched off, or other changes) to make sure that any voltage/current variations are tolerated by the buck converter.

Of course it will drain some, but not very much. Without actually doing some calculation, my hunch is that it is negligible compared to normal motorcycle battery use.

I am leaning to using buck converter. I am just not sure how it will work with alternator charging at and motorcycle starting. Regulator/Rectifier Output Voltage by motorcycle service manual is 14.3 - 14.7V.
Also I don't really need any info when motorcycle is running, just when in garage and on wifi.

User avatar
mbratch
Posts: 298
Joined: Fri Jun 11, 2021 1:51 pm

Re: Project for motorcycle

Postby mbratch » Tue Dec 06, 2022 10:40 pm

LuckyTNT wrote:
Mon Dec 05, 2022 11:16 am
I would use a voltage divider then into ADC. The battery voltage of 12V is nominal and there will be some kind of discharge curve. The ADC will give you detailed information.
I just started with electronics so sorry if its silly question but you think something like (from my fast google search) ADS1115 or ADS1015?
ADC provided in ESP32 analog pins is not precise enough for this purpose?
I guess I didn't really specify whether to use the ESP32's ADC or an external one. :) With a suitable voltage divider, the internal ADC is probably fine for your application. I recommend reading online about the ESP32's ADC nonlinearities outside of a certain range. I seem to recall something like 0.3V - 2.0V roughly would be a good input voltage range if you need reasonable linearity.

Who is online

Users browsing this forum: No registered users and 72 guests