Cruisers Forum
 


Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 26-03-2024, 17:39   #136
always in motion is the future
 
s/v Jedi's Avatar

Cruisers Forum Supporter

Join Date: Feb 2009
Location: in paradise
Boat: Sundeer 64
Posts: 19,004
Re: Open Source Arduino Alternator Regulator

Quote:
Originally Posted by markxengineerin View Post
Thanks!

Coming back to optoisolators for the digital inputs

I could use advice on how to down-select from more than 2000 opto-isolators on DigiKey.

Goals:

-Appropriate for switches/push buttons (somewhat slow speed is ok for these). Most digital input channels will connect to toggle switches, plan to use ESP32 internal pull up resistors (3.3V).

-One channel should accept a 3-15V "stop charging" signal from outside battery management system.

-One channel will be used for "OneWire" temperature sensors- this one may have speed needs, I am not sure how tough they will be to meet.

-cheap and easy to implement , KISS principle

-popular chip that will be easily available

-An 8 channel chip, or 8 single channel circuits, doesn't matter to me. I'm making up the number 8, but the needs are likely ~ that many channels or less.
You don’t need opto isolation for push buttons / switches…. ?
__________________
“It’s a trap!” - Admiral Ackbar.

s/v Jedi is offline   Reply With Quote
Old 26-03-2024, 18:24   #137
Registered User

Join Date: Apr 2009
Location: Staging in Honolulu before sailing to Vancouver this summer
Boat: Southern Cross 35
Posts: 70
Re: Open Source Arduino Alternator Regulator

Quote:
Originally Posted by markxengineerin View Post
Thanks!

Coming back to optoisolators for the digital inputs

I could use advice on how to down-select from more than 2000 opto-isolators on DigiKey.

Goals:

-Appropriate for switches/push buttons (somewhat slow speed is ok for these). Most digital input channels will connect to toggle switches, plan to use ESP32 internal pull up resistors (3.3V).

-One channel should accept a 3-15V "stop charging" signal from outside battery management system.

-One channel will be used for "OneWire" temperature sensors- this one may have speed needs, I am not sure how tough they will be to meet.

-cheap and easy to implement , KISS principle

-popular chip that will be easily available

-An 8 channel chip, or 8 single channel circuits, doesn't matter to me. I'm making up the number 8, but the needs are likely ~ that many channels or less.

It is coming back to me now...the 4N25 is commonly used, available and inexpensive... I remember using it as a default goto opto in various design. Its maximum reverse voltage is 3V so best to put an external diode parallel to protect against reverse voltage.
__________________
Serge
spirare is offline   Reply With Quote
Old 27-03-2024, 03:21   #138
Registered User

Join Date: Aug 2020
Posts: 922
Re: Open Source Arduino Alternator Regulator

Quote:
You don’t need opto isolation for push buttons / switches…. ?
Post #110 suggests otherwise, because I'd like users to be able to mount the switches wherever they want, even if it's 20 feet away from the regulator. I guess long wire runs could pick up noise, especially if other equipment is poorly installed (SSB?). This is probably a gray area subject to individual judgement, as I think it's always possible to be more conservative, add more protection, at extra expense and complexity.

During my testing, I made a typo and had this happen, recorded by my solar charge controller:

The only consequences were a few blown fuses, and two of 20+ electrical "things" on board were fried. One was a knock-off Actisense EMU-1 style engine monitor, from ebay. The other was SCAD tank gauge computer. I believe these products had less input protections, but not really that it makes them bad products. At some point it's the user's fault. Interestingly, none of the many Arduinos were damaged, and they were only protected by the cheapest possible 5V regulators, nothing special.

So the philosophy I'm taking here is that if protection is only a few dollars and simple enough that I can understand it, I'll add. If not, I'll skip.

I would like to get any additional input on this specific switch question. I'll check out the 4N25 and try to figure out/cost estimate a circuit.
__________________
Contribute to OpenSource Alternator regulator for LiFePO4 XEngineering . net
markxengineerin is offline   Reply With Quote
Old 27-03-2024, 05:14   #139
always in motion is the future
 
s/v Jedi's Avatar

Cruisers Forum Supporter

Join Date: Feb 2009
Location: in paradise
Boat: Sundeer 64
Posts: 19,004
Re: Open Source Arduino Alternator Regulator

For remote mounted switches you could make a separate panel with a small controller and use an rs485 serial link to make it milspec.
__________________
“It’s a trap!” - Admiral Ackbar.

s/v Jedi is offline   Reply With Quote
Old 27-03-2024, 05:55   #140
Registered User

Join Date: Aug 2020
Posts: 922
Re: Open Source Arduino Alternator Regulator

