Need help with a schematic - Page 1
Forum section: electronics / general

author: gkraniske
author_rank: Contributor
timestamp: April 16, 2025, 05:45:01 pm
content: Hello AllThis 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:#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 A1int garageState = 0;int lastGarageState = 0;int pirVal;int LDRValue = 0;char ch;String HC05_Awake = "ON";SoftwareSerial mySerial(7, 8); // Rx | Txvoid 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 oncegarageState = digitalRead(GarSwitch); // LOW = pressedif (garageState != lastGarageState) {mySerial.print('a');if (garageState == LOW) { // switch got pressedSerial.print(counter);counter++;Serial.println(" Print an 'a'");mySerial.print('a');digitalWrite(blueLed, LOW);digitalWrite(redLed, LOW);digitalWrite(greenLed, HIGH);} else { // switch got releasedSerial.print(counter);counter++;Serial.println(" Print a 'c'");mySerial.print('c');digitalWrite(blueLed, LOW);digitalWrite(greenLed, LOW);digitalWrite(redLed, HIGH);}}MotionDetection();// LDR();// Receivingif (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.

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 16, 2025, 06:26:55 pm
content: 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.

author: gkraniske
author_rank: Contributor
timestamp: April 16, 2025, 06:39:37 pm
content: 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.

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 16, 2025, 06:51:17 pm
content: 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 onehttps://www.aliexpress.com/item/1005007894995437.htmlfor 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.

author: gkraniske
author_rank: Contributor
timestamp: April 16, 2025, 07:40:04 pm
content: 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?

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 17, 2025, 05:43:50 am
content: 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.htmlThey can be controlled with the Arduino nano directly without the need for additional components.

author: phil from seattle
author_rank: Super Contributor
timestamp: April 17, 2025, 05:58:21 am
content: 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.

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 17, 2025, 06:47:42 am
content: Quote from: phil from seattle on April 17, 2025, 05:58:21 amI 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.Quote from: phil from seattle on April 17, 2025, 05:58:21 amI 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.Quote from: phil from seattle on April 17, 2025, 05:58:21 amIn 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.

author: xvr
author_rank: Frequent Contributor
timestamp: April 17, 2025, 02:06:24 pm
content: QuoteTry to select different shipping method. By default they offer most reliable, but quite extensive one.

author: phil from seattle
author_rank: Super Contributor
timestamp: April 17, 2025, 11:21:57 pm
content: Quote from: pcprogrammer on April 17, 2025, 06:47:42 amI 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.

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 18, 2025, 06:22:21 am
content: 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. Seehttps://www.electronics-tutorials.ws/transistor/tran_7.htmlfor more information on this.

author: phil from seattle
author_rank: Super Contributor
timestamp: April 18, 2025, 07:17:33 am
content: Quote from: pcprogrammer on April 18, 2025, 06:22:21 amI would never do a paper schematic anymore. You are right about balance, though.

author: gkraniske
author_rank: Contributor
timestamp: April 18, 2025, 06:26:28 pm
content: 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?

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 18, 2025, 07:48:24 pm
content: 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 onehttps://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.htmlThey 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.htmgives an insight in the working of a transistor if you are interested.

author: phil from seattle
author_rank: Super Contributor
timestamp: April 18, 2025, 09:34:14 pm
content: 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.

author: gkraniske
author_rank: Contributor
timestamp: April 18, 2025, 09:44:12 pm
content: 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.

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 19, 2025, 05:56:58 am
content: Quote from: phil from seattle on April 18, 2025, 09:34:14 pmI missed the CR2032 type on the battery.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.Quote from: phil from seattle on April 18, 2025, 09:34:14 pmI 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.

author: gkraniske
author_rank: Contributor
timestamp: April 23, 2025, 03:57:59 pm
content: 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.

author: ledtester
author_rank: Super Contributor
timestamp: April 23, 2025, 04:10:51 pm
content: 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/

author: gkraniske
author_rank: Contributor
timestamp: April 23, 2025, 04:58:25 pm
content: 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.

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 23, 2025, 05:07:10 pm
content: 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.

author: mariush
author_rank: Super Contributor
timestamp: April 23, 2025, 05:12:31 pm
content: 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.htmlYou 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_uln2003v12It 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_ap61100But 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.htmlor HT7533:https://www.lcsc.com/search?q=ht7533These 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)

author: gkraniske
author_rank: Contributor
timestamp: April 25, 2025, 02:51:58 pm
content: 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.

