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 27-02-2024, 11:35   #91
Registered User
 
becrux's Avatar

Join Date: Aug 2010
Location: Pacific NW
Boat: Hans Christian 33
Posts: 85
Re: Open Source Arduino Alternator Regulator

Quote:
Originally Posted by MikeFergie View Post
I believe all mastervolt Large body alternators are N type and that’s why you can’t use a balmar regulator on them. Only the mastervolt regulator and I believe the wakespeed which you can choose N or P type.
The Mastervolt Alpha Pro regulator is an N-type regulator. The alternator itself doesn’t care. To use a Balmar regulator, one would connect the wire labeled “Red”to the Balmar reg field output but NOT to the battery. The Balmar reg gets power from the battery, but regulates it before sending it to the field. The wire labeled “Blue” in the attached image gets tied to ground.
Attached Thumbnails
Click image for larger version

Name:	IMG_2343.jpg
Views:	22
Size:	298.1 KB
ID:	286933  
becrux is offline   Reply With Quote
Old 28-02-2024, 12:55   #92
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

I am mainly interested with this for charging a lithium bank built from cells couple with an dedicated BMS controller.

Here are my 10c suggestions.
- An input to remotely turn on/off the charger;
- An input to reduce by a programmable amount in Amps the charging output;
- Alternator & battery temperature monitoring.
- Slow ramping on/off of charge

Obviously, I would make sure the output driving the alternator field is design to fail in a safe way (shutting off the alternator)...I have seen to many smart regulator failing in a manner that drive the alternator to max output ! This also raises the question on how to handle the alternator if & when the controller goes zombie...a hardware 'watch dog' circuitry ?

Feel free to comment.
__________________
Serge
spirare is offline   Reply With Quote
Old 28-02-2024, 14:14   #93
Registered User

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

I am going to skip the N types for now, might change in a future iteration if there is demand.

@Serge- all of the features you request are included, although I am torn between having a "high/low" switch with two pre-programmed current setpoints vs. having an increment/decrement current button. I think the former would be more convenient for most people. I would put my own in "low" mode when I know solar is sufficient, and only use "high" mode in cases where it isn't and it's worth pushing the alternator hard. Increment/decrement accomplishes the same idea, but with more button presses and is less intuitive to check.

For safety, the system has a way to self-terminate if the microcontroller fails, based on a measured voltage from the INA3221. If the INA3221 fails, the system will still shut off using a secondary voltage measurement. The only way to over-charge would be for both to fail at once, very unlikely given the robust input protections.
__________________
Contribute to OpenSource Alternator regulator for LiFePO4 XEngineering . net
markxengineerin is offline   Reply With Quote
Old 28-02-2024, 14:16   #94
Registered User

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

If anyone is good with Arduino code, I have run into a problem with not being able to update the display in the same program where I'm monitoring the serial data (Victron VEdirect). Both programs work independently.

I'm not a good programmer, so, any volunteers to take a look? Email would probably be the best way to communicate- mark@xengineering.net. I will be sailing from Gibraltar back to the US for the next month or so, so will have plenty of time to document the problem in more detail.
__________________
Contribute to OpenSource Alternator regulator for LiFePO4 XEngineering . net
markxengineerin is offline   Reply With Quote
Old 28-02-2024, 14:53   #95
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
I am going to skip the N types for now, might change in a future iteration if there is demand.

@Serge- all of the features you request are included, although I am torn between having a "high/low" switch with two pre-programmed current setpoints vs. having an increment/decrement current button. I think the former would be more convenient for most people. I would put my own in "low" mode when I know solar is sufficient, and only use "high" mode in cases where it isn't and it's worth pushing the alternator hard. Increment/decrement accomplishes the same idea, but with more button presses and is less intuitive to check.

For safety, the system has a way to self-terminate if the microcontroller fails, based on a measured voltage from the INA3221. If the INA3221 fails, the system will still shut off using a secondary voltage measurement. The only way to over-charge would be for both to fail at once, very unlikely given the robust input protections.

Great...sounds you are on the right path on this project. I like the high/low switch for its simplicity both in implementation and from a user interface. Another suggestion if I may would consist in implementing a programmable output table regulated by rpm & alt operating temperature and possibly battery temperature. This would be the ultimate solution for safely using a high output alternator. I would set the output low not overload a small engine at idle, higher at fast idle for charging at anchor and tweak further to manage belt loading or max the output as rmp increases... all this while keeping the alt temperature under the rated maximum. The high/low could override the table for those not opting for setting up the table.
__________________
Serge
spirare is offline   Reply With Quote
Old 28-02-2024, 15:21   #96
Registered User

Join Date: Mar 2007
Location: Santa Cruz
Boat: SAnta Cruz 27
Posts: 6,778
Re: Open Source Arduino Alternator Regulator