Here is what I came up with so far


With the 1000 ish ohm resistor (don't think exact value matters), I think we would get 3.8mA on the input side of the 4N25 optocoupler. If the current transfer ratio is 10% (that seems the lowest value I came across), then is this enough to bring the ESP32 pin "low"? I have not found a beginner-friendly explanation of how the output side of an optocoupler works, so I might be way off here.
Another concern is about the power/ground sources. Are they supposed to be isolated? The ground is all shared here (battery ground), and the 5V pictured would come from TPS562202.

The good news is that the circuits are only 15 cents each. I found that similar are often used in home IOT systems, for switches where cable runs are long. https://www.kincony.com/esp32-input-module.html

Once I understand this simple case, next thing to think about is if the same design can work with 15V or 3V input replacing the 5V. 3 to 15V is what I imagine is a convenient range for any BMS that wants to send a "stop charging" signal.

After the low cost/simple Regulator is done I will make a "Jedi" verison, WW3 proof
__________________
Contribute to OpenSource Alternator regulator for LiFePO4 XEngineering . net
markxengineerin is offline   Reply With Quote
Old 27-03-2024, 05:59   #141
Registered User

Join Date: Aug 2020
Posts: 922
Re: Open Source Arduino Alternator Regulator

Here are a couple examples I remembered from the NMEA0183 standard. They are over my head, but maybe useful to the discussion. Different application, not for switches/buttons/"stop charging" signals, but maybe the extra components shown are useful.
__________________
Contribute to OpenSource Alternator regulator for LiFePO4 XEngineering . net
markxengineerin is offline   Reply With Quote
Old 27-03-2024, 11:52   #142
Registered User

Join Date: Apr 2009
Location: Staging in Honolulu before sailing to Vancouver this summer
Boat: Southern Cross 35
Posts: 70
Re: Open Source Arduino Alternator Regulator

Quote:
Originally Posted by markxengineerin View Post
Here is what I came up with so far


With the 1000 ish ohm resistor (don't think exact value matters), I think we would get 3.8mA on the input side of the 4N25 optocoupler. If the current transfer ratio is 10% (that seems the lowest value I came across), then is this enough to bring the ESP32 pin "low"? I have not found a beginner-friendly explanation of how the output side of an optocoupler works, so I might be way off here.
Another concern is about the power/ground sources. Are they supposed to be isolated? The ground is all shared here (battery ground), and the 5V pictured would come from TPS562202.

The good news is that the circuits are only 15 cents each. I found that similar are often used in home IOT systems, for switches where cable runs are long. https://www.kincony.com/esp32-input-module.html

Once I understand this simple case, next thing to think about is if the same design can work with 15V or 3V input replacing the 5V. 3 to 15V is what I imagine is a convenient range for any BMS that wants to send a "stop charging" signal.

After the low cost/simple Regulator is done I will make a "Jedi" verison, WW3 proof
You're on the right track....here are a few pointers:

- Yes they share the same boat ground but the signal (in this case, the 5V/switch wire) is isolated from your main board protecting it from EMI, ESD...etc.

- For the resistor value to make sure the output transistor is fully ON, use the CRT value...think of it as the gain between Input and Output. The trick is to have just enough current for the input diode to have 1.2 volt drop across it V(f). In your case, 5ma might be a bit low? However stay on low I(f) range to minimize power dissipation and maximize opto longevity. Let me know if this make sense to you ?

- BMS output signal will be same voltage as the boat...most likely from an open-collector output or in rare case a relay...no need to design your inputs to work on another voltage than the boat system (12Vdc).

- Now, boat running on 12Vdc / Lead-Acid have wide range (10.5V to 15V)...so design your input to work at 10.5V to have enough current on the opto to work ! (p.s.: Your board's power supply need to deal with this and have protection against voltage transients if powered directly from the boat 12V system!)

- Lastly, for additional protection against false triggering, simply implement a low pass filter in the software.
__________________
Serge
spirare is offline   Reply With Quote
Old 27-03-2024, 13:17   #143
Registered User

Join Date: Sep 2019
Location: Lifeaboard
Boat: FP Lavezzi 40
Posts: 3,008
Re: Open Source Arduino Alternator Regulator

12V range due to ISO is 9-17V. Double for 24V.
LTO is 2.8Vx6 cells=16,8V

So i would stick to this ranges.
CaptainRivet is online now   Reply With Quote
Old 27-03-2024, 14:22   #144
Registered User

Join Date: Aug 2020
Posts: 922
Re: Open Source Arduino Alternator Regulator

@Serge, here is an example I just found, and they also come up with 1000ohms for a 5V input signal. https://learnabout-electronics.org/S...rs/opto_52.php

I feel like I understand the input side, but the output is still confusing me. Is it true that the more light that shines across the coupling from input to output, the more current (red arrow)

the output half can "allow" through?
And this current limit is defined by the input side current and the CTR? That is my interpretation.

If this is the case, then I think I need to know the approximate value of the ESP32's internal pull-up resistors to know if the circuit I sketched is going to work or not. When there is no "light" in the optocoupler, I think the output will be disconnected, no current flow along red arrow path.
So the GPIO pin will stay high at 3.3V.
And when there is light, the output side of coupler will connect, allowing red arrow current. It has to be enough current to short the GPIO pin to ground, producing a logic level of LOW.
It looks like the factors influencing the voltage at GPIO pin are
1) Voltage source, fixed, 3.3V
2) Pull up resistor value, internal to ESP32.
3) "Capability" of the output side of the optocoupler to flow this current