author: gkraniske
author_rank: Contributor
timestamp: April 25, 2025, 03:21:04 pm
content: 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?

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 25, 2025, 05:57:50 pm
content: Quote from: gkraniske on April 25, 2025, 03:21:04 pmYes 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.

author: gkraniske
author_rank: Contributor
timestamp: April 25, 2025, 07:02:56 pm
content: Here's what I ordered:https://www.amazon.com/dp/B0CLY68D5L?ref=ppx_yo2ov_dt_b_fed_asin_title&th=1https://www.amazon.com/dp/B08M36F6XD?ref=ppx_yo2ov_dt_b_fed_asin_titleI sure hope it's correct lol

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 25, 2025, 07:11:49 pm
content: The BMS is correct for the protection of the batteries, but I fear that the batteries are a bit of a scam. 18650 Lithium Ion batteries are at best something like 4000mAh. So if you can still cancel that one, I would. Look for cheaper ones that are 2400mAh or 3200mAh.Even if your setup draws 0.5A it stays on for >4 hours without a power supply on the 2400mAh batteries.

author: gkraniske
author_rank: Contributor
timestamp: April 26, 2025, 10:20:00 pm
content: These say 9900mAh right on the battery. It's okay anyway, I just checked them right out of the box, the voltage reads 4.0, 4.1, and 4.9. I suppose this is to be expected until I can charge them. They won't be pulling that much current anyway, just until the generator kicks on. The only reason I need them is because I'm not good enough with my code (Arduino) to get the slave device to check the master for the condition of the reed switch (Garage Door open or closed). If these end up being a problem I can return them. By the way, do these get hot? After all, the master unit is getting mounted in the garage. I've attached the new schematic even though it's still a mess to read. I think you can import it into EasyEDA just to make life easier. Sorry so messy.

author: gkraniske
author_rank: Contributor
timestamp: April 26, 2025, 10:24:51 pm
content: I suppose it would help if I actually attached the schematic lol.

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 27, 2025, 05:24:54 am
content: Quote from: gkraniske on April 26, 2025, 10:20:00 pmA lithium ion battery should not have a higher reading than 4.2V. The nominal voltage is 3.7V. See the attached datasheet for more information on this.Lithium ion batteries can get hot when misused. To protect them a BMS comes into play. It will monitor separate cells and make sure they don't go above 4.2V or below ~2.7V. More advanced BMS can also monitor the temperature of the cells and cut the load when needed.You still need a dedicated charger for the batteries, because the BMS does not regulate this part of the process.Tomorrow, I will see if I have some time to look at your schematic.

author: gkraniske
author_rank: Contributor
timestamp: April 28, 2025, 03:48:25 am
content: Thanks!

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 28, 2025, 12:13:10 pm
content: Ok, I looked at your schematic and redrawn it. There are still some issues that need to be addressed though.The relays you used in the schematic are listed as 3V instead of 5V, so if these need to be used a separate 3V supply needs to be created. 12V relays would be better though.What is the voltage of the wall wart you are using. I know you wrote 12V, but it could be a non stabilized supply that has a higher output voltage when not loaded, or a switched power supply.Then there is the issue of the power switch. What does it need to control? Just the Arduino Nano system, or also the charging of the battery?I fixed your RGB led setup. The anode needs to be connected to a positive supply, and current limiting resistors need to be separate per LED due to different forward voltages. It might be needed to trim these resistors to get a uniform brightness of the LED's. To turn the LED's on the digital outputs on the Arduino have to be set low.I changed the ground symbol to be the more common one used in electronics. The one with the multiple lines is more used in electrical installations.Based on the input voltage it might be needed to reduce the input voltage to the Arduino Nano, so for that a buck converter can be used if needed.For the battery backup you did not put in a charging option, and connecting the output of a buck converter directly to the 12V input is not good practice. Diodes will be needed there.I did not directly found a module for charging as series string of three lithium ion batteries, but it is needed depending on some conditions. If the input voltage is 12V a current limiting resistor could be sufficient, as long as the current into the battery does not exceed the allowed charge current. Once the voltage of the battery matches the input voltage the charging will stop.But I'm no expert on lithium ion batteries and would like to hear from others if the above is true, or that it is better to look for a proper lithium ion charger board.The PCB, I did not look into, as it has to be redrawn any way.