Quote:
Originally Posted by MikeFergie View Post
I believe all mastervolt Large body alternators are N type and that’s why you can’t use a balmar regulator on them. Only the mastervolt regulator and I believe the wakespeed which you can choose N or P type.
Give me a soldering iron and 15 minutes and I can fix that. One brush holder goes to ground, the other goes to the field wire, and you have a P type alternator.
donradcliffe is online now   Reply With Quote
Old 19-03-2024, 05:29   #97
Registered User

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

Small update- the regulator can now read and display any NMEA0183 message.

This turns out to be pointless in retrospect, because there are no Battery Voltage/Amps parameters available in 0183... oh well, it was good practice.

Victron VeDirect is also working fully working, so next up is CAN. Do people just want to read CAN messages , or also write them? I'm starting from scratch on this learning, but guessing NMEA2K will include some relevant parameters, and I think Victron also uses CAN for some of their products. If anyone has specific needs, please post to give me something to aim for.

If anyone would like to help, I would appreciate assistance in starting the "web based interface" for adjusting parameters. Right now, the user has to open the Arduino IDE and make changes directly in the code.

I think this is really easy, but might be a turn-off for those who haven't done something similar before. Web interface sounds nice.

I also haven't started thinking about wifi/bluetooth connectivity, yet.

There are a bunch of external switches
-On/off
-Force Float
-Limp home mode
-High/Low charge rate

Recommendations for how these should be set up? For easiest installation, I was thinking they could be mounted right on the enclosure. Then people could extend the wires to their control stations as desired. Recommendations for cheap + durable switches? I might leave it up to the user to select unless there is something that's really non-controversial.

The 1st hardware release is currently on hold, want to get through the CAN software first and make sure everything's working.
__________________
Contribute to OpenSource Alternator regulator for LiFePO4 XEngineering . net
markxengineerin is offline   Reply With Quote
Old 19-03-2024, 05:34   #98
Registered User
 
OS2Dude's Avatar

Join Date: Nov 2014
Location: Atlanta, GA
Boat: Catalina 30
Posts: 667
Images: 5
Re: Open Source Arduino Alternator Regulator

You could have a config file that the code reads to get the values for the variables. At least that way the user could use any text editor to change it and would not have to recompile the code.

What are you writing it in? I've played with Raspberry Pis but not an Arduino. What languages does it support?
OS2Dude is offline   Reply With Quote
Old 19-03-2024, 05:43   #99
Registered User

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

Quote:
Arduino uses a variant of the C++ programming language. The code is written in C++ with an addition of special methods and functions. Moreover, when you create a 'sketch' (the name given to code files in this language), it is processed and compiled to machine language.
The configuration file sounds good, although maybe not that different in difficulty to implement vs. creating a simple user interface on a PC or phone? I don't know, I've never done either.
__________________
Contribute to OpenSource Alternator regulator for LiFePO4 XEngineering . net
markxengineerin is offline   Reply With Quote
Old 19-03-2024, 06:29   #100
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,059
Re: Open Source Arduino Alternator Regulator

You don’t have to program these anymore, you just ask ChatGPT to do it for you

Quote:
Programming an Arduino as an alternator regulator involves several steps and considerations. Here's a basic outline of how you might approach it:

1. **Understand the System**: Familiarize yourself with the alternator and its regulation requirements. This involves knowing the voltage range, current output, and any specific regulations required for your application.

2. **Select Components**: Choose the appropriate components for your project, including an Arduino board, voltage regulator (if needed), sensors (such as voltage and current sensors), and any additional components required for your specific setup.

3. **Design the Circuit**: Create a circuit diagram that includes the Arduino, sensors, and any other components. Ensure that the circuit is designed to measure the necessary parameters accurately and control the alternator's output voltage effectively.

4. **Write the Arduino Code**: Develop the Arduino code to read sensor data, calculate the required adjustments to the alternator output, and control the regulation process. This may involve PID control algorithms or simpler proportional control, depending on the complexity of your system.

5. **Test and Debug**: Test the circuit and code in a controlled environment to ensure that it functions as expected. Use a bench power supply or similar setup to simulate the alternator's behavior and verify that the regulation process works correctly.

6. **Implement Safety Measures**: Incorporate safety features into your design to protect the alternator, Arduino, and other components from damage due to overvoltage, overcurrent, or other potential issues.

7. **Optimize and Refine**: Fine-tune your code and circuit design based on test results and real-world performance. Make any necessary adjustments to improve efficiency, stability, or reliability.

8. **Documentation**: Document your project thoroughly, including the circuit diagram, code, testing procedures, and any other relevant information. This will be helpful for future reference and troubleshooting.

Keep in mind that regulating an alternator involves dealing with potentially high voltages and currents, so it's essential to approach the project with caution and prioritize safety at all times. If you're not experienced with electronics or Arduino programming, consider seeking assistance from someone with more expertise in this area.
__________________
“It’s a trap!” - Admiral Ackbar.

s/v Jedi is online now   Reply With Quote
Old 19-03-2024, 06:31   #101
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,059
Re: Open Source Arduino Alternator Regulator