The documentation for ESP32 internal pull up resistors is complicated, so I think I'm best to skip them and do it externally. New circuit looks like this:

(I do think the 5V power supply needs to be different than the one feeding other IC's if I'm trying to get isolation)

and for a 5-17V bms shutdown signal


It looks like I'm within the all the specs on the datasheet, hoping this is "done" with chosen resistor values of 1K on input side and >15K on output. I think 20K would be smart for the output, no disadvantage to going higher if speed is a non issue?
__________________
Contribute to OpenSource Alternator regulator for LiFePO4 XEngineering . net
markxengineerin is offline   Reply With Quote
Old 27-03-2024, 14:24   #145
Registered User

Join Date: Mar 2024
Posts: 1
Re: Open Source Arduino Alternator Regulator

Hello, I could help you with the software and hardware. I have done a few projects related to this myself. I have ready-made code for the web interface that can be adapted to your project. I did this myself for different projects with an ESP8266 and an ESP32. I haven't read the entire chat and I don't know how extensive the hardware is or exactly what it looks like. Is there a current circuit diagram for this? I come from the German sailing forum. There are a number of people there with excellent skills. In the Open Boat Projects section we deal with DIY projects relating to water sports. We have already successfully implemented quite a few projects. Your project has already been discussed with us. There is interest in doing something like that too. Here are two links you can follow:


https://www.segeln-forum.de/board/19...-projects-org/
https://open-boat-projects.org/en/
norbert-walter is offline   Reply With Quote
Old 27-03-2024, 15:23   #146
Registered User

Join Date: Feb 2023
Location: Drammen, Oslo
Boat: TRT 31
Posts: 1
Re: Open Source Arduino Alternator Regulator

Precisely, what I was dreaming about! Please tell me when you are done!

It will answer a lot of problems we were discussing in a Dragonfly-forum.
Sigi is offline   Reply With Quote
Old 27-03-2024, 18:30   #147
Registered User

Join Date: Apr 2009
Location: Staging in Honolulu before sailing to Vancouver this summer
Boat: Southern Cross 35
Posts: 70
Re: Open Source Arduino Alternator Regulator

@markxengineerin
Quote:
Originally Posted by markxengineerin View Post
I feel like I understand the input side, but the output is still confusing me. Is it true that the more light that shines across the coupling from input to output, the more current (red arrow)
Yes but the relation is not linear...you should think of this transistor as a switch with On and Off status. From the 4N25 specifications, transistor is ON when there is approximately 1.2 volts across the input diode... setting the resistor for 10ma I(f) is a good starting point.

Quote:
Originally Posted by markxengineerin View Post
And this current limit is defined by the input side current and the CTR? That is my interpretation.
Yes...but again in practice the output transistor switch ON very quickly and for the 4N25, it should be limited well below 100ma with a pullup resistor.

Quote:
Originally Posted by markxengineerin View Post
If this is the case, then I think I need to know the approximate value of the ESP32's internal pull-up resistors to know if the circuit I sketched is going to work or not. When there is no "light" in the optocoupler, I think the output will be disconnected, no current flow along red arrow path.
So the GPIO pin will stay high at 3.3V. And when there is light, the output side of coupler will connect, allowing red arrow current. It has to be enough current to short the GPIO pin to ground, producing a logic level of LOW.
Yes... when the output transistor is ON, GPIO pin voltage = 4N25 V(ce_sat) witch is between 0.2 to 0.5V...so technically LOW

The GPIO internal pullup is between 20K and 50K. This is high enough to use with the 4N25...no need for an external pullup. This internal pullup will limit the current going through the opto transistor to 3.3V/PullupValue...so well within the opto maximum I(c) value of 100ma