author: WattsThat
author_rank: Frequent Contributor
timestamp: April 28, 2025, 12:51:08 pm
content: Why have Q3 at all? You can effect a reset without external hardware by executing the instructionasm volatile (" jmp 0");

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 28, 2025, 12:54:44 pm
content: Quote from: WattsThat on April 28, 2025, 12:51:08 pmTrue, but it was in the original schematic and I left it in without questioning.Noticed that I screwed up the component numbering of the transistors due to this one.

author: WattsThat
author_rank: Frequent Contributor
timestamp: April 28, 2025, 01:10:42 pm
content: Sorry for any confusion, it was a question for the OP, not you, whom I thank profusely for taking the time to redraw the schematic. I couldn’t follow the original so I hadn’t bothered to comment.One big issue I see are the relay drivers, no way a 2N2222 can drive ~120ma (assuming 3v relays) with less than 2 ma of base current as beta doesn’t matter when a transistor is saturated. A rule of thumb is use a gain of 10 if the datasheet doesn’t provide info for switching use. Haven’t considered the power dissipation which should be checked as I suspect it’s too high for a to-92 device.IMO, forget the transistor, a proper logic level mosfet would do much better here.

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 28, 2025, 02:41:49 pm
content: Quote from: WattsThat on April 28, 2025, 01:10:42 pmAnd that is what the result of a more proper schematic brings. Sound questions on it.I have not looked at that bit either, and also doubt the use of those transistors. Seeing that everything else is done with modules, I would have done the same for the relays, as I wrote earlier.The LED thing being the wrong way round was a thing I discovered when doing the redraw. Part numbering and naming were mixed up, so basically a bad attempt at creating a schematic. Hopefully the OP learns a lot from this exercise, for when he plans to continue playing with electronics.

author: gkraniske
author_rank: Contributor
timestamp: April 28, 2025, 10:40:26 pm
content: Wow! Sure looks cleaner that the original. All of you ROCK!Thanks for taking the time to do that. The relays are 5VDC, not 3 VDC as the schematic shows. Sorry about that. My wife is already aggravated with me for spending so much money on all my projects, so I have to work with the parts I have. So I have some questions, if it's okay. Hopefully they haven't already been answered and I'm just not understanding, but here goes.1. How is the battery circuit integrated? I see that the output / input has the BAT symbol on it, but I'm not sure how that works.2. What size / type of mosfet, and do I need one for each relay (I assume I do)?3. My wall wart outputs 12.6 volts steadily when checked with a multimeter, so is it appropriate to go from the wall wart directly into the buck converter to level it out a bit more?4. I was under the impression that I could tie the output of the other buck converter in with the 12v input from the wall wart. If not, what's the best way to accomplish this?And to answer questions:Quote from: pcprogrammer on April 28, 2025, 12:13:10 pmI have an abundance of 5VDC relays, so if at all possible, I'd like to stick with these.Quote from: pcprogrammer on April 28, 2025, 12:13:10 pmSteady at 12.6v according to a multimeterQuote from: pcprogrammer on April 28, 2025, 12:13:10 pmThe power switch should turn everything other than the charging system on or off. If I plug the wall wart in, the batteries should charge. I purchased two boards to accomplish this, wasn't sure which one to use so I got them both.https://www.amazon.com/dp/B0C6DNMKS7?ref=ppx_yo2ov_dt_b_fed_asin_titlehttps://www.amazon.com/dp/B08M36F6XD?ref=ppx_yo2ov_dt_b_fed_asin_titleAnd the batteries I purchased are as follows.https://www.amazon.com/dp/B0CLY68D5L?ref=ppx_yo2ov_dt_b_fed_asin_title&th=1Quote from: pcprogrammer on April 28, 2025, 12:13:10 pmI thought the charging option would come from the 12v wall wart. What type of diodes should I use for this, and how should I make the connections? During storms my power almost always goes out. I have a 13Kw generator that kicks on automatically but there is lag time from mains to generator. A little background on why I made this unit. My garage is detached from the house and sits to the south of the main entrance way, which means that if I want to know if the garage door is open, I have to step outside and look. So I came up with a device that uses a reed switch to detect the door being open or closed. If the LED is red, the door is open, if green then it's closed. The problem is when the unit loses power, it switches to red even though the door may be closed. I have no way of knowing unless I either look outside at the door, or press the open / close button to trigger a change in the code. You all probably didn't really need to know all that, but I wanted to explain it so you understood what I was doing. Again, I just want to thank you all from the bottom of my heart for helping me, and yes, I'm learning a lot by your questions and examples. Enough to know that I completely botched the schematic.

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 29, 2025, 06:29:56 am
content: The cleaned up schematic is not yet finished, so the battery, the 12V input and the Vrelay for that matter, are not yet connected.In a schematic one can use power supply symbols to connect the power. This is done with the T shaped symbol with a name above it. The name determines which net it is, and all the supply symbols with the same name are tied together.For the mosfet it is needed to know the model and make of the used relays. There is the need to know the current that flows when the relay is activated.The wall wart outputting a steady 12.6V is closer to the battery pack max voltage, but with a diode in series it will drop enough to not fully charge the batteries, which is better for them.When there are multiple power sources you can't just connect them together without making sure it won't cause issues. In this case the highest voltage might win and start pushing current where it should not flow. Most buck converters don't like feedback through the output and can die due to this. So a diode in series mostly does the trick.But in your case there is no need for the second buck converter. If I feel up to it later today, I will update the schematic to reflect the needed changes. As I have a wife too, and we have a new piece of land that needs to be worked on, I'm a bit occupied with that.The boards you bought on Amazon are only for protecting the batteries, not for regulating the charge current/voltage. The 4S one is for a four in series battery pack and is not suited in this case. The 3S one is what you need.For connecting the battery and the input supply to the buck converter the 1N4007 diodes are fine.The issue with the door being open or closed depends a bit on where the reed switch is mounted if it can be used on power on to determine if the door is closed or not. Best position would be near the ground in such a way that when the door is closed the reed switch is activated.Feedback of this information to the remote control might also be possible, but it depends on what you are using for the transmission. Probably best to address later.Edit: I modified the schematic to show a possible supply setup. The charging of the batteries is not optimal, but I don't think it will be problematic. Worst case the batteries are drained to cutoff point of 2.7V per cell will lead to about 260mA through R4 and while charging the current will drop to zero when the batteries are charged to the same voltage as the supply. The BMS protects them from overcharging, but with a supply of 12.6V and the series diode this won't happen.The Arduino Nano is supplied via two diodes making the voltage below 12V, which also should be fine. The buck converter is used to make the 5V for the relays. It could also be used for the other 5V in the circuit, but it depends on the current being drawn by the extra modules connected to this 5V from the Arduino Nano.For the MOSFET's more input is needed to decide which ones could be used. So I left the transistors for now.

author: gkraniske
author_rank: Contributor
timestamp: April 30, 2025, 12:16:33 am
content: Hello again, and thanks so much for your help with my schematic. Here are the relay's I'm usinghttps://www.amazon.com/dp/B09J23B9WJ?ref_=ppx_hzsearch_conn_dt_b_fed_asin_title_2I'm terribly sorry to take you away from your family. I'll look at your design and most likely use it. Again, thank you. I'll let you know how it goes. Until later, my friend.

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 30, 2025, 05:56:07 am
content: Quote from: gkraniske on April 30, 2025, 12:16:33 amThat is my own choice, so no worries.The relays, according to the datasheet, have a nominal current of 71.4mA. The transistors can handle this and the 2k7 Ohm base resistor is fine for this. The only problem may be that the relay is getting a to low voltage due to Vce, but if it is higher than 0.3V you can lower the base resistor value to maybe 470 Ohm, but this increases the current drawn from the Arduino Nano.Another option is to switch to the 2N7000, which is a n-channel mosfet. With these there is almost no current drawn from the Arduino Nano. The gate resistor can be lowered to 47 Ohm.

author: gkraniske
author_rank: Contributor
timestamp: April 30, 2025, 12:15:25 pm
content: The only change I made was to add 7v to the top relay so the fan turns on when it's supposed to. Otherwise there is no power source for it. I also noticed that the NANO looks like the VIN pin is being supplied with 12v. Is that correct? I was just wondering if you meant to take the power from the input of the buck converter rather that the output.

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 30, 2025, 03:29:39 pm
content: The Arduino Nano can be supplied on Vin up to 12V. With the two diodes in series and an input voltage of 12.6V the voltage on Vin of the Arduino should be ~11.4V.I forgot about the 7V for the fan, but what is the fan actual working voltage of the fan. If this is 12V you can use the voltage present on the input of the buck converter that makes the 5V.

author: gkraniske
author_rank: Contributor
timestamp: April 30, 2025, 06:15:52 pm
content: This is the fan I bought. Looks like 5vdc.https://www.amazon.com/dp/B07ZJ47Z2J?ref_=ppx_hzsearch_conn_dt_b_fed_asin_title_4&th=1

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 30, 2025, 06:53:28 pm
content: Then you best use the 5V output from the buck converter to run it.

author: gkraniske
author_rank: Contributor
timestamp: May 11, 2025, 08:18:52 pm
content: Hello again,I'm back lol. So I ordered the new boards and they came in about a week ago. I built one of them up and it seems to work great, except for one thing, it doesn't charge the batteries. I used your schematic with no modifications so I was just wondering if you had any ideas on what it might be. Thanks again.

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 12, 2025, 06:31:07 am
content: Did you measure the voltages. If the batteries are at the same level of the supply voltage they won't charge any higher, and that is a good thing.Just for fun, show us some pictures of the finished board.

author: gkraniske
author_rank: Contributor
timestamp: May 12, 2025, 02:08:30 pm
content: Sure thing! I just kind of put everything into place for the pictures. I have a few bugs to work out before I put it all together. Once completed I'll be sure to post a video of it in action. Yeah I'm charging it with 12.6 volts and it doesn't appear to be charging at all. It went all the way down to 11 volts. So I cut a small slice in the insulation and charged it straight from the wall wart, and that charged it all the way up. By the way, on the PCB, the footprint for the 18650 3S BMS is wrong and I can't seem to locate the correct one on EasyEDA's list of parts. Does anyone have any ideas on how to resolve this? I soldered jumper wires to it as a temporary fix, but in the completed project this won't work. Also, the HC05 bluetooth module is going to be relocated to the top of the board. I accidentally designed it wrong which is why I had to put it on the bottom of the board.

author: gkraniske
author_rank: Contributor
timestamp: May 12, 2025, 02:09:57 pm
content: Here are some more photos

author: gkraniske
author_rank: Contributor
timestamp: May 12, 2025, 02:10:56 pm
content: And some more

author: gkraniske
author_rank: Contributor
timestamp: May 12, 2025, 02:11:41 pm
content: Almost to the last ones lol

author: gkraniske
author_rank: Contributor
timestamp: May 12, 2025, 02:12:13 pm
content: Last one

author: squadchannel
author_rank: Frequent Contributor
timestamp: May 12, 2025, 02:28:43 pm
content: 9900mAh in 18650 is definitely scam. 3500mAh or so is the limit.

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 12, 2025, 03:49:14 pm
content: Thanks for the photos.ButAI!!!!, another big no when using Lithium Ion batteries. Soldering wires to them directly. With this you risk overheating them. Would have been better to use a battery box like this:https://www.aliexpress.com/item/1005007051308086.htmlAs for circuit board design there are also things to be learned, like using thicker traces for power supply tracks and a ground plane. The latter not so important for this project though.For the footprint of the BMS module, you can easily make that yourself in EasyEDA. From the file menu select new footprint, and draw it to measure with pads, outline and texts.But for the rest it does look nice.If you save the EasyEDA project and upload it, I will take a look at it to see why the battery is not charging.

author: gkraniske
author_rank: Contributor
timestamp: May 12, 2025, 04:15:23 pm
content: Cool, I'm going to figure out how to do the footprint in EasyEDA, I had no idea you could do that. As for the project, here it is. I do appreciate your help. Another user on here got me this far so I can't take credit for it's cleanliness lol.

author: gkraniske
author_rank: Contributor
timestamp: May 12, 2025, 04:22:20 pm
content: And I actually bought battery boxes, but in a youtube video I saw several people solder the wires directly to the terminals. Buuuut I won't be doing that again, I didn't think of the damage factor. I had to heat the soldering iron up to 600 degrees to make it stick. Thanks for the info.

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 12, 2025, 05:59:18 pm
content: Quote from: gkraniske on May 12, 2025, 04:15:23 pmThis looks like the wrong version. The schematic is not the one that I cleaned up for you, and the board does not resemble what is in your photos.Quote from: gkraniske on May 12, 2025, 04:22:20 pmThat is the problem with the internet and youtube, there is so much crap on it and people take it on face value, risking al sorts of problems. So on the one side good that you came to the forum, but should do it more often.Edit: I noticed a small f***up of my own. The power connector for the wall wart needs pin 2 connected to ground. Maybe this is why you soldered it on the bottom?So you see, don't trust what you get on the internet. Always check for yourself.

author: gkraniske
author_rank: Contributor
timestamp: May 12, 2025, 06:40:44 pm
content: Sorry about that, I'm not sure how I ended up zipping up the wrong one. Try this one lol.

author: gkraniske
author_rank: Contributor
timestamp: May 12, 2025, 06:43:58 pm
content: And yes, in the final schematic that I sent to China pin 2 and 3 are both connected to ground.

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 12, 2025, 07:00:37 pm
content: Quote from: gkraniske on May 12, 2025, 06:40:44 pmThat looks more like the one needed.I can't see a reason why the batteries won't charge, so you need to do measurements to trace down the voltages. But the files you posted last still differ from the photos of the board. The big resistor in your photo is near the LDR, where in EasyEDA it is near the power input. I can't see in your photo where the other side of the resistor connects to. The trace is not on the back side of the PCB. So maybe that is the problem?Another question is about the LED lights the relays control. What voltage and current are we talking about. You might not have the right clearances between traces for main voltages, nor wide enough tracks to support the current.

author: gkraniske
author_rank: Contributor
timestamp: May 12, 2025, 07:10:56 pm
content: Yeah I made some minor changes to reduce the number of "vias" on the PCB. The 2 watt 15K resistor is above the Nano in the pictures, but I moved it above the step down converter. I probably should've documented that. It's also possible that the batteries were damaged when I soldered the wires to the terminals. Like I said I heated the iron up to 600 degrees to get everything hot enough for the wires to stick. The garage LED's shouldn't matter because I'm using an external power source of 120VAC. The hot leg from the LED's will go into the common pin on the relay, then I'm using NO to power the LED's up when the relay is triggered.

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 13, 2025, 05:42:34 am
content: Quote from: gkraniske on May 12, 2025, 07:10:56 pmBest to measure the voltages on the board. The 12V input, just after the diode before the 2W resistor, after the 2W resistor and the separate cells to see what they do.Quote from: gkraniske on May 12, 2025, 07:10:56 pmAnd this is where you are wrong. The 120VAC is connected to the board via those green terminals and the current has to flow through the tiny traces on the board. Also creepage distance is important between the 120VAC traces and the low voltage DC traces, but also between two 120VAC traces it can cause problems.I'm not behind my development computer at the moment, but looking at the photos of your PCB make me worry.So again, what current will flow for these LED lights. Or state the wattage of them.

author: gkraniske
author_rank: Contributor
timestamp: May 15, 2025, 05:34:34 pm
content: Looks like 160 Watts x 2. Here's the lights I purchased.https://www.amazon.com/dp/B0BFLNYPDH?ref_=ppx_hzsearch_conn_dt_b_fed_asin_title_1&th=1

author: gkraniske
author_rank: Contributor
timestamp: May 15, 2025, 06:03:59 pm
content: I already ordered the boards & there on their way. If it gets too hot I'll reorder them. I made the traces for the 12v input, and the garage LED's bigger (0.75mm) so hopefully that would do the trick. I didn't realize I could do that until you said something, so I googled how to make traces bigger and I found a plethora on information on it. I've attached the project again so you can take a look if you wish. Like I said, I have a lot to learn. I'm actually going through some of my other projects & I'm going to redo them the way you showed me on this project. So I truly do thank you for everything you've done.

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 15, 2025, 06:26:47 pm
content: Quote from: gkraniske on May 15, 2025, 05:34:34 pmAt 120V that is 1.33A. The relay can handle this. Thin traces even short would not be happy, but according to your latest post you have looked into this.In your learning process, these are things to consider. Use Ohms and others their laws to calculate things like current, power and even heat generation dissipation, to become a better designer.Edit: I noticed you are switching both lights with a single relay, but both connectors are setup for a stair case switch system. This feels a bit wrong with just a single relay contact. It also means that the traces to the relay need to handle 2.67A while the LED's are on. Please show us the setup of how these LED's will be connected.Also what is the voltage on the wireless opener part? You did not adhere to a lot of clearance between the LED supply trace and the normally closed contact of that relay. See the green ellipse in the attached image. Also look at the cyan ones where the 120V traces are.

author: gkraniske
author_rank: Contributor
timestamp: May 15, 2025, 08:14:45 pm
content: Quote from: pcprogrammer on May 15, 2025, 06:26:47 pm

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 16, 2025, 05:25:20 am
content: Quote from: gkraniske on May 15, 2025, 08:14:45 pmI don't know the correct term for it in English, but in Dutch it is "hotelschakeling" of "wisselschakeling", which allows you to switch light on and off from two or more places.If you are not planning on using something like this, and by what you wrote I assume you are not, you can simplify your circuit by not using the normally closed pin of the relay, and only route two traces for the LED's. Center point and normally open pins of the relay.Quote from: gkraniske on May 15, 2025, 08:14:45 pmThis makes it a low voltage circuit, and you should definitely keep enough clearance between the traces of this one and the LED circuit. At least something like 5mm.

author: gkraniske
author_rank: Contributor
timestamp: May 16, 2025, 08:11:45 pm
content: Okay, I think I finally got it. No, I don't plan on using the NC leg of the relay, but honestly it just seems like too much work to remove it lol. I did however, replace the small PCB socket with a snap-in one, like the LED's. So I've attached the final version of the project for you to look at one last time. Once again thank you for all of your help, I'd love to buy you a beer but I don't drink alcohol, and you're probably too far away.

author: ledtester
author_rank: Super Contributor
timestamp: May 17, 2025, 02:25:19 am
content: Quote from: pcprogrammer on May 16, 2025, 05:25:20 amWe call them 3-way and 4-way switches. You use two 3-way switches if there are only two switch locations. For more switch locations the additional locations use 4-way switches.

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 17, 2025, 06:15:15 am
content: Quote from: gkraniske on May 16, 2025, 08:11:45 pmI don't drink alcohol either. Happy to help by sharing my knowledge.Your latest PCB is better, but clearance can be simply improved upon. See the attached images on how to.

author: gkraniske
author_rank: Contributor
timestamp: July 02, 2025, 02:58:42 pm
content: Greetings people!!! Hope everyone is doing well. So I'm running into a problem with this same project on the slave side of things. The master seems to be working just fine. So it's a garage door opener at its root, when the garage door is closed, the LED turns green, when the garage door is open, the red LED turns on and the green off, when the button is pressed, the LED turns blue until you release it, then the LED turns red. While the garage door is open, you can press the button to close it, and when the two door magnets (reed switch) come together, the red LED turns off, and the green LED turns on. At least that's how it's supposed to work.But when I upload the code, the green and blue LED's turn on and stay on. When I press the button, the red LED turns on for as long as the button is pressed then it turns off, leaving the green and blue LED's on. I tried to resolve it in the code but it doesn't work. I've switched from using a common cathode LED to a common anode LED. So the common pin gets 5v and each other pin gets ground through three 330 ohm resistors. I redesigned my sketch top follow what pcprogrammer taught me (at least I hope I did it right lol.) So I'm going to post my Arduino code as well as my easyEDA schematic, hopefully that sheds a little light on what I'm talking about. Here is a video of both units.https://youtube.com/shorts/y9Nhs_wJbqo?feature=shareThese units are communicating via an HC05 bluetooth module. Normally when I separate the door magnets, the red LED's on both master & slave turn on, when I put the magnets together, both green LED's turn on, and the red's turn off. But that isn't happening, It works fine at the master, but absolutely nothing happens on the slave. I know the bluetooth modules are working, because when I press the button on the slave, the master relay closes and the LED turns red. So at this point I don't know if it's hardware or software. Any help would be greatly appreciated. Hope you have a wonderful day.Here's my code:Code:// slave# include <SoftwareSerial.h>SoftwareSerial mySerial(7, 8); // Rx | Tx# define redLed 5# define greenLed 6# define blueLed 10# define Button 3# define pwrLed 9char ch;int buttonState = 0;int lastButtonState = 0;int counter;void setup() {Serial.begin(115200);mySerial.begin(38400);pinMode(pwrLed, OUTPUT);pinMode(redLed, OUTPUT);pinMode(greenLed, OUTPUT);pinMode(blueLed, OUTPUT);pinMode(Button, INPUT_PULLUP);digitalWrite(greenLed, LOW);digitalWrite(redLed, LOW);digitalWrite(blueLed, LOW);// analogWrite(pwrLed, 3);}void loop() {// read input oncebuttonState = digitalRead(Button); // LOW = pressedif (buttonState != lastButtonState) {mySerial.print('a');if (buttonState == LOW) { // switch got pressedSerial.print(counter);counter++;Serial.println(" Print a 'b'");mySerial.print('b');digitalWrite(blueLed, HIGH);digitalWrite(redLed, LOW);digitalWrite(greenLed, LOW);} else { // switch got releasedSerial.print(counter);counter++;Serial.print(" Print a 'd'");mySerial.print('d');digitalWrite(blueLed, LOW);digitalWrite(greenLed, LOW);digitalWrite(redLed, HIGH);}} //...// Receivingif (mySerial.available()) {char ch = mySerial.read();Serial.write(ch);if (ch == 'a') {Serial.print(counter);counter++;Serial.println(" Print an 'a'");digitalWrite(redLed, LOW);digitalWrite(greenLed, HIGH);digitalWrite(blueLed, LOW);}else if (ch == 'c') {Serial.print(counter);counter++;Serial.println(" Print a 'c'");mySerial.print('c');digitalWrite(redLed, HIGH);digitalWrite(greenLed, LOW);digitalWrite(blueLed, LOW);}}lastButtonState = buttonState;delay(20); // poor man's debouncing}

author: WattsThat
author_rank: Frequent Contributor
timestamp: July 02, 2025, 05:14:50 pm
content: It’s a long thread and it’s been awhile - so some of us aren’t up to full speed on this - so - could you please post a schematic of the remote circuit board that holds the led that isn’t working correctly (or point us to the post number where we can find it)?

author: gkraniske
author_rank: Contributor
timestamp: July 02, 2025, 08:43:04 pm
content: I posted it in an easyEDA Zip file. Here's a picture of it, I just thought it would be better if you could see it interactively. Thanks for responding though.

author: WattsThat
author_rank: Frequent Contributor
timestamp: July 03, 2025, 03:00:32 am
content: Few to none here will watch a video to turn your problem into a description, it just doesn’t work. Yes, I watched the video. It was a waste of time because I learned nothing more than I learned from reading your post. This is not a criticism, it’s a more an attempt to show that videos can be either really helpful so that we can see things that we cannot see from your words but in this case, the video adds nothing to our understanding of the problem.So, do you have a software problem or a hardware problem? What have you done? Have you proved out your hardware? That’s simple with a sketch like shown below (untested, just an example of what I would do). Blink the red, then the green, the blue and start over. Note the double blink of the red so you know where it’s supposed to start. Easy. Now, if it works as expected, you’ve got a code problem. Isolate, test, debug, repeat. That’s how I approach things. Post what happens. Iterate.Code:# define redLed 5# define greenLed 6# define blueLed 10void setup() {pinMode(pwrLed, OUTPUT);pinMode(redLed, OUTPUT);pinMode(greenLed, OUTPUT);}void main(){digitalWrite(redLed, LOW);digitalWrite(greenLed, HIGH);digitalWrite(blueLed, HIGH);delay(250);digitalWrite(redLed, HIGH);delay(250);digitalWrite(redLed, LOW);delay(250);digitalWrite(redLed, HIGH);digitalWrite(greenLed, LOW);delay(500);digitalWrite(greenLed, HIGH);digitalWrite(blueLed, LOW);delay(500);}

author: ozcar
author_rank: Frequent Contributor
timestamp: July 03, 2025, 06:21:59 am
content: Quote from: gkraniske on July 02, 2025, 02:58:42 pmDid you change your code to take account of that change? As it stands, you turn all the LEDs on in your setup() routine - it that what you meant to do?

author: gkraniske
author_rank: Contributor
timestamp: July 03, 2025, 08:18:05 pm
content: I just got this, I'll take all the criticism you have to offer, isn't that how we learn? I'm here to solve an issue I'm having, but more importantly I'm here to learn a new set of skills. I'm going to run that code a little later, as I'm not at home at the moment. Thanks again for your help, and I'll post the results later.

author: gkraniske
author_rank: Contributor
timestamp: July 03, 2025, 08:19:41 pm
content: How did I turn them all on in the code? I thought setting the pin to LOW turns them off?

author: ozcar
author_rank: Frequent Contributor
timestamp: July 04, 2025, 12:27:03 am
content: Quote from: gkraniske on July 03, 2025, 08:19:41 pmNot with the way you have them wired now. The anodes are permanently tied high, the LEDs will turn on when you pull the cathodes low (through the resistors).

author: gkraniske
author_rank: Contributor
timestamp: July 04, 2025, 12:59:44 am
content: So I tested the hardware and it seems to be working fine, so the problem has to be in the code. So you're saying that I need to set the pins HIGH to turn the LED's off, and LOW to turn them on? I think I understand that but the master unit is the same way and I never changed its code.

author: WattsThat
author_rank: Frequent Contributor
timestamp: July 04, 2025, 03:21:12 am
content: Try the test code on the master…. Do you get the expected behavior? red-red-green-blue? If so, then they’re wired the same way. If you have a common cathode led, you will not get those colors as there will be two on at a time.

author: gkraniske
author_rank: Contributor
timestamp: July 06, 2025, 12:54:10 am
content: So I ran the code that you suggested on the slave, and the LED's fire as they should. I'll need to run it on the master as well so bear with me.