Building an Inductor Meter without External Comparator | Arduino Nano

  Рет қаралды 13,962

5VLogic

5VLogic

Күн бұрын

In this video we explore a way of measuring inductance using an Arduino Nano and no other external ICs (just one transistor).
Thanks for watching and let me know what you think of this approach!
Code available at: github.com/5VLogic/l_meter
0:00 Intro
0:52 Principle of operation
2:37 Writing the code
8:05 Calculating the inductance
9:13 Finish the code
14:06 Compile and test
Thanks to Ligo George for the lcd.h library:
electrosome.com/interfacing-l...
Music: Kevin MacLeod - Space Jazz
#electricalengineering #inductor #diy #arduino

Пікірлер: 70
@5VLogic
@5VLogic 5 ай бұрын
I'm curious to get feedback about the code explanation: Was it too long and should have been avoided? OK but shorter would be better? Good the way it is? Or even more in depth? Let me know, thanks!
@ivolol
@ivolol 5 ай бұрын
I think going over the code that's already written, in functional steps, which can sometimes involve skipping around where necessary, is better than going down through it in a very linear fashion "as you write it". But still educational as it is.
@5VLogic
@5VLogic 5 ай бұрын
I appreciate the feedback
@sovahc
@sovahc 5 ай бұрын
You need split your code to modules/functions. Then give each module and each function the most understandable unambiguous name. Then do it with each variable. Instead of comments, try to give variables and functions the most understandable names. Add comment to the code only if there is no other way to make the program more understandable. The quality of the code needs to be measured by WTF-meter. 1. Give your code yo another human. 2. Check WTF count. Lower WTFs is better.
@theovannieuwenhuizen5756
@theovannieuwenhuizen5756 5 ай бұрын
It wasn't too long, but (for me) a tad quick. Manipulation of the registers could be more in depth in a separate video maybe?
@Poult100
@Poult100 4 ай бұрын
I think a thorough explanation is good and, as you did, allow viewers to skip if they want. I've been teaching adults for nearly 4 decades. Everyone wants different things with this; the math, the code, the schematic, etc. The only way you can get close to pleasing everyone is to do the lot but provide skip points. Excellent description of your project, thanks!
@styrishrodrigues
@styrishrodrigues 13 күн бұрын
Great information, thanks buddy! ❤
@levieux1137
@levieux1137 5 ай бұрын
Great to see an arduino project coming with a makefile and that only requires a cross-compiler and not an insanely heavy environment! It's getting so rare these days!
@Cristi4n_Ariel
@Cristi4n_Ariel 5 ай бұрын
Thanks for walking us through the code, it was very interesting!
@ghanrajsingh7347
@ghanrajsingh7347 5 ай бұрын
I FOUND YOUR CHANNEL RECENTLY AND LEARNED SO MUCH ELECTRONIC
@RicardoOliveiraRGB
@RicardoOliveiraRGB 5 ай бұрын
Congratulations man! Nice project!
@theovannieuwenhuizen5756
@theovannieuwenhuizen5756 5 ай бұрын
Thanks fot your in-depth video. Learned a few new things and if i find some spare time test it myself. Really enjoyed the explanation of your code. Would have liked to see the corrections incorporated in the video Best regards from the Netherlands.
@mohaamoha9272
@mohaamoha9272 5 ай бұрын
amazing explanation
@user-mr3mf8lo7y
@user-mr3mf8lo7y 5 ай бұрын
Much appreciated the effort.
@mcbirk4999
@mcbirk4999 5 ай бұрын
great video, thanks! but with your shown code you won't ever get a reading of 'mH' unit because in line 131 you forgot to change the copied 'nH' string (with power of 3) to 'mH'... never the your code gave me a lot new inspiration - thanks again!
@5VLogic
@5VLogic 5 ай бұрын
True, quite the eye for details!
@benhetland576
@benhetland576 5 ай бұрын
More related details: With the right rounding error the value of _power_ can even become 255, in which case you could probably just display "H" as the unit which you don't show in any case. More theoretical perhaps, but generally a wrong unit will be displayed when (power >= 12), but you will have other numeric problems as well at this point... (perhaps even with ns-level calculations) The _divisor_ can also become 0 which you might want to just treat as an erroneous measurement.
@fase144
@fase144 5 ай бұрын
Hi, today I found your channel and this video I really like it. New follower 👏
@incxxxx
@incxxxx 5 ай бұрын
In general in that method you have to select different C for different L. It is serious obstacle.
@xedtronicsph3877
@xedtronicsph3877 4 ай бұрын
This is very good. An LC meter will be very good
@carlo_geiss
@carlo_geiss 5 ай бұрын
great ... so good info and practical action ... love it thank you ....greetings from North-Sweden .... Carlo SA2KHG
@SusanAmberBruce
@SusanAmberBruce 5 ай бұрын
I liked the code explanation, although for me, I will need to listen to it a few more times as it's quite advanced from my point of view, having said that it's an opportunity to learn new coding methods.
@Smit7ua
@Smit7ua 5 ай бұрын
Thanks you a lot 👍 Great job! Wait for a new video 😉 Hi from Ukraine 🇺🇦
@Johadart
@Johadart 5 ай бұрын
Hi Mr 5VLogic, could you possibly put the code you used in the description, so people can learn it in their own time, apart from that, good job.. on a side note, not all people will pick up on this video, so share the link in the description pal.. 🤙🏼
@5VLogic
@5VLogic 5 ай бұрын
Thanks, I'll try to get that done, maybe with a GitHub account
@Johadart
@Johadart 5 ай бұрын
@@5VLogic Thankyou
@5VLogic
@5VLogic 5 ай бұрын
The code is now available on GitHub! Link in the description
@anithasshenoy6662
@anithasshenoy6662 5 ай бұрын
Nice explanation of the logic (and code). Your explanation helps a lot. Was it too long ? NO. One question though. You copied the LCD.H to your folder and uses it. Is it different from the standard library ?
@5VLogic
@5VLogic 5 ай бұрын
Hi, thanks. Hopefully I understand your question correctly; the standard libraries like are installed along with the compiler in a path that the compiler knows. The lcd.h is a custom one that must be added manually, therefore it is included with " ". It's path should be where the compiler is called, otherwise specified explicitly. I'm not an expert on this subject so hope this helps.
@someshmutha6805
@someshmutha6805 4 ай бұрын
i am geeting constant value 26215nH of inductance for any value of inductance
@incxxxx
@incxxxx 5 ай бұрын
It interesting, if you use about 20mH inductance coil, the result would be satisfactory? I measured L of secondary transformer output by UNI-T - it gave 17 mH but by some other tester it was 36 mH. But when I measured experimentally using formula J= U/sqrt(R^2 + XL^2) I obtained 111 mH.
@erfanblaze4524
@erfanblaze4524 2 ай бұрын
Thank you With the tips you gave, the program works well There is only one problem that it reads all the inductors, but it has a problem with small smd inductors like size 1206 and it doesn't show a number! I mean, where does the problem come from?
@5VLogic
@5VLogic 2 ай бұрын
Hi, I'm glad you were successful in building the project! Although I don't have any SMD inductors to test, I'm relatively sure it's because they have high series resistance. Being so small they have to pack a high number of turns in there, and the wire has to be very thin. This means that the energy is lost quickly before it has time to oscillate enought to give a reading. I think the program discards measurements with less than 4 oscillations maybe(?), it's been a while... Also I don't know the value of your inductors, but low values are also not read, for similar reason, not enough energy is stored in them to oscillate enough and the Q factor is also lower, creating the same result. You could measure series resistance with an ohm-meter to verify the hypothesis if you'd like.
@BeetleJuice1980
@BeetleJuice1980 5 ай бұрын
Great job! It would be nice to make a pcb like a shield for arduino nano. You can make the lcd smaller or maybe an oled that uses less power and space. Whats the max inductance it can measure? Can it be used for big coils like transformers?
@5VLogic
@5VLogic 5 ай бұрын
Thanks! I thought of the PCB idea and but will wait until I add the capacitance and resistance measurement. For the max inductance, I've tested the low mH range and it works, but haven't pushed the limit.
@BeetleJuice1980
@BeetleJuice1980 5 ай бұрын
@@5VLogic maybe the 5v are OK as voltage, as long as the mosfet and the psu can allow some amps to flow. Why not try with some transformers laying around? The pcb can be done even diy, you can provide an idea of the layout.
@nanolabhamlinux
@nanolabhamlinux 5 ай бұрын
Hello.. I guess there is an error in line 131, around 13:08... should be mH, not nH, right?
@5VLogic
@5VLogic 5 ай бұрын
That's correct
@erfanblaze4524
@erfanblaze4524 2 ай бұрын
Hello What compiler did you use? And the hex code was generated?
@5VLogic
@5VLogic 2 ай бұрын
Hi, I use avr-gcc as a compiler and avr-objcopy for the hex file. My makefile (and the whole project) is on GitHub and you can check it out and/or download everything there (link in description). In my case I run everything on Linux, but I think it should work on all OSs if the necessary utilities are installed.
@erfanblaze4524
@erfanblaze4524 2 ай бұрын
​@@5VLogic thank you I compiled with avr -stdio and put the hex into the arduino nuno And I closed the circuit and it says open on the LCD, and when I connect the inductor to the circuit, the board makes a connection! Maybe the problem is with my compiler, please upload hex file 🙏
@5VLogic
@5VLogic 2 ай бұрын
Finally got it done, hopefully it's correct because I stopped working on this project since I turned it into the LC meter in my following video, but it should work. I'll upload the hex file for that one too in case you'd like to try it.
@erfanblaze4524
@erfanblaze4524 2 ай бұрын
@@5VLogic tank you 🥰
@erfanblaze4524
@erfanblaze4524 2 ай бұрын
Hello I do the circuit according to the circuit I closed the video and checked it several times, I also used the hex file that you put in the new one It only says "open" on the LCD But the problem is that when connecting the inductor in the circuit, the board makes a connection and draws 1 ampere! Please guide 😢
@erfanblaze4524
@erfanblaze4524 2 ай бұрын
When connecting the inductor to the circuit, it draws up to 1 amp and heats up the bd137 transistor and writes >open< on the LCD.
@5VLogic
@5VLogic 2 ай бұрын
@@erfanblaze4524 Hi, it's very difficult helping people through the internet debug circuits, but what I can do is give a few pointers and recommendations: 1) Check your transistor, if it's truly a BD137 and not a PNP. 2) Check the overall wiring. If you have and oscilloscope, probe all voltages around the transistor (the base in particular). 3) See if compiling your code and using my .ihex file gives the same result, if not there could be a problem in the code (potentially mine as well, although I don't think so). 4) Check the integrity of the arduino and it's pins, try an other GPIO to be sure, or test the one you're using with an LED to confirm it's working properly. Ideally check that it's capable of both sourcing and draining current. 5) Try swapping the transistor, in case it was bad or it got damaged. A MOSFET should work fine, but use a series resistor to limit the drain-source current. Place it on the drain side, not the source because it won't turn on properly. Unfortunately if the problem is hard for someone working on it in person, it's REALLY hard for someone over the internet. The general approach I recommend is to progressively excluding all possible faults and faulty components, one at a time by testing or swapping them. I really hope that helps, good debugging!
@erfanblaze4524
@erfanblaze4524 2 ай бұрын
My circuit worked correctly and the problem was using the software >avrdudess< to put the hex code on the arduino nano, when I connected it directly to the atmega328 with the stk500 programmer and programmed the hex code, the problem was solved and the circuit worked correctly. he does Anyway, thank you very much for your advice 🥰🙏
@erfanblaze4524
@erfanblaze4524 2 ай бұрын
​@@5VLogicMy circuit worked correctly and the problem was using the software >avrdudess< to put the hex code on the arduino nano, when I connected it directly to the atmega328 with the stk500 programmer and programmed the hex code, the problem was solved and the circuit worked correctly. he does Anyway, thank you very much for your advice
@erfanblaze4524
@erfanblaze4524 2 ай бұрын
There is only one problem that it reads all the inductors, but it has a problem with small smd inductors like size 1206 and it doesn't show a number! I mean, where does the problem come from?
@caeli5532
@caeli5532 5 ай бұрын
If you know, show us how to make generator on quartz resonator.
@trongbangnguyen6706
@trongbangnguyen6706 2 ай бұрын
You can provide file.hex I use windows so I can't use avr gcc. thank you.
@5VLogic
@5VLogic 2 ай бұрын
Hi, it's already available on GitHub, link in the description.
@trongbangnguyen6706
@trongbangnguyen6706 2 ай бұрын
@@5VLogic The description link does not have a .hex file but only an exe.ihex file. I don't flash it your way, so I need the file .hex
@5VLogic
@5VLogic 2 ай бұрын
Ok, I updated the repo, try it now and let me know if there are any problems.
@trongbangnguyen6706
@trongbangnguyen6706 2 ай бұрын
I don't want you to change the name, I want a .hex file that can be loaded directly with the NEO programmer tool without avdure or similar, I don't use linux, I have ch341 avr and nep SPI programmer.
@trongbangnguyen6706
@trongbangnguyen6706 2 ай бұрын
I don't want you to change the name, I want a .hex file that can be loaded directly with the NEO programmer tool without avdure or similar, I don't use linux, I have ch341 avr and nep SPI programmer.
@incxxxx
@incxxxx 4 ай бұрын
Without EXTERNAL comparator no way, it can be only waste of time. But your code is valuable and can learn much how to write properly.
@__MINT_
@__MINT_ 5 ай бұрын
Arduino libraries are mostly garbage based on other libraries written by noobs. I also prefer writing my own functions, just like it was done 20 years ago. Back then, code was a lot more efficient, nowadays people think that if we have fast microcontollers, we can waste some clock cycles and create shitty code
@5VLogic
@5VLogic 5 ай бұрын
Totally agree
@__MINT_
@__MINT_ 5 ай бұрын
Seems like you are even lower level programmer than me, I still use Arduino IDE despite writing in almost pure C, while you use vim on linux. Good to see that there are still some channels showing the proper way of doing things, instead of using pre-prepared solutions for everything. Yeah, it takes more time, but you also learn a lot more. I would say that it's the best way to master troubleshooting, logical thinking and pushing yourself to the limits not to give up. Not that long time ago I was crazy enough to write my own audio codec that beats MP3 when it comes to some aspects. Was it easy? Nope. But was it worth it? Definitely yes. Anyways, best wishes for you and your channel!
@tcarney57
@tcarney57 5 ай бұрын
@_MINT: I suppose it depends on your definition of "garbage" and "shitty." Nothing that actually does what it's suppose to do can rightly be labelled as either. If it takes another half second for a program to run, who cares? If it uses code that theoretically can be optimized but it works anyway, why waste even more valuable time (the programmer's) to fuss with it? Since we _do_ have very-fast micro-controllers, why try to make the code faster than a person will even notice, at least for a test instrument such as this? If I insert an inductor in an instrument and it gives me a reading in 1.5 seconds instead of 15ms, I (the programmer/user) will never experience the delay in any meaningful way. This very long-standing concern with speed of execution--and with memory usage--if from an era when those things were either unavailable or costly. Now they're ubiquitous and _very_ cheap. The only other reason to make the fuss in all but the most critical applications (in which you wouldn't be using an Arduino anyway) is to assume a posture of superiority over "noobs" and to assert that twenty years of experience isn't just one year repeated twenty times.
@__MINT_
@__MINT_ 5 ай бұрын
@@tcarney57 well, I'm a perfectionist, so something totally okay for others might be garbage for me. I'm not gonna define what shitty and garbage means, let's not elaborate too much. I demand from my code to be clear, fast, memory efficient and totally idiotproof. No bugs allowed, even minor. Creating such a code takes time, but I am satisfied with myself afterwards. Only exeption from above rules is writing temporary code for test purposes.
@__MINT_
@__MINT_ 5 ай бұрын
@@tcarney57 I don't know why your reply is gone, but in my case it isn't "I am perfect". I am not perfect and I will never be. What pushes me to create "perfect" code is the need of an absolute control over what is happening and the need of having a feeling that the code is bug-free and stable. That implies using no libraries, unless I trust one, which isn't the case for most of Arduino ones, and also creating the code like it's some kind of fine art. I am something of an artist myself, very competitive one. Maybe my approach will change one day, I'm not even 20.
Component Tester PCB with Arduino and TFT display
8:46
Electronoobs
Рет қаралды 44 М.
I tried the Cheapest Arduino Alternative (that Nobody heard of)
13:31
Mama vs Son vs Daddy 😭🤣
00:13
DADDYSON SHOW
Рет қаралды 32 МЛН
How To Measure Inductance By A Multi-meter?
8:18
DIY made
Рет қаралды 41 М.
EEVblog 1465 - Your Multimeter Can Measure Inductors
9:56
EEVblog
Рет қаралды 87 М.
Turn any DC Motor into a Servo Motor
25:24
How To Mechatronics
Рет қаралды 281 М.
Inductance meter with Arduino
12:29
Electronoobs
Рет қаралды 125 М.
5 Ways To Generate A Sine Wave (Analog)
13:16
Sine Lab
Рет қаралды 84 М.
477 Use the very attractive new ATTINY chips for your projects
14:34
Andreas Spiess
Рет қаралды 202 М.
DIY transformer/inductor tester
27:06
DiodeGoneWild
Рет қаралды 66 М.
how to make inductance tester, using arduino
7:14
inventor KR
Рет қаралды 14 М.
Kumanda İle Bilgisayarı Yönetmek #shorts
0:29
Osman Kabadayı
Рет қаралды 1,8 МЛН
Как правильно выключать звук на телефоне?
0:17
Люди.Идеи, общественная организация
Рет қаралды 1,9 МЛН
Todos os modelos de smartphone
0:20
Spider Slack
Рет қаралды 62 МЛН
Это - iPhone 16 и вот что надо знать...
17:20
Overtake lab
Рет қаралды 130 М.