Author Topic: Old dog, new tricks - learning electronics  (Read 4428 times)

0 Members and 1 Guest are viewing this topic.

Offline casterleTopic starter

  • Regular Contributor
  • *
  • Posts: 129
  • Country: us
Old dog, new tricks - learning electronics
« on: December 13, 2020, 01:24:19 am »
I'm a retired software dev with lots of experience programming to the metal. I had some basic electronics training in the Navy (50 years ago!). As a software contractor I provided my own tools, so I've got some test equipment at hand. Now I want to learn much more about electronics as a hobby.

I want to be able to follow a curriculum so I learn logically and don't miss important concepts. I want to learn at at my own pace, and of course in concert with this I will be experimenting along with the wonderful EEVBLOG and other videos on YouTube that have led me so strongly in this direction.

I don't have some equipment that will be needed or at least useful. In my explorations I've found a couple of hardware devices that seem well suited to this approach:
The ADALM2000 has a little brother which is too limited. I've also looked at the Red Pitaya, but it's pricy and seems more of a niche product. Other suggestions are welcome. I don't really care about the respective merits of these units as test equipment - my only concern is how much I can learn.

Searching EDU sites for PDF files (and thus labs), the DAD2 is used quite a bit more often than the ADALM so there are many more potential classes from universities around the world. I've looked at some of these documents and they're exactly what I'm looking for (some, of course, are not).

On the other hand, ADI has gone all-in on educational resources (https://tinyurl.com/y3a5c2db). They have dozens of courses that use their device.

If you have experience with one of these devices as an educational tool, which would you choose?

Thanks!

P.S. I've been told elsewhere that I should avoid hardware entirely and start with textbooks. That's not how I learn best - I want to work through labs with accompanying lessons explaining what I'm doing and why.
« Last Edit: December 13, 2020, 02:16:10 am by casterle »
 
The following users thanked this post: maelh

Offline KWKolb

  • Contributor
  • Posts: 26
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #1 on: December 13, 2020, 03:07:04 am »
I suggest looking at the course materials and find the style and cadence of teaching that most suits your style at this point, rather than get lost in comparing value and price points.
 

Offline casterleTopic starter

  • Regular Contributor
  • *
  • Posts: 129
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #2 on: December 13, 2020, 05:20:46 am »
I suggest looking at the course materials and find the style and cadence of teaching that most suits your style at this point, rather than get lost in comparing value and price points.

A good suggestion. I've looked at what's available for each product and, while there's more content for the DAD2, I have found sufficient material for either of the two. It seems to come down to two things: price and availability.

The ADI with parts kit is about half the cost of the DAD2 without the parts - not a determining factor, but I can buy a lot of parts for $200. More importantly, I can get an ADALM2000 in a few days whereas it will probably be a couple of months for the DAD2.

I've pulled the trigger on the ADALM2000.
 

Offline tchicago

  • Regular Contributor
  • *
  • Posts: 110
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #3 on: December 13, 2020, 05:50:44 am »
If you want to build up a good fundamental base, look up the 3-part course called "Circuits and Electronics" at edx.org, it is a class from MIT. It is free if you don't want a paper certificate. It is taught by one of the best educators I've ever seen. I am a software engineer with electronics engineering college background from 25 years ago, and I practice electronics hobby at home. Although I knew most of this, I took this course a few years ago. It was a pure joy, and a bonus of a refresher on modern stuff that happened electronics since my college.
 
The following users thanked this post: Mr. Scram, casterle, maelh, ssheashell

Offline Ed.Kloonk

  • Super Contributor
  • ***
  • Posts: 4000
  • Country: au
  • Cat video aficionado
Re: Old dog, new tricks - learning electronics
« Reply #4 on: December 13, 2020, 06:56:26 am »


P.S. I've been told elsewhere that I should avoid hardware entirely and start with textbooks. That's not how I learn best - I want to work through labs with accompanying lessons explaining what I'm doing and why.

It's only a suggestion, but since you have mentioned that you are primarily a software guy and for some reason have limited access to hardware, whatever that means...

May I recommend that you set up yourself a nice software SPICE simulation environment? Since you said that you want to go along at your own pace, the internet is, IMO, perfect to suit your goals.

After 2020, most educators have realized that structured curricular is a dead duck. Everything you need to know is on the web, when you're ready to absorb it.

 :)
iratus parum formica
 
The following users thanked this post: casterle

Offline HB9EVI

  • Frequent Contributor
  • **
  • Posts: 722
  • Country: ch
Re: Old dog, new tricks - learning electronics
« Reply #5 on: December 13, 2020, 06:27:44 pm »
The Adalm devices are nice tools, but I don't really see what purpose it should serve you; most people using it here are ham radio operators.

If you need something to get into electronics, it's a multimeter. that's a wiser decision than the Adalm2000.

since you're coming from the software domain, I wouldn't promote to work software based only; the chance that you get lost again in the software world is too big.
for electronics it's essential to work with hardware, with real transistors, resistors and capacitors; these are cent articles and if one spits out the magic smoke you get a new one.

a save bet to get into the business are the two books:

- The Art of Electronics
- Learning the Art of Electronics

imho they're about the best text books there are about electronics. Whenever you take one in hands, you'll end up spending hours reading in it.
 

Offline casterleTopic starter

  • Regular Contributor
  • *
  • Posts: 129
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #6 on: December 13, 2020, 07:04:30 pm »
The Adalm devices are nice tools, but I don't really see what purpose it should serve you; most people using it here are ham radio operators.

If you need something to get into electronics, it's a multimeter. that's a wiser decision than the Adalm2000.

The purpose of the ADAML is to provide test equipment I don't have in a cheap package. I've got a far better meter than I need (HP 34401A) as well as a couple of handhelds.

for electronics it's essential to work with hardware, with real transistors, resistors and capacitors; these are cent articles and if one spits out the magic smoke you get a new one.

Agreed. Which further attracts me to the ADAML as ADI has built a reasonably priced kit of parts so every lab can be completed without hunting for the right part.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #7 on: December 13, 2020, 07:21:57 pm »
I don't know anything about the ADALM2000 but it seems that the Scopy software doesn't have a "demo" device.  If it does, I didn't find it.  The Digilent Waveforms software does have a "demo" device so you can play with all the features without spending any money.

I learn more from labs than books.  I can spend an entire day with a 0.1 ufd capacitor and a 10k resistor playing with them in the time and frequency domain.  Just wire up a low pass filter and run the Bode' plot.  Notice how the -3dB point is exactly where the book says it will be.  BTW, just try to get a real Bode' plot out of a scope.  Even the Siglent approach of linking an AWG to the scope doesn't produce anything close to a real Bode' plot.   See attached.  You have no idea what I went through to get a plot like this back in undergrad (about '72).

You might look into Digilent's Real Analog coursework.  There are lectures, notes and labs.  They tend to use the AD2 but it's all the same.

https://learn.digilentinc.com/classroom/realanalog/

w2aew has some great videos as does Dave.  Look for Dave's Fundamental Fridays videos.

Analog Devices also has a large series of course work which I expect is developed around the ADALM2000 but workable in any other environment.  It looks very interesting!

https://wiki.analog.com/university/courses/electronics/labs

A lot of people really like the Art of Electronics (lectures), Learning The Art of Electronics (lab work) and the X Chapters (corrections and additions to Learning...).  I find books related to theory to be quite boring, I prefer to see the results in real hardware.

Absolutely, install LTspice (free).  Simulation isn't hardware but it has a place.

There are hundreds of threads on DMMs but count on needing at least 3 over some period of time.  You have a good start.

Of course, the ADALM2000 can serve as 2 DMMs, among many other things.

You absolutely want to play with hardware.  That Analog Devices program looks VERY interesting!

I don't know much about ham radio, I use my AD2 and Digital Discovery as logic analyzers and as a way to display very elementary circuits.  It is absolutely the best learning device on the planet.  That's why they're out of stock since students can't go to the real labs.  Put an AD2 and laptop in your backpack and you can work anywhere.
« Last Edit: December 13, 2020, 07:26:20 pm by rstofer »
 
The following users thanked this post: casterle

Offline casterleTopic starter

  • Regular Contributor
  • *
  • Posts: 129
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #8 on: December 13, 2020, 07:25:11 pm »
If you want to build up a good fundamental base, look up the 3-part course called "Circuits and Electronics" at edx.org, it is a class from MIT.
I started to watch a few minutes of the first lecture this morning - I had a hard time stopping! I think I'm going to enjoy learning from this talented instructor!
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #9 on: December 13, 2020, 07:44:45 pm »
Khan Academy has an Electrical Engineering curriculum in addition to the mathematics program for which they are world famous.

https://www.khanacademy.org/science/electrical-engineering#introduction-to-ee

At some point, math becomes a stumbling block for most budding EEs.  Things just don't stay linear very long.  Once we throw in capacitors and inductors, the math gets heavy.  Khan Academy can help.  Or, skip it and let LTspice do the work.

For those with a programming background, you can have a lot of fun with MATLAB or Octave.  Extra credit if you solve partial differential equations in Fortran.  Python has libraries for everything.  I suspect that Python is the right way to go at the moment. 

Here's another highly regarded book:
https://www.amazon.com/Electronic-Principles-Albert-Malvino/dp/0028028333

 
The following users thanked this post: casterle

Offline casterleTopic starter

  • Regular Contributor
  • *
  • Posts: 129
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #10 on: December 13, 2020, 07:46:45 pm »
I learn more from labs than books.
I do as well.

You might look into Digilent's Real Analog coursework.  There are lectures, notes and labs.  They tend to use the AD2 but it's all the same.

I looked for something like this for the AD2 but didn't find it. Thanks for the link.

w2aew has some great videos as does Dave.  Look for Dave's Fundamental Fridays videos.

I blame Dave for my current interest in electronics. :)

Analog Devices also has a large series of course work which I expect is developed around the ADALM2000 but workable in any other environment.  It looks very interesting!

This, along with the scarcity of AD2s, led me to decide on the ADI device. I was downloading ADI coursework and prerequisites and as I recall, LTSpice was on the list.

Had the AD2 been readily available I probably would have gone that direction. But in the long run, I may be better off with the ADAML due to its open firmware (is that what you call FPGA code?).

I have no idea what's been written for it by others, but even if no one has turned the device into something entirely different, I'll bet I could learn FPGA coding with it as well.
 

Offline casterleTopic starter

  • Regular Contributor
  • *
  • Posts: 129
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #11 on: December 13, 2020, 08:00:06 pm »
Khan Academy has an Electrical Engineering curriculum in addition to the mathematics program for which they are world famous.

At some point, math becomes a stumbling block for most budding EEs.  Things just don't stay linear very long.  Once we throw in capacitors and inductors, the math gets heavy.  Khan Academy can help.  Or, skip it and let LTspice do the work.

I just looked at the EE classes at Kahn; I'm not sure how to think about the math. I've never been good at math, or at least never liked it enough to become good at it. Can I learn practical electronics without learning the math?

For example, when I was in nuke school in the Navy, we learned what was to me some steep math early on. This enabled us to understand the physics involved in nuclear reactors and their peripheral systems so we had a foundation upon which to build. Once that foundation was in place, we never had to think about the math again to progress. Can a tool like LTSpice substitute for the math in this case?
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #12 on: December 13, 2020, 08:37:16 pm »
Khan Academy has an Electrical Engineering curriculum in addition to the mathematics program for which they are world famous.

At some point, math becomes a stumbling block for most budding EEs.  Things just don't stay linear very long.  Once we throw in capacitors and inductors, the math gets heavy.  Khan Academy can help.  Or, skip it and let LTspice do the work.

I just looked at the EE classes at Kahn; I'm not sure how to think about the math. I've never been good at math, or at least never liked it enough to become good at it. Can I learn practical electronics without learning the math?

For example, when I was in nuke school in the Navy, we learned what was to me some steep math early on. This enabled us to understand the physics involved in nuclear reactors and their peripheral systems so we had a foundation upon which to build. Once that foundation was in place, we never had to think about the math again to progress. Can a tool like LTSpice substitute for the math in this case?

At the hobby level there are a lot of equations just handed out without derivation.  Plug and crunch as my grandson would say.

Nobody is good at math unless they do it every day.  LTspice is certainly a help as is MATLAB with Simulink and any of a bunch of programs.  There are other tools that can be discussed as the need arises.  wxMaxima comes to mind.

It seems reasonable to expect everybody to be able to solve simultaneous equations because you can't get far with Kirchhoff or Thevenin without solving them.  But they are usually sparse matrices and can be solved with row elimination.  Google for it!

A little algebra like Vout=Vin(1-e-t/Tau) where Tau is the time constant equal to R in Ohms times C in Farads, will come up early on with capacitors and some form of scientific calculator will be a help.  See the blue trace in the attached.  I'm pretty sure this is the time domain project with my favorite 0.1 ufd capacitor and 10k resistor.

It really depends on how far you want to go with the topic.  One way is to just learn what you need to know when you need to know it.

I think one of the reasons I like lab experiments it that they reinforce a rather obscure concept like the capacitor charging circuit.  Note that in 6*Tau the blue trace in the first attachment has just about reached the maximum.  You can also write a quick little program to solve that equation for various values of 't' and plot the results.  MATLAB or Octave is your friend:
Code: [Select]
V0 = 1; % assume a supply voltage
R = 10000; %10k Ohms
C = 0.1*10^-6; % 0.1 ufd
Tau = R*C;
t = linspace(0,8*Tau);
Vchg = V0 * (1 - exp((-t/Tau)));
Vdis = V0 * (exp((-t/Tau)));
plot(t, Vchg)
grid on
hold on
plot(t,Vdis)
ylabel("Voltage")
xlabel("Time - seconds")
%there is a known bug in 'legend', the [h,~] is a kludge to work around it
[h,~]=legend("Charge Voltage","Discharge Voltage");
figure(gcf) % or shg command - pull plot to top
for Tau = 0:6
    pct_charge = V0 * (1 - exp((-Tau))); %percent charge
    t1 = -log((1-pct_charge)); % my version
    t2 = log(1/(1-pct_charge));% book version
    fprintf("%% Tau = %.0f Percent Charge = %5.2f,\t t1 = %7.3f, t2 = %7.3f\n", ...
            Tau, 100*pct_charge,t1,t2)
end

% output

% Tau = 0 Percent Charge =  0.00, t1 =  -0.000, t2 =   0.000
% Tau = 1 Percent Charge = 63.21, t1 =   1.000, t2 =   1.000
% Tau = 2 Percent Charge = 86.47, t1 =   2.000, t2 =   2.000
% Tau = 3 Percent Charge = 95.02, t1 =   3.000, t2 =   3.000
% Tau = 4 Percent Charge = 98.17, t1 =   4.000, t2 =   4.000
% Tau = 5 Percent Charge = 99.33, t1 =   5.000, t2 =   5.000
% Tau = 6 Percent Charge = 99.75, t1 =   6.000, t2 =   6.000

See second attachment.  The important part is that Tau=1 ms and the charge is 63.21%  Note especially that the X axis is time in seconds times 10-3.  In other words, milliseconds.  This notation was chosen by MATLAB and I didn't change it.

I think that this type of programming might be useful.


 
« Last Edit: December 13, 2020, 08:45:23 pm by rstofer »
 
The following users thanked this post: casterle

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #13 on: December 13, 2020, 09:00:37 pm »
Simulation...  It's not real, you know!

Here's the thing:  You should be able to look at a circuit, make a few rough calculations and get an understanding of what is happening.  You should have a pretty good idea what is going to happen before you do the experiment on the breadboard or in the simulator.  The breadboard will give you "real" answers.  They may be a bit off due to the effects of the breadboard itself but this won't be a worry at low frequencies.  If you built the circuit correctly, what you see is what you get.  Transistor Beta is a classic example:  The specs might say it's anywhere between 100 and 300 - that's kind of a big range and collector current versus base current will show the difference - dramatically.  BTW, that's why those differential scope inputs on the ADALM2000 are so important.  You need to measure base current by measuring the voltage drop across the base resistor and that's a differential measurement.  You might also want to measure collector current by measuring the voltage drop across the collector resistor.  Again, a differential input is helpful.  More on differential inputs later...

But the simulation could be all over the place.  The simulator correctly analyzes the circuit it sees but that might not be the circuit you intended.  How do you know?  And it will usually pick some arbitrary Beta which isn't at all like the transistor on your breadboard.  You can iterate over values of Beta I believe.  We could with the IBM Electronic Circuit Analysis Program I was using back in '70 or so.

Something else to think about:  Differential inputs come standard on the scope inputs of the ADALM2000 and AD2 (and AD).  People have to pay extra for differential probes for regular scopes and they aren't cheap!  Well, in the case of the AD2, they are differential right up until you use the BNC adapter board where the shell of the BNC gets connected to ground and the inputs are no longer differential.
 
The following users thanked this post: casterle

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #14 on: December 13, 2020, 09:51:02 pm »
I see where two of the experiments at the Analog Devices site are nearly identical to the plots I attached above:

https://wiki.analog.com/university/courses/electronics/rc_transient_response
https://wiki.analog.com/university/courses/electronics/lp_hp_filters

I think that anybody who works through the examples given at the site will have a darn good understanding of electronics:

https://wiki.analog.com/university/courses/electronics/labs

I like the Raspberry Pi and I like running my Analog Discovery 2 on the same Pi where I am generating signals like I2C and SPI that are headed to off-board devices.  I'm using the platform to debug signals generated on the platform itself.

Highly recommended kit:

https://www.amazon.com/Freenove-Raspberry-Processing-Tutorials-Components/dp/B06W54L7B5

I have a terminal window open to run the various experiments and the Waveforms application open to see the various signals.  The AD2 will decode SPI and I2C (plus UART and parallel) and this is quite handy.

Waveforms and the AD2 are not required for using the kit but they add a lot to the experiments.
« Last Edit: December 19, 2020, 06:35:01 pm by rstofer »
 

Offline casterleTopic starter

  • Regular Contributor
  • *
  • Posts: 129
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #15 on: December 13, 2020, 10:04:56 pm »
I think that this type of programming might be useful.

I think one of the reasons I like lab experiments...
Of course the EE's I worked with used MATLAB routinely, but given its price and my limited need I've never looked at it. A script-driven tool could be very useful. I'd never heard of wxMaxima or Octave before but I'm downloading them as I type. Here a link to an interactive tool that looks to be along the same lines: http://www.falstad.com/circuit/index.html

Experiments using real parts is important for a reason I'd never considered until a few weeks ago. I was watching one of Dave's videos in which he pointed out the importance of consulting the datasheet from the specific manufacturer of that part. I'd just assumed that all parts with the same number from all trustworthy manufacturers would work identically.

You should be able to look at a circuit, make a few rough calculations and get an understanding of what is happening. 
That's something I hope to learn to do. Thanks again!
 

Offline casterleTopic starter

  • Regular Contributor
  • *
  • Posts: 129
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #16 on: December 13, 2020, 10:17:38 pm »
I think that anybody who works through the examples given at the site will have a darn good understanding of electronics:
I'm looking forward to getting started.

I like the Raspberry Pi and I like running my Analog Discovery 2

I have a terminal window open to run the various experiments and the Waveforms application open to see the various signals. 
I ordered the ADALM2000 which has a different app, but I've got 3 monitors on my main workstation for a nice roomy layout.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #17 on: December 13, 2020, 10:25:33 pm »
That MATLAB program I posted above is known to work on Octave.  The X axis scale is different and I should thicken up the traces but, hey, it works unchanged.

For wxMaxima, here is a script that is known to work.  Use Cell->Evaluate All Cells to run the  script.

Code: [Select]
R:6.8*10^3$         /* 6.8k resistor            */
C:10*10^-6$         /* 10 microfarad capacitor  */

Tau:R*C;            /* time constant Tau=R*C    */
SixTau:6*Tau;
Vapplied:100$       /* applied voltage is 100 to make
                       % scale on graph         */
                    /* equation for Vout(t)     */
Vout(t):=Vapplied*(1-%e^(-(t/Tau)))$
t(tau):= tau * Tau$ /* graph x axis is in units of Tau
                       convert to units of t for calculation */
plot2d([Vout(t(x))], [x,0,6], [y,0,Vapplied],
 [xlabel,"Tau" ],[ylabel,"% Charge"],
 [gnuplot_postamble, "set grid;
 set title 'Capacitor Voltage';"])$


The syntax of wxMaxima is a little odd, at first, but you get used to it.  Look at the 2d attachment.
« Last Edit: December 13, 2020, 10:28:08 pm by rstofer »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #18 on: December 13, 2020, 10:40:24 pm »
The Home License for MATLAB is $149 and the add-ons like Simulink are $45.  I hesitate to use the word 'just'.  These are perpetual licenses but there is an annual subscription fee of about 50% if you want to keep up with releases.

https://www.mathworks.com/products/matlab-home.html

Where my grandson attends university, MATLAB is a required subject in the first semester.  They use it for everything in all of the STEM programs.  I really wish such tools had been available when I was in school about 50 years ago.  Some concepts just can't be visualized on a slide rule.

Until you come up with a need for SimuLink which requires MATLAB, I would think you could get along quite nicely with Octave.  Free is good!

But I'm not going to give up MATLAB!
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #19 on: December 13, 2020, 11:45:48 pm »
Here is an interesting thread on mesh analysis of an AC circuit.  Lots of imaginary numbers demoted by %i.  Pay attention to orolo's replies.  He really gets the math.

https://www.eevblog.com/forum/beginners/mesh-analysis/

I have a wxMaxima solution at the very end.  Pretty clean considering everything.

https://www.eevblog.com/forum/beginners/mesh-analysis/150/

This isn't a 'day one' problem but it does show the utility of wxMaxima in solving a large set of equations.

 

Offline casterleTopic starter

  • Regular Contributor
  • *
  • Posts: 129
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #20 on: December 14, 2020, 03:45:34 am »
The thread on mesh analysis, or anything else involving imaginary numbers, is something I am not ready for. As far as MATLAB goes, last time I looked they only had student and standard licenses. But since GNU has provided Octave I need not worry.

Perhaps my attitude will change, but I see math more as a necessary evil and less as an enjoyable challenge.  :)
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #21 on: December 14, 2020, 05:14:18 am »
The thread on mesh analysis, or anything else involving imaginary numbers, is something I am not ready for.
You won't run into this kind of thing until you start working with AC circuit analysis and that will be a while.  The need for complex numbers comes about when dealing with phase shift.  Look at that Bode' plot I posted above.  The bottom trace is the phase shift and it's 45 degrees at the -3dB point.  Much later on you will run across why this is true but, for now, it's only a curiosity.  Don't give it a moment's thought.  I just wanted to post a decent wxMaxima example that the entire group played with a while back.
Quote
As far as MATLAB goes, last time I looked they only had student and standard licenses. But since GNU has provided Octave I need not worry.
I posted a link above for the Home License of MATLAB.  There is no reason to go there until you want to start using SimuLink.  Octave will do the job just fine.  There is a book related to MATLAB and Electronics that might be useful at some point.  It should work with Octave:

http://ee.hacettepe.edu.tr/~solen/Matlab/MatLab/Matlab%20-%20Electronics%20and%20Circuit%20Analysis%20using%20Matlab.pdf

Quote
Perhaps my attitude will change, but I see math more as a necessary evil and less as an enjoyable challenge.  :)

I enjoy playing with the tools.  I remember struggling with this stuff back in the early '70s where we had no tools other than a slide rule.  It would have been much less of a struggle with modern tools.  Today's students don't realize how good they have it.

Nobody likes the math and, for the hobbyist, not all that much is actually required.  Those textbook problems, like Simon's Mesh Analysis above, seldom come up in the hobby world.  They are problems designed to make things more difficult.  "The Art of Electronics" has, as its claim to fame, a limited math approach to electronics.  That's why so many hobbyists like the book and its companions.

I hated the math in school.  I gave up completely on analog circuits and spent my time concentrating on digital.  "Every idiot can count to 1" - Bob Widlar (very famous analog engineer at National Semiconductor)

« Last Edit: December 14, 2020, 05:16:18 am by rstofer »
 

Offline casterleTopic starter

  • Regular Contributor
  • *
  • Posts: 129
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #22 on: December 14, 2020, 07:53:12 pm »
The need for complex numbers...
Good. I never understood 'imaginary' numbers and with luck that won't change.  :)

There is a book related to MATLAB and Electronics that might be useful at some point.
Thank you. A quick glance led to a surprise - matrices. I started to realize the power of matrix math watching a video in which it was used. I have no idea how it works, but I'm far more interested in this than in complex numbers with their mysterious imaginary friends. Do I need to understand matrices *before* MATLAB will be of use?

I enjoy playing with the tools.  I remember struggling with this stuff back in the early '70s where we had no tools other than a slide rule.  It would have been much less of a struggle with modern tools.  Today's students don't realize how good they have it.
Given what you've shown me WRT MATLAB, perhaps my attitude is already getting better.

I, too, enjoy tools. I remember when Lotus 123 first came out - I had absolutely no use for a spreadsheet (or so I thought), but it fascinated me and I played with it for probably hundreds of hours, to the point that I made some good money as a consultant.

Nobody likes the math and, for the hobbyist, not all that much is actually required.  Those textbook problems, like Simon's Mesh Analysis above, seldom come up in the hobby world.  They are problems designed to make things more difficult.  "The Art of Electronics" has, as its claim to fame, a limited math approach to electronics.  That's why so many hobbyists like the book and its companions.

I hated the math in school.  I gave up completely on analog circuits and spent my time concentrating on digital.  "Every idiot can count to 1" - Bob Widlar (very famous analog engineer at National Semiconductor)

I have avoided analog electronics for the same reasons as you. It was Dave and other generous teachers on YouTube that motivated me to try again. Others have recommended "The Art of Electronics", but you're the first I recall mentioning the limited math - time to take a look!
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #23 on: December 14, 2020, 10:08:16 pm »
MATLAB -> MATrix LABratory  -- of course it uses matrices!  Even a simple variable is treated as a 1x1 array.

No, MATLAB isn't just for matrix math, you can even do a bunch of calculations from the command window.  Values that you set are saved in the Workspace window.  So, you can define variables and save/change their values and chain as many commands as necessary to calculate some result.  But you really don't want to do that for anything other than the most trivial calculation.

You really want to create a script because, when it doesn't work, you can edit just the offending lines of code and run again.  Using the command line, you may need to reiterate several steps to get intermediate values before getting the final solution.

A long time ago ('88), I was involved with the design of a semiconductor plant.  I wanted to verify pipe sizing on the Deionized Water branch and return lines by assuming certain flows to drain (water leaving the system) and certain flows to return.  Water must remain above 100 fpm in all pipes and so on.  This is across the entire production floor, in all the aisles.  Hundreds and hundreds of feet of pipe and I have forgotten how many branches but it seemed like a lot.

I modeled the system in Excel and got it to balance in two iterations.  I don't recall how I did it but I'm guessing "Method of Residuals" that was taught in grad school for heat transfer from a hot spot.  All part of a required Numerical Analysis course.

In any event, it worked, the flows were correct, the return pipe was necessarily smaller than the supply pipe and so on.

In thinking about it today, it isn't unlike a bunch of parallel branches containing a series of resistors with an applied voltage and solving for currents (flow rate).  I didn't think of that at the time...  The point is, Excel was a matrix and this was a matrix problem.  Each cell was an element of a much larger matrix.

You just never know when these tools will be exactly the thing you need.  Of course, things were a little more limited 30 years ago.

One thing that comes up in MATLAB is creating a matrix where one wouldn't think.  Consider plotting a sine wave:  All we need is a series of points to plot as a function of x: y=sin(x).  So, I give sin a value for x and it returns the sin(x).  If I give it a bunch of values, I get the results that should be a sine wave.

MATLAB just about forces you to make x a vector of values, as many points as you want in the result.  Then sin(vector x) returns a similar vector of sin(x) values and we plot the vector x and y for as many points as are in the original x vector.  In Fortran, we would step through a bunch of values, in MATLAB, the values are already in the x vector.  C would also be step by step and C++ would hide everything in a class.

Here is a little sine wave example.  Note how few lines of code are required and how the fact that x and y are vectors doesn't even come up.  That single statement y=sin(x) is magic!  In one line of code we took values of x, all 101 of them, took the sin of x and stuffed the values in the y vector - all 101 values.

Don't let vectors and matrices be some kind of bug-a-boo.  They are a natural way of expressing certain operations.

If you get into Kirchhoff's Laws, you will be doing matrix arithmetic to solve several equations in several unknowns.  You can solve directly with MATLAB/Octave or by hand using row reduction.  Here's a video and there is a part 2 to go along with it.

https://youtu.be/9LYVi-n-6Jw

This stuff may be tedious but it isn't hard.

Code: [Select]
x=0:2*pi/100:2*pi;      % create vector x with values of 0 to 2*pi and
                        % 100 intervals - 101 elements
y=sin(x);               % create vector y with values y(x) = sin(x)
                        % 101 elements - computed in a blink of an eye
plot (x,y)              % plot the curve
ylabel('Sine Function') % label the Y axis
title('SIN(x)')         % add a title
axis([0 2*pi -1.5 1.5]) % set the x and y axis limits
shg                     % show the graph
                        % notice how the x axis runs from 0 to about 2*pi
                        % and the y axis runs from -1.5 to +1.5

I forgot the output plot, now attached
« Last Edit: December 15, 2020, 03:34:25 pm by rstofer »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Old dog, new tricks - learning electronics
« Reply #24 on: December 14, 2020, 11:49:09 pm »
Where we're going with this stuff...

I created a little circuit with 2 voltage sources and 3 resistors.  We label the drawing with an assumed current flow direction.  We start at ground, go up through a battery (assume a voltage gain) and go through all the resistors from + to - as labeled.  These are all voltage losses.  The interesting resistor is R1 where both currents are flowing and the voltage is a function of both.  The sum of the gains and losses around a mesh is zero.  That's the basic point of Kirchhoff's Voltage Law.

You can see the Mesh1 and Mesh2 equations from Kirchhoff's Voltage Law in the code.  Define the 2 meshes, set up the matrices and solve.  Print the results!  That's about all there is to it.

Code: [Select]
syms I1 I2
Mesh1 = 28 - 4*I1 - 2*I1 - 2*I2 == 0;
Mesh2 =  7 - 1*I2 - 2*I2 - 2*I1 == 0;

[A,B] = equationsToMatrix([Mesh1, Mesh2],[I1, I2]);
X = linsolve(A,B);

fprintf('%s %6.3f %s\n','I1', X(1), 'Amps',  ...
                        'I2', X(2), 'Amps');

% results
% I1  5.000 Amps
% I2 -1.000 Amps  The assumed CCW current flow is wrong,
%                 the current is actually flowing into V2

Notice that I2 is negative.  This means that my assumed current flow direction is wrong and the battery is actually being charged from V1 at a rate of 1A.  It's ok to make an error in direction, the sign of the result will fix everything.  The trick is:  if the current passes through a resistor from + to -, it will result in a voltage drop.  Looking at just I1, starting at ground, we have a gain of 28V, a loss of 4 Ohms * I1, a loss of 2 Ohms * I1 and a loss of 2 Ohms times I2 (both currents pass through R1 and the voltage drop is R1 * (I1 + I2).

Keep this post in mind when you get into Ohm's Law and  Kirchhoff's Laws.  You absolutely need Kirchhoff's Laws, you can't even begin to discuss op amps without Kirchhoff's Current Law (KCL).
I have also attached the LTspice file.

« Last Edit: December 15, 2020, 12:13:59 am by rstofer »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf