Author Topic: Need help with a schematic  (Read 4250 times)

0 Members and 1 Guest are viewing this topic.

Offline gkraniskeTopic starter

  • Contributor
  • Posts: 32
  • Country: us
Need help with a schematic
« on: April 16, 2025, 05:45:01 pm »
Hello All  :)

This is my first post so please be gentle.  For about a year I have been working on a garage door opener that works via bluetooth.  It actually works well but I found that it gets pretty toasty inside the box, so I added a small fan.  7 volts seems to run it well. However, when I integrated it into my design, it didn't turn on at all.  I checked the fan by applying 7 volts to it and it works fine.  There's the overview.

Now a little bit more in depth.  This garage door opener (GDO) has a MASTER unit, as well as a SLAVE unit.  Both are controlled by separate Arduino Uno's.  Here's my code;

Code: [Select]
#include <TimerOne.h>
#include <SoftwareSerial.h>

#define pirPin 3
#define redLed 6
#define greenLed 9
#define blueLed 10
#define GarSwitch 4
#define GarRelay1 5
#define GarRelay2 11
#define Fan 12
#define ldrPin A0
#define tempPin A1

int garageState = 0;
int lastGarageState = 0;
int pirVal;
int LDRValue = 0;

char ch;
String HC05_Awake = "ON";

SoftwareSerial mySerial(7, 8);  // Rx | Tx

void setup() {

  Timer1.initialize(40000000);
  Timer1.attachInterrupt(KeepAlive);
  Serial.begin(115200);
  mySerial.begin(38400);
  mySerial.print('a');

  pinMode(GarSwitch, INPUT_PULLUP);
  lastGarageState = digitalRead(GarSwitch);

  pinMode(GarRelay1, OUTPUT);
  pinMode(GarRelay2, OUTPUT);
  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(blueLed, OUTPUT);
  pinMode(Fan, OUTPUT);
  pinMode(ldrPin, INPUT);
  pinMode(pirPin, INPUT);
  pinMode(tempPin, INPUT);
  digitalWrite(redLed, LOW);
  digitalWrite(greenLed, LOW);
  digitalWrite(blueLed, LOW);
  digitalWrite(GarRelay1, HIGH);
  digitalWrite(GarRelay2, HIGH);
  digitalWrite(greenLed, HIGH);
  digitalWrite(Fan, HIGH);
}

int counter;

void loop() {

  // Sending
  // read input once
 
  garageState = digitalRead(GarSwitch);  // LOW = pressed
  if (garageState != lastGarageState) {
    mySerial.print('a');
    if (garageState == LOW) {  // switch got pressed

      Serial.print(counter);
      counter++;
      Serial.println(" Print an 'a'");

      mySerial.print('a');

      digitalWrite(blueLed, LOW);
      digitalWrite(redLed, LOW);
      digitalWrite(greenLed, HIGH);
     } else {  // switch got released

      Serial.print(counter);
      counter++;
      Serial.println(" Print a 'c'");

      mySerial.print('c');

      digitalWrite(blueLed, LOW);
      digitalWrite(greenLed, LOW);
      digitalWrite(redLed, HIGH);
    }
  }
MotionDetection();
// LDR();

// Receiving
  if (mySerial.available()) {
    char ch = mySerial.read();
    Serial.write(ch);

    if (ch == 'b') {
      Serial.print(counter);
      counter++;
      Serial.println(" Print a 'b'");
      mySerial.print('b');
      digitalWrite(GarRelay1, LOW);
      digitalWrite(blueLed, HIGH);
      digitalWrite(redLed, LOW);
      digitalWrite(greenLed, LOW);
      delay(1000);
      } else if (ch == 'd') {
        Serial.print(counter);
        counter++;
        Serial.println(" Print a 'd'");
        mySerial.print('d');
        digitalWrite(blueLed, LOW);
        digitalWrite(redLed, HIGH);
        digitalWrite(greenLed, LOW);
        digitalWrite(GarRelay1, HIGH);
      }
    }
    lastGarageState = garageState;
    delay(20);  // poor man's debouncing
  }


void KeepAlive() {
  if (HC05_Awake = "ON") {
    mySerial.print('m');
    Serial.print('m');
  }
}

// void LDR() {
// LDRValue = analogRead(ldrPin);
// Serial.print("Light Value - ");
// Serial.println(LDRValue);
// // delay(1000;) 
// }

void MotionDetection() {
  pirVal = digitalRead(pirPin);
  if (pirVal == LOW) {
    //Serial.println("No Motion");
    digitalWrite(GarRelay1, LOW);
    digitalWrite(GarRelay2, LOW);
 } else {
    digitalWrite(GarRelay1, HIGH);
    digitalWrite(GarRelay2, HIGH);
    //Serial.println("MOTION!!");
 
 }
    //delay(1000);   
}

So as you can see, the fan will go HIGH upon start up, which I plan to change once I get this issue resolved.  Also, I've attached a screenshot of my schematic (please don't beat me up too much as I have ZERO experience in this realm - but I am learning.).  I circled the area in question.  Another thing that happened is the other relays stopped working as well.  Please fire away with questions, as I'm sure I didn't cover everything that I'm supposed to.  Thanks in advance for your help.

 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 5125
  • Country: nl
Re: Need help with a schematic
« Reply #1 on: April 16, 2025, 06:26:55 pm »
You need a resistor in the base line of the transistor. You will probably blow up Q4 as soon as you set the output D12 of the Arduino nano high.

Since it is a BJT and not a FET, you need to limit the current flowing through the base of the transistor. It depends on the current the relay needs to turn on, how large the resistor has to be.  The gain depends on the collector emitter voltage and current, but using a value of 40 will probably be ok. So if the relay needs 50mA the base emitter current needs to be 1.25mA. The resistor then needs to be (5V - 0.7V) / 0.00125A = 3440 ohm. This is not a common value so 3300 ohm is the nearest one to choose.

About your schematic, at least you used wires, but there is a lot of room for improvement. Make sure that texts are not on top of parts or power supply symbols. For instance the 5V supply symbol near the relay is very hard to see that it is 5V. Also try to work from left to right regarding to signal flow. So move your 5V power jack to the top left side of the schematic and work form there with the outputs of the system on the right side of the schematic.

The other transistors in your schematic have the same issue.

Another issue might be that the MT3608 step up module is not capable of supporting the extra load of the fan.

Offline gkraniskeTopic starter

  • Contributor
  • Posts: 32
  • Country: us
Re: Need help with a schematic
« Reply #2 on: April 16, 2025, 06:39:37 pm »
Thanks very much for your help.  So it looks like I have some work to do.  Is there anything you would recommend instead of the MT3608?  I mean it's a really small fan.
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 5125
  • Country: nl
Re: Need help with a schematic
« Reply #3 on: April 16, 2025, 06:51:17 pm »
If you have a DMM you can check if the voltage remains on a stable 7 volt with the system running and the fan directly connected to the output of the MT3608 module. If not, you need something beefier, like this one https://www.aliexpress.com/item/1005007894995437.html for instance. It can deliver twice the current of the MT3608.

7 volt is the lower limit for the Arduino nano by the way, and if it drops due to load it might cause a reset on the Arduino nano.

Offline gkraniskeTopic starter

  • Contributor
  • Posts: 32
  • Country: us
Re: Need help with a schematic
« Reply #4 on: April 16, 2025, 07:40:04 pm »
Perfect.  I just bought 10 of them off Amazon, thank you so much.  I use a company called JLCPCB where I order my PCB's from.  The part is cheap enough but shipping is $40 bucks or so.  Would you have any other places you use that might be cheaper?
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 5125
  • Country: nl
Re: Need help with a schematic
« Reply #5 on: April 17, 2025, 05:43:50 am »
I use JLCPCB too. For me the shipping is way less, when I choose a week or two wait for the delivery.

I have been thinking about your setup, and with the transistors connected this way, the MCU on the Arduino nano has to deliver to much current and will heat up due to this. With the resistors in the base connection this current will drop drastically and things may not heat up as much any more and the fan won't be needed then.

Since you are using al sorts of modules, I wonder why you not chose relay modules like these: https://www.aliexpress.com/item/1005007003070916.html They can be controlled with the Arduino nano directly without the need for additional components.

Offline phil from seattle

  • Super Contributor
  • ***
  • Posts: 1149
  • Country: us
Re: Need help with a schematic
« Reply #6 on: April 17, 2025, 05:58:21 am »
Along with the transistor issue, the relays appear to be a problem.  Using the LCSC number from your schematic, it appears that it is a 3V relay.  The datasheet doesn't have 3V relays but the 5V relay pulls 72 mA, presuming that the 3V coil uses the same amount of power, that puts the 3V coil current at around 120 mA.  But, you are running them at 5V which will pull 1.67X current, around 200 mA. That's going yank the 5V power rail pretty hard. Could be resetting your Nano.

Also, I don't understand your power set up.  You have 5V DC input into a Boost module into a Buck module. You should be able to power the TP4056 directly from the 5V input. Seems like that could be cleaned up a bit. I think you could probably get rid of the buck and boost modules.  That may be a big source of your heat, BTW.

Finally, it would probably help you a lot if you learned how to use labels for wires rather than running them all over the place.  Spaghetti is hard to follow.  Also, when you do use wires, try to keep them short.  For example, the flyback diode D6 should just be a simple connection between pins 1 and 4 on the relay. See how much easier to follow my schematic is. By using a label, I don't have to draw a long wire back to the microcontroller and the flyback diode is right where it needs to be.
« Last Edit: April 17, 2025, 06:05:13 am by phil from seattle »
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 5125
  • Country: nl
Re: Need help with a schematic
« Reply #7 on: April 17, 2025, 06:47:42 am »
Along with the transistor issue, the relays appear to be a problem.  Using the LCSC number from your schematic, it appears that it is a 3V relay.  The datasheet doesn't have 3V relays but the 5V relay pulls 72 mA, presuming that the 3V coil uses the same amount of power, that puts the 3V coil current at around 120 mA.  But, you are running them at 5V which will pull 1.67X current, around 200 mA. That's going yank the 5V power rail pretty hard. Could be resetting your Nano.

I did not check the datasheet of the relay, but indeed a good catch. The 5V output of the Arduino nano should not be used for powering the relays. It would be better to use a separate voltage regulator for them.

Also, I don't understand your power set up.  You have 5V DC input into a Boost module into a Buck module. You should be able to power the TP4056 directly from the 5V input. Seems like that could be cleaned up a bit. I think you could probably get rid of the buck and boost modules.  That may be a big source of your heat, BTW.

I have been wondering about that too. Only when the input voltage on the barrel jack can be higher than 5.2V, there would be a need for a buck converter on the input of the TP4056. The boost module is needed to power the Arduino nano from the battery. Instead of using it to boost to 7 volt it could be set to 5 volt and bypass the voltage regulator on the Arduino nano.

Finally, it would probably help you a lot if you learned how to use labels for wires rather than running them all over the place.  Spaghetti is hard to follow.  Also, when you do use wires, try to keep them short.  For example, the flyback diode D6 should just be a simple connection between pins 1 and 4 on the relay. See how much easier to follow my schematic is. By using a label, I don't have to draw a long wire back to the microcontroller and the flyback diode is right where it needs to be.

In this case the spaghetti is indeed hard to follow, but still preferable over labels. So I don't agree with that learning about how to use labels brings an improvement over wires. There are lots of debates about this here on the forum on to what is good practice in making schematics. Not using labels is being advised.

The placing of the components in relation to others to reduce the length of wires is certainly a good point. Like I wrote in my first post here, there is lots of room for improvement in the schematic.

Offline xvr

  • Frequent Contributor
  • **
  • Posts: 656
  • Country: ie
    • LinkedIn
Re: Need help with a schematic
« Reply #8 on: April 17, 2025, 02:06:24 pm »
Quote
The part is cheap enough but shipping is $40 bucks or so.
Try to select different shipping method. By default they offer most reliable, but quite extensive one.
 

Offline phil from seattle

  • Super Contributor
  • ***
  • Posts: 1149
  • Country: us
Re: Need help with a schematic
« Reply #9 on: April 17, 2025, 11:21:57 pm »

Finally, it would probably help you a lot if you learned how to use labels for wires rather than running them all over the place.  Spaghetti is hard to follow.  Also, when you do use wires, try to keep them short.  For example, the flyback diode D6 should just be a simple connection between pins 1 and 4 on the relay. See how much easier to follow my schematic is. By using a label, I don't have to draw a long wire back to the microcontroller and the flyback diode is right where it needs to be.

