I recently made a circuit simulation with tinkercad and everything seems to work fine, so I wanted to rebuild it using real components but now I have a few problems…
So for introduction I have it’s based on this circuit / code: Circuit design Do Not Disturb - Arduino LED | Tinkercad
It’s just two LEDs (one green, one red) that should toggle when the button is pressed.
Now i rebuilt it using a Arduino Pro Mini and I now have the problem that after uploading the script to the Arduino, the green LED is flickering the whole time, and the State Switching / Button Press has no effect. Here is a video of the issue: https://youtu.be/kFYr5KgcZ6I
Maybe I made a mistake while converting my circuit from the Arduino Uno circuit to the Arduino Pro Mini or in general I have a wiring mistake… but also im not that experienced with the topic and maybe I have a lose connection due to breadboarding? Thats why I chosed to use tinkercad beforehand, so I can be sure that it should work in general!
I would really appreciate tips on what to try out next to possibly fix the issue, as I’m kinda stuck right now.
I'll post your links correctly, for everyone's benefit, mostly yours.
It looks like you have not soldered header pins to the pro mini. Pushing Dupont wire pins through the holes into the breadboard like that won't make reliable connections. Solder those header pins, including for the USB-serial adaptor and see if that fixes the problem.
First, thank you for linking them correctly and for the fast reply!
You are correct, it is not soldered. I will try your suggestion and see if it helps, I'll update the thread!
To solder the header pins, clear your breadboard, then push the 2 rows of header pins into the breadboard with shorter end of the pins pointing upwards. Then place the Pro mini onto the header pins, checking that it is properly seated onto the pins before soldering each pin. The solder joints should make neat, shiny little cone shapes around each pin, filling the holes in the mini.
Look at the way my nano is soldered in this picture:
After a few of these types of threads, I did an an experiment with an unsoldered Nano. I soldered the headers into a stripboard set at a slight angle so that the fit of the Nano over them was quite firm. Nothing but trouble with intermittents until properly soldered in. No surprise really of course.
You may have the button connected wrong. Try connecting the pulldown resistor from the white wire to GND.
Beginners misunderstand the need to actually connect the parts together.
Thanks for your replys, now i soldered the pin rows to the Pro Mini and the result is different. Now both LEDs blink the whole time. => https://youtu.be/xomLJPPjK6Y
The code upload via the Arduino IDE now works 100% of the time. So that connectivity issue is solved and it is simplified in general - thanks for that!
I also tried to 1:1 replicate the code / simulation from tinkercad with an Arduino Uno with my "real world" components and it works flawlessly. Unfortunately, Tinkercad can not simulate other Arduinos (like the Pro Mini I use).
So I think the only problem that is left, is a wiring problem (due to the fact that I tried to convert my wiring from the Arduino Uno to the Arduino Pro Mini and it has a few differences).
@JCA34F i tried what you suggested but I'm not sure if I understood it correctly. Maybe the following brings clarity!
Here is the current schema how my Arduino Pro Mini is connected:
Annotation: I changed the color of the white cable (from the photo) to turquoise in the following schema to improve the visibility
Try removing the 10K. Wire one corner of the switch to ground and the opposite corner to the Arduino pin. Change the mode of that pin to INPUT_PULLUP.
Thank you for the fast reply!
I did exactly that (wiring and code changes) and now it works!
Here's my final wiring for anyone that is interested:
I did exactly that
That's not what your diagram shows!
...the opposite corner to the Arduino pin
Oh, well my bad - Let me rephrase:
After I changed the wiring to approximately what you wrote (at least as far as I understand it), I noticed that that the LED behavior was close to what I expected.
Then I tried to re-configure my wiring and swapped the connection from each corner until I had the current wiring (as seen in the screenshot above) and now it "works" (as in, it does what i initially wanted).
Due to your post I just tried to connect the black colored cable to the opposite site (to the right corner, below the button) and it works too!
Would you say the current configuration is okay in general or is there still a problem left with this wiring?
No, sounds like it is ok now.
The problem with those buttons that have 4 pins is that 2 pairs of pins are permanently connected together, and one pair is connected to the other pair when the button is pressed. But it's hard to remember which pairs are connected together. But if you use diagonally opposite pins, that always works.
Ok thanks again for all the help
Your next step should be learning about circuit diagrams and how Fritzing pictures are the "babies' teething rings" of electronics. I'm surprised that you haven't already had that pointed out, because they are utterly meaningless for fault finding. Many of us find them more than a minor irritation when they pop up after asking for circuit diagrams.