Quote:
Originally Posted by markxengineerin View Post
I do think the 5V power supply needs to be different than the one feeding other IC's if I'm trying to get isolation)
Yes...but in practice and for simplicity, all your input should be referenced to the boat 12V system unless you're getting a remote input from like another Arduino directly. Then this remote Arduino should have it own power source.

Looks like you understand how this works now...feel free to send more question if this is not entirely clear.
__________________
Serge
spirare is offline   Reply With Quote
Old 28-03-2024, 04:39   #148
Registered User

Join Date: Aug 2020
Posts: 922
Re: Open Source Arduino Alternator Regulator

Serge, thank you! The thing making optocouplers so confusing, in my opinion, is that most (all?) of the descriptions make it sound like the output is a source of current (by themselves), rather than a switch. The switch analogy makes so much more sense.

@norbert walker, thanks for your introduction. I am certainly interested in help from the German forum, and I would like this project to be listed on open-boat-projects when it is ready.

I do not have the latest schematic ready yet, probably early next week. The old (and quite outdated) one is here:
https://xengineering.net/design-review/

A list of changes since then (from my memory, might be missing a few)
-Instead of Uno OR ESP32, decided to only support this board:
https://artofcircuits.com/product/we...luetooth-board so schematic is updated to reflect new pin #s
-Logic level converter for SiC450 and TJA1050 chips
-Added 5 digital inputs with optical isolation, for various controls
-Added pull up resitor for digital temperature sense circuit
-Add optical isolation for two UART channels
-Change CAN transceiver and add isolation/protection
-Add redundant battery voltage measurement, and a hardware safety for over-voltage which does not depend on microcontroller
-Change screw terminals to "pluggable" style

List of open items where I need help:
1)Circuit to interface https://toshiba.semicon-storage.com/...odName=TLP2270
with GPIO16 and GPIO17 (two UART inputs)
This optoisolator is more unusual than the one already discussed in this thread, I don't know where to begin.
2)Check function of Vishay SiC450 buck converter arduino library. I see there is a library, but need to make sure it has full control of the chip to allow programmable setpoints and safeties
3) Same thing for INA3221 arduino library. Do we have access to full features of chip, or does library need "upgrade"?
4) User interface. My starting point is on github and I will keep working on it, but someone else can certainly do better: https://github.com/markliquid1/AltRegESP32

Right now, it is possible to send settings to the ESP32, and my next task is to set up simple output gauges, then improve the appearance.
__________________
Contribute to OpenSource Alternator regulator for LiFePO4 XEngineering . net
markxengineerin is offline   Reply With Quote
Old 28-03-2024, 17:04   #149
Registered User

Join Date: Aug 2020
Posts: 922
Re: Open Source Arduino Alternator Regulator

@norbert-walter, in your link I discovered this:
https://docs.hatlabs.fi/sh-esp32/

This is a goldmine of information relevant to this regulator. If you have contact information about the designers and could give me an introduction, that would be most helpful. I will have a list of questions after I study the schematics tomorrow. My email is mark@xengineering.net
__________________
Contribute to OpenSource Alternator regulator for LiFePO4 XEngineering . net
markxengineerin is offline   Reply With Quote
Old 30-03-2024, 11:07   #150
Registered User

Join Date: Nov 2021
Posts: 23
Re: Open Source Arduino Alternator Regulator

Quote:
Originally Posted by markxengineerin View Post
@norbert-walter, in your link I discovered this:
https://docs.hatlabs.fi/sh-esp32/

This is a goldmine of information relevant to this regulator. If you have contact information about the designers and could give me an introduction, that would be most helpful. I will have a list of questions after I study the schematics tomorrow. My email is mark@xengineering.net

You can contact https://hatlabs.fi/
https://static.hatlabs.fi/about/


They sign responsible for the Sailor Hat with ESP32 (SH-ESP32)
freaky930 is offline   Reply With Quote
Reply

Tags
alternator, regulator


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Arduino based alternator regulator Epicurean Marine Electronics 3 18-02-2023 05:36
Arduino based Alternator Regulator Project wayne.b Electrical: Batteries, Generators & Solar 11 11-03-2021 10:16
[SOLD] Balmar Regulator, 100A Alternator & 35A alternator JimJohnston General Classifieds (no boats) 0 07-10-2018 19:36
A DIY barograph based on an Arduino shield PauloOnArbutus Marine Electronics 5 23-01-2016 04:58
3 stage regulator or internal regulator for AGMs? sgtPluck Electrical: Batteries, Generators & Solar 13 05-09-2008 08:50

Advertise Here


All times are GMT -7. The time now is 02:18.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.