Code:
// Define pins for voltage sensor, current sensor, and alternator output control
const int voltageSensorPin = A0;
const int currentSensorPin = A1;
const int alternatorControlPin = 9;

// Define target voltage and current limits
const float targetVoltage = 13.5; // Desired output voltage
const float maxCurrent = 30.0;    // Maximum allowed current

void setup() {
  // Initialize serial communication
  Serial.begin(9600);
  
  // Set alternator control pin as output
  pinMode(alternatorControlPin, OUTPUT);
}

void loop() {
  // Read voltage and current sensor values
  float voltage = readVoltage();
  float current = readCurrent();
  
  // Calculate error
  float error = targetVoltage - voltage;
  
  // Calculate duty cycle based on error (proportional control)
  float dutyCycle = constrain(error * 5.0, 0.0, 255.0); // Proportional gain = 5.0
  
  // Apply duty cycle to alternator control pin
  analogWrite(alternatorControlPin, dutyCycle);
  
  // Print debug information
  Serial.print("Voltage: ");
  Serial.print(voltage);
  Serial.print("V, Current: ");
  Serial.print(current);
  Serial.println("A");
  
  // Add a delay to prevent rapid adjustments
  delay(1000);
}

// Function to read voltage from sensor
float readVoltage() {
  int sensorValue = analogRead(voltageSensorPin);
  return sensorValue * (5.0 / 1023.0) * 3.0; // Convert sensor value to voltage (adjust multiplier as needed)
}

// Function to read current from sensor
float readCurrent() {
  int sensorValue = analogRead(currentSensorPin);
  float voltage = sensorValue * (5.0 / 1023.0); // Convert sensor value to voltage
  return voltage / 0.185; // Convert voltage to current using known sensor characteristics (adjust divisor as needed)
}
__________________
“It’s a trap!” - Admiral Ackbar.

s/v Jedi is online now   Reply With Quote
Old 19-03-2024, 06:41   #102
Registered User
 
OS2Dude's Avatar

Join Date: Nov 2014
Location: Atlanta, GA
Boat: Catalina 30
Posts: 667
Images: 5
Re: Open Source Arduino Alternator Regulator

Quote:
Originally Posted by markxengineerin View Post
The configuration file sounds good, although maybe not that different in difficulty to implement vs. creating a simple user interface on a PC or phone?
A config file is easy, and you (the programmer) implement it. You specify a format for the text file. The program reads in the file and uses the values there to set the variables. If file is missing or values invalid, use default values.

I don't know how you would edit a file on the arduino from a cell phone. Maybe send it via BT to the phone, edit it, then send it back via BT. I have not ever played with BT either.

I'll DL the IDE and see how it is. If not to different from what I'm used to, I may be able to help with some of your coding.
OS2Dude is offline   Reply With Quote
Old 19-03-2024, 07:11   #103
Registered User

Join Date: Jan 2020
Location: Grand Lake Oklahoma
Boat: Hunter 34
Posts: 59
Re: Open Source Arduino Alternator Regulator

Look into using ElegantOTA for WiFi over the air updates to the arduino. Config files can be loaded to the Arduino that way I believe. At least thats what I do for ESP32's. This whole platform would be better on an ESP32 or ESP8266 with a wifi/BLE hat. I will say that ESP32 wifi can be finicky in my experience until you disable sleep mode for the wifi which increases power consumption. Probably only marginal unless you are trying to operate this only via batter power.
Artey is offline   Reply With Quote
Old 19-03-2024, 07:23   #104
Registered User

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

The microprocessor is an ESP32, I just use the term "Arduino" out of habit. https://www.amazon.com/-/es/WEMOS-ES.../dp/B07P1L7839

As for ChatGTP, I'm not impressed with it's ability in electronics so far. It has given me very errant information that's easy to find (correctly) on datasheets, and the code it generates is not better or easier to work with than googling for examples/searching GitHub.
__________________
Contribute to OpenSource Alternator regulator for LiFePO4 XEngineering . net
markxengineerin is offline   Reply With Quote
Old 19-03-2024, 08:04   #105
Registered User
 
Jon Hacking's Avatar

Join Date: Sep 2010
Location: Currently cruising the Philippines, just got back from PNG & Solomons
Boat: Wauquiez 45' (now 48') catamaran
Posts: 1,094
Images: 1
Send a message via Skype™ to Jon Hacking
Re: Open Source Arduino Alternator Regulator

Catamarans usually have multiple engines, & some engines have multiple alternators (we happen to have both, so 4 alternators).

It would be nice if multiple controllers could talk to each other, so they make the same decisions at the same time, & not be fighting each other. Protocol doesn't really matter, I suppose. Al's earlier design used CAN over CAT-5 to do this, with a pair of standard RJ45 connectors on each board, to make things cheap & easy. But he had to make up new CAN sentences to accomplish this.
__________________
-- Jon Hacking s/v Ocelot
Jon Hacking 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 10:31.


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.