My componets tester is acting weird

My components tester is acting weird!
I don't know if the problem is from the PCB or the code, I tried everything.

Here is the schematic:


and here is my code:
tester 12.txt (189.1 KB)

The problem is, the resistors that I used is not that accurate, and even after calibrating it, still doesnt work probebly.

like if I test a resistor it will be way off like the 1000ohm will be 3000ohm

can someone help me please?

Please post your full sketch here to avoid teh need to visit another site, using code tags when you do

Posting your code using code tags prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination

In my experience the easiest way to tidy up the code and add the code tags is as follows

Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

It is also helpful to post error messages in code tags as it makes it easier to scroll through them and copy them for examination

I tried dude, but the code is so big, it hit the limit, I couldn't post it.

The code doesn't have any error, the problem is the device that I made is not accurate at all

The next best option to posting it here is to zip it up and attach it to a post here

Where did you get the code and schematic ?

I edited the main post as suggested.

The code is based on this one:

The schamatics are the same all over the internet.
And based on these I made this PCB:

Based on, or exactly that code ?

Have you modified it in any way and which Arduino board are you using ?

Sorry, but that suggests you didn't copy well if the schematics all over the internet work. OR do all of them NOT work?

I have modified the code, I tried the same exact code too, it doesn’t work, I’m using arduino nano “not original”

I tried the guy method of calibration, it’s still waaay off, I made one manually, still the same, the weird thing is, i tried the same exact code and the same schematic, but it’s still wrong.

I tested the PCB, I changed the resistors to 1% Tolerance, and tested each one by fluke multimeter.

It’s still way off

You can split your code and post each section in a separate reply.


I've compiled your code for a Nano and this is the result:

Sketch uses 28972 bytes (94%) of program storage space. Maximum is 30720 bytes.
Global variables use 757 bytes (36%) of dynamic memory, leaving 1291 bytes for local variables. Maximum is 2048 bytes.

Next I noticed

Using library Adafruit SSD1306 at version 2.5.15 in folder: C:\Users\bugge\OneDrive\Documents\Arduino\libraries\Adafruit_SSD1306 

That library uses dynamic memory allocation and requires 1 kB for the display. So your total RAM usage is 1781 bytes which will get you in the danger zone; I wonder if your problem is not a result of running out of memory (not sure though).

Lastly I noticed the use of an uninitialised variable:

C:\Users\bugge\AppData\Local\Temp\.arduinoIDE-unsaved2025619-22504-1sjryad.ro39\sketch_jul19a\sketch_jul19a.ino: In function 'GetESR':
C:\Users\bugge\AppData\Local\Temp\.arduinoIDE-unsaved2025619-22504-1sjryad.ro39\sketch_jul19a\sketch_jul19a.ino:5380:53: warning: 'cap_val_nF' may be used uninitialized in this function [-Wmaybe-uninitialized]
     sumvolt[2] -= (1745098UL*MAX_CNT) / (cap_val_nF * (cap_val_nF + 19));
                                                     ^
C:\Users\bugge\AppData\Local\Temp\.arduinoIDE-unsaved2025619-22504-1sjryad.ro39\sketch_jul19a\sketch_jul19a.ino:5182:17: note: 'cap_val_nF' was declared here
   unsigned long cap_val_nF"C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\0B78D4AE6A2CBBF53E4B5904306DE410/sketch_jul19a.ino.elf" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\0B78D4AE6A2CBBF53E4B5904306DE410/sketch_jul19a.ino.eep"
;

I did not dig through your code.

I saw videos on them they work, but dude, I’m 100% sure the PCB wiring is correct, I tested each trace, and all traces are wide enough and thick to not make any problems.

I’m trying to solve this problem from months, like tried everything, even used chatgbt, curses AI

And wrote code to be sure all wiring is correct, and they passed

I took a quick look at the code, and it has a lot of issues. For me, the non-starter is the use of goto, but the lack of modular organization, unneeded comments, and wasted space are issues too. I have seen a lot worse but a long time ago, this may be the new current champ though.
Good luck, and I will make a small wager on the PCB being the problem just because the OP is so dam confident it isn't. Yes, I am a contrarian!

Okay I will try to make it smaller and look into these problems maybe the lack of memory is the problem, thanks dude

You know what, I will make one on breadbourd :sweat_smile: now you made me feel there is something wrong there..

Please show us a clear, high-rez image of the back(solder side) of your PCB; Contrarians United also have suspicions about soldering capabilities!

Glad to see you are open to input. However, a breadboard, even the good ones, is extremely unreliable. If you want to go that route, only breadboard a small part of the circuit at a time and test. But even if all goes well, you are not positioning wires(traces) at the same distance and/or orientation, which can cause crosstalk.
I am a little surprised there is not a piece of software or perhaps hardware/software to test a PCB for crosstalk. I have several component testers, but not one of them is an ALL components. Maybe there is a reason for that?

At the very least start with creating 'helper' modules to isolate sections of code.
However, at this point you don't know if your issue is hardware or software. I am trained in both fields as a former IBM hardware/software engineer. It was a long time ago and isn't directly useable today, but I am very suspicious that you are experiencing cross talk. All the tests you did were for components, now you need to do either a full factorial test which for this size project could take a VERY long time, or at least do 'pairwise' testing. There are online/tools that will help you generate all the Pairwise combinbations.
If I have not been clear, I think there is a decent chance two traces running beside each other is the problem. They need to be rerouted so they cross at 90 degrees. As a last resort, do a breadboard with shielded wires, or maybe a intelligent sub-set of the wires. If you can reduce the hardware and software to a single component test failure like the Resistor test then the time and $ will be greatly reduced.

@anon543
Why is there a "power" LED using Nano pin A3 when the Nano has a built-in power LED? It seems the author cared more about bells and whistles than function.

The "fritz" and the schematic are not the same.

Were the PCBs made from the "fritz" or the schematic, or a totally different drawing not yet disclosed?

Very interesting, I didn’t think about that at all, can you check the PCB? :thinking: most wires run togethers..

Maybe because they want to add encluser/box to the project?

I made the PCB the same as fritz pic, the second pic just for resistance reference

Also I noticed, after watching some videos that a lot of people get the same shitty measurements..

With the same code, and the same schematic..

Jeez I wasted 2 month on it..

This is the last time to try making a measurement device..

Tons of calibration..

And that’s why Fluke and other components testers are expensive

Side note to myself:
Always buy original arduino when you debug something…