In this case the spaghetti is indeed hard to follow, but still preferable over labels. So I don't agree with that learning about how to use labels brings an improvement over wires. There are lots of debates about this here on the forum on to what is good practice in making schematics. Not using labels is being advised.

The placing of the components in relation to others to reduce the length of wires is certainly a good point. Like I wrote in my first post here, there is lots of room for improvement in the schematic.

I find labels much easier to follow.  For very simple schematics like the OPs, it is possible to make a somewhat clear drawing.  But when you get to 50 components or more, the mess becomes counterproductive.  I particularly like a subsystem approach where each subsystem can exist on a separate page with a relatively small number of labels for connections between subsystems. Look at most schematics for real products and labels get used a lot. This would be a nightmare without labels.


And, labels and wires are not mutually exclusive.  In fact, spaghetti can be greatly improved by placing labels on both ends of a long run.
« Last Edit: April 17, 2025, 11:25:02 pm by phil from seattle »
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 5125
  • Country: nl
Re: Need help with a schematic
« Reply #10 on: April 18, 2025, 06:22:21 am »
There are several threads on this forum about this:

https://www.eevblog.com/forum/projects/schematic-drafting-standards/
https://www.eevblog.com/forum/projects/schematic-drawing-best-practice/
https://www.eevblog.com/forum/projects/the-best-schematic-layout-standards/
https://www.eevblog.com/forum/chat/please-rate-my-designschematic-ltrantgt/

The last one provided is especially about labels versus wires.

My opinion on it is to find a balance between the two. Your example is not convincing that it is the better practice. Looking for the matching labels is a drag. Sure on the computer one can use a find tool, but on paper it is easy to miss a label when there are multiple inputs connected to a single output.

This is of topic though, so lets leave it at this.

@gkraniske, to control your fan, if it is still needed after making the improvements to reduce currents, you can simply use a N-channel MOSFET like a 2N7000 or an IRFZ44N depending on the current needs. See https://www.electronics-tutorials.ws/transistor/tran_7.html for more information on this.

Offline phil from seattle

  • Super Contributor
  • ***
  • Posts: 1149
  • Country: us
Re: Need help with a schematic
« Reply #11 on: April 18, 2025, 07:17:33 am »
There are several threads on this forum about this:

https://www.eevblog.com/forum/projects/schematic-drafting-standards/
https://www.eevblog.com/forum/projects/schematic-drawing-best-practice/
https://www.eevblog.com/forum/projects/the-best-schematic-layout-standards/
https://www.eevblog.com/forum/chat/please-rate-my-designschematic-ltrantgt/

The last one provided is especially about labels versus wires.

My opinion on it is to find a balance between the two. Your example is not convincing that it is the better practice. Looking for the matching labels is a drag. Sure on the computer one can use a find tool, but on paper it is easy to miss a label when there are multiple inputs connected to a single output.

This is of topic though, so lets leave it at this.

@gkraniske, to control your fan, if it is still needed after making the improvements to reduce currents, you can simply use a N-channel MOSFET like a 2N7000 or an IRFZ44N depending on the current needs. See https://www.electronics-tutorials.ws/transistor/tran_7.html for more information on this.

I would never do a paper schematic anymore. You are right about balance, though.
 

Offline gkraniskeTopic starter

  • Contributor
  • Posts: 32
  • Country: us
Re: Need help with a schematic
« Reply #12 on: April 18, 2025, 06:26:28 pm »
Wow this is a lot to digest.  Like I said, I have no education in electronics, other than what I've learned on youtube and by asking questions.  But thanks to everyone who responded, this gives me some direction on how to make my project better.  Yes, my next question was going to be about power.  I'm powering the unit with a 12v wall wart.  Mainly because it's what I have available, and I thought I might need extra voltage.  I'm also adding super bright LED garage lights that will be wired into the mains power.  The relay is simply going to trip for a predetermined time frame when my wife pulld into the garage, hence the motion sensor.  Would be nice to eliminate the converters so I'll have to study that a bit.  Once it's all said and done, I'm going to 3D print a custom box to put everything in.  If no one minds, I will probably pop back in here from time to time to ask more questions.  I'm not really sure I can salvage the project the way it is, so I may just have to start from scratch, using the methods described here.  I'm going to refer to the posts on this thread to get started.  Thanks again for everyone's help and Happy Easter!

One more thing, do I need to add a resistor to all of the base legs on each transistor?
« Last Edit: April 18, 2025, 06:29:32 pm by gkraniske »
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 5125
  • Country: nl
Re: Need help with a schematic
« Reply #13 on: April 18, 2025, 07:48:24 pm »
Sure no problem in asking questions. That is what the forum is there for.

Having a 12V supply changes things. For the charging of the battery, so the supply into the TP4056, has to be at max 5.2V. Using a buck converter is a good way to reduce the 12V without wasting to much energy.

That said, the question is what you are using the battery for. Based on it being a garage door opener, it would only be beneficial to have the battery, if the garage door also has a battery backup to open or close it while the main power is out.

A better option might be to go for 3 li-ion (18650 cells) in series and that way raise the battery voltage to 12.6V max. With a proper BMS you can skip the input buck converter and directly supply the output voltage of your wall wart to the BMS.  (For instance something like  this one https://nl.aliexpress.com/item/1005007010318534.html) From the battery you go to two buck converters. Set one to 7.5V and connect it to the Arduino Nano, and set the other to 5V to power the relays. I'm not sure if this BMS provides the needed constant current / constant voltage charging li-ion needs, so if you go for this option best to do a bit more research.

Another thing that might be interesting for you is that there are also solid state modules, that don't have mechanical relays and contacts that wear out. Something like these: https://www.aliexpress.com/item/1005002992698463.html They work from 100 - 240V.

About the transistor and the base resistor. Yes all your bipolar junction transistors need a base resistor to limit the current through the base emitter junction. The base emitter junction acts like a diode and has a more or less fixed voltage drop across it. Depends on the type of transistor, but for silicon it is ~0.7V. When you connect an output of a microcontroller (The ATmega328 on your Arduino Nano) to the base of such a transistor without a resistor, the current will only be limited by the output impedance, which might be very low. This current can kill both the output pin and the transistor over time. It probably is also the reason things get hot.

This site: https://www.tutorialspoint.com/basic_electronics/basic_electronics_transistors.htm gives an insight in the working of a transistor if you are interested.

Offline phil from seattle

  • Super Contributor
  • ***
  • Posts: 1149
  • Country: us
Re: Need help with a schematic
« Reply #14 on: April 18, 2025, 09:34:14 pm »
We'll try to be gentle.  Sometimes some of us aren't though. I find a thick skin helps when learning from a group of experts.

The input on your schematic said 5V so I naturally assumed... This does make an important point about getting the information on your schematic to reflect reality.  I noticed you have a CR2032 connected to the charger - pretty sure that is also wrong.

I would switch to 12V relays then. Power them from the input. They draw a lot less current.  Using a buck converter (or a linear regulator) to get to 5V for the battery charger and power the Nano would be simple.  Having 7 V overhead on the buck will make the rail disruption from the relays a non-issue.  It might be possible to run the Nano at the lipo voltage by the way. I agree with pcprogrammer questioning about needing the battery since you will be plugged all the time.
 

Offline gkraniskeTopic starter

  • Contributor
  • Posts: 32
  • Country: us
Re: Need help with a schematic
« Reply #15 on: April 18, 2025, 09:44:12 pm »
Where I live (out in the country) I lose power frequently during storms.  The battery is exactly for that - a back up until the generator kicks on.  I'm going to be away from the computer for a bit but when I return I plan to get to work.
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 5125
  • Country: nl
Re: Need help with a schematic
« Reply #16 on: April 19, 2025, 05:56:58 am »
The input on your schematic said 5V so I naturally assumed... This does make an important point about getting the information on your schematic to reflect reality.  I noticed you have a CR2032 connected to the charger - pretty sure that is also wrong.

I missed the CR2032 type on the battery.  :palm:

There are rechargeable CR2032 batteries, but you are right that the TP4056 is not the right charge controller for that. Also such small batteries won't be able to keep the system up and running for the time it takes the generator to start up. With a simple system like this it is also probably not needed at all. The Arduino Nano will just cycle through a reset phase and be up and running within a second.

I would switch to 12V relays then. Power them from the input. They draw a lot less current.  Using a buck converter (or a linear regulator) to get to 5V for the battery charger and power the Nano would be simple.  Having 7 V overhead on the buck will make the rail disruption from the relays a non-issue.  It might be possible to run the Nano at the lipo voltage by the way. I agree with pcprogrammer questioning about needing the battery since you will be plugged all the time.

I was thinking more on reusing parts of the existing system, but here you are also right. The less supply voltage conversions, the less energy is wasted. A 12V relay will also work on a slightly depleted 3 cell 18650 battery pack.

The max input voltage for the Arduino Nano is 6-20V according to some sources. Others state 7-12V. It depends on the regulator used on the board. With the cheap clones it can vary. A voltage drop of 7.6V on the regulator will lead to approximate 0.17W dissipation. The Nano specs state a power consumption of 19mA, but I used 23mA to account for some extra draw on the pins.

To play it on safe I would still use a buck converter to drop the 12V to 7V though. Will reduce the waste of power.

Offline gkraniskeTopic starter

  • Contributor
  • Posts: 32
  • Country: us
Re: Need help with a schematic
« Reply #17 on: April 23, 2025, 03:57:59 pm »
Hello all,

I'm back at it again lol.  Hope everyone had a great Easter!  So I don't know if this helps you (help me lol) or not, but I made several changes to my schematic that were recommended, and saved the w2hole project to a zip file.  I downloaded it from EasyEDA.  Several mentioned my spaghetti so I don't know if this will help.  I want to order the PCB again, but shipping is sooo expensive, I'm trying to get it right.  Thanks again for everyone's help.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3506
  • Country: us
Re: Need help with a schematic
« Reply #18 on: April 23, 2025, 04:10:51 pm »
Have you considered first building your circuit on a protoboard?

Here is an example of including modules with discrete components:

https://www.dropcontroller.com/dropcontroller-diy-protoboard/
 

Offline gkraniskeTopic starter

  • Contributor
  • Posts: 32
  • Country: us
Re: Need help with a schematic
« Reply #19 on: April 23, 2025, 04:58:25 pm »
Yeah I did that once, it was a disaster.  I can solder small components with the best, but that kind of soldering I'm not good at lol.
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 5125
  • Country: nl
Re: Need help with a schematic
« Reply #20 on: April 23, 2025, 05:07:10 pm »
I looked at your new schematic, and it did not improve at all. Just moving the input power connector to the top left did not make it more readable, and was only just part of the advise given on how to improve the schematic.

You did not change the battery backup setup, even though you were told that the CR2032 batteries are not suited for your setup.

So read the thread again and try to incorporate the advise given or ask more questions on what you don't grasp from the advise given.

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5193
  • Country: ro
  • .
Re: Need help with a schematic
« Reply #21 on: April 23, 2025, 05:12:31 pm »
If you want to stick with relays, you could use dual coil latching relays, they're a bit more expensive but once you set them, they remain set without consuming power.

An example :  https://www.lcsc.com/product-detail/Magnetic-Latching-Relays_HF-Xiamen-Hongfa-Electroacoustic-HF115F-LS-12-HSL2F_C190453.html

You have 3 input pins  1 ---- 2 ---- 3   ... you put your voltage (12v for this relay) on pin 2,  and if you want to turn on the relay you connect 3 to ground for at least 30 ms , and if you want to reset it you disconnect 3 and connect 1 to ground at least 30 ms.

So you could have a small step-up converter boost your battery voltage to 12v and supply just enough current to power each relay for let's say 50-100ms at a time ... the datasheet for the above says 0.6w power consumption, so you'd need a minimum of 0.6w / 12v = 0.05A (50mA)

if you want you could store the state of each relay in a fram memory chip or maybe an eeprom (but an eeprom has fewer write cycles) in order to remember how the relays are configured if there's a power loss (battery too low for example) but I think it would be too much of a bother. You could just  periodically check the battery voltage and when it goes below 3.5v you could just reset the relays one at a time and stop working until the battery is charged again.  Also, at each startup, you can reset each relay one at a time to make sure each relay is in a known state.


Because the coil current is lower than 100mA, you could use a mosfet array like let's say ULN2003V12 (just like ULN2003A but without the big 1v drop on each channel) which contains 7 mosfets and all the resistors and ESD protections and even the diodes you'd normally use on each relay coil (1n4007 in your schematic). I would still have those 1n4007 diodes external though, they're cheap.

ULN2003V12 : https://www.lcsc.com/product-detail/Darlington-Transistor-Arrays_Diodes-Incorporated-ULN2003V12S16-13_C148113.html?s_z=n_uln2003v12

It says darlington array, but it's really mosfet array with 7 channels. You could use only 6, to control 3 relays  (2 channels per relay, one to turn on , one to turn off)

So with these changes you'll only need to have a step-down regulator to reduce the voltage from one battery (for example a 18650 lithium cell) to 3.3v you need for your arduino, and the step-up regulator will just idle until it needs to power a relay coil for 30+ ms at a time.

use something better than lm2596 for step-down regulators .... see for example AP61100, very simple to use (though it's a bit small) : https://www.lcsc.com/product-detail/DC-DC-Converters_Diodes-Incorporated-AP61100Z6-7_C1858397.html?s_z=n_ap61100

But it's almost not worth it, considering your arduino is gonna consume only a few mA... so you could use a cheap LDO like for example XC6206-33 (fixed 3.3v version) : https://www.lcsc.com/product-detail/Voltage-Regulators-Linear-Low-Drop-Out-LDO-Regulators_MSKSEMI-XC6206P332MR-MS_C5252899.html or  HT7533: https://www.lcsc.com/search?q=ht7533

These regulators have a dropout voltage of around 0.2v at 100mA, so will work pretty much down to less than 3.3v input (your arduino will function with less than 3.3v)


« Last Edit: April 23, 2025, 05:15:55 pm by mariush »
 

Offline gkraniskeTopic starter

  • Contributor
  • Posts: 32
  • Country: us
Re: Need help with a schematic
« Reply #22 on: April 25, 2025, 02:51:58 pm »
Yes, sorry I didn't see this post.  I moved the power units to the left of the schematic, but when I started moving other objects, connections were made and broken, rendering the unit useless.  So it's not that I'm not going to follow your directions, I actually am, but apparently it's going to take a bit more work to move it around the way it should be.

As far as the battery is concerned, I'm trying to figure out a way to put 4 AA sized batteries in the box that I'm working with.  The 3D printed box is just large enough to hold the components I need.  By adding batteries, that means the box has to be printed deeper than the one I have now, which eliminates the place where I was going to mount it to keep it out of the way.  If you can point me to a battery about the size of a CR2032?  I would gladly make the change.

Like I said in my original post, I'm extremely brand new to electronics so my education is limited.  But I've already learned a lot just from this post, so thank you very much.
 

Offline gkraniskeTopic starter

  • Contributor
  • Posts: 32
  • Country: us
Re: Need help with a schematic
« Reply #23 on: April 25, 2025, 03:21:04 pm »
I'm looking into the three li-ion rechargeable batteries.  From the way you're describing it, I should eliminate the TP4056 module, and replace it with the 3S BMS 18650 Lithium Battery Protection Board?  Seems easy enough.  So by the batteries, and the 12v wall wart input being added to the schematic, does that mean I'm eliminating the step-up converters?
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 5125
  • Country: nl
Re: Need help with a schematic
« Reply #24 on: April 25, 2025, 05:57:50 pm »
I'm looking into the three li-ion rechargeable batteries.  From the way you're describing it, I should eliminate the TP4056 module, and replace it with the 3S BMS 18650 Lithium Battery Protection Board?  Seems easy enough.  So by the batteries, and the 12v wall wart input being added to the schematic, does that mean I'm eliminating the step-up converters?

Yes with 3 18650 Batteries in series you get a maximum of 12.6V and a nominal voltage of 11.4V to work with. This does mean that the step up converters are no longer needed.

But let me check if the BMS I referred to is actually suitable for the job in question.

Depending on how much current the relays are going to take the 5V could be derived from the Arduino Nano, or you can also change the relays to 12V versions so that they can be powered directly from the battery.

Edit: I'm a bit out of my depth here. The BMS I referred to is good for protecting the cells against over charging and over draining when the load and charge voltage is connected to the + and - terminals. But I believe there is still the need for a proper charge circuit to provide the cc/cv charging a lithium ion battery needs. If this is then also capable of supplying the Arduino Nano and the relays, I'm not sure of.

Hopefully someone with more knowledge of battery circuits will chime in.
« Last Edit: April 25, 2025, 06:50:48 pm by pcprogrammer »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf