Wednesday, October 23, 2024

Practical Goal: Why is this working?

Not wanting to ever have to do anything by hand, I searched for hours for a way to avoid drawing a circuit diagram.  I came across all kinds of options, and was >>>this close<<< to finding out how to actually simulate an Arduino board in Matlab.  I finally gave up, though, head hung in shame.  I did, however, install all these add-ons, which somehow contributed in one way or another!

  • Simulink
  • Simscape
  • Simulink support package for Arduino hardware (I have high hopes for this one day!)
  • Simscape electrical

I did, however, manage to at least figure out how to draw circuits in Simscape, an add-on to Matlab.  (No, this should not have taken me the better part of a work day, but that's what we do...)

Between Google and reaching far back into memory, I finally was able to tell myself the story of the little LED that blinked:

There are three main components on our breadboard:

  1. The LED (Light Emitting Diode) has two legs: the anode (longer, positive leg) and cathode (shorter, negative leg).  The word diode means that current can only flow in one direction, so if you put it in “backwards” the current can’t travel through the circuit.  For current to travel through a diode, it has to go into the positive side and out the negative side.
  2. The wires move the current around the circuit.
  3. The resistor reduces the current so the LED doesn’t burn out.

The Arduino sends a signal to the LED (through the resistor so it doesn’t burn it out) via the pin #13.  That is, the Arduino turns “on” pin 13, and then it goes into the positive leg of the LED.  Because I’m a crazy person, I wanted the current to go through the resistor “first” so it gets stepped down before going into the LED.  Clearly this is entirely unnecessary because that’s not how circuits work, but it makes my brain happy. (In the manual example, the resistor came after the diode.  Also, I couldn't figure out how to change the text from 1 to 13.)

So in my imaginary world where this isn’t all happening instantaneously, the current goes through the resistor (so it gets stepped down) and then it goes into the positive leg of the LED.  This powers on the light.  The current continues to ground (which is basically the “zero reference point” for the circuit).  From ground, it goes back to the Arduino into the pin that is also marked GND for ground.


In our physical model, there is also a (yellow) wire going from the 5V pin from the Arduino to the breadboard, but it doesn't seem to have any impact on the functionality of the system, so I'm not entirely sure why it's there.

No comments:

Post a Comment

Nooooo, don't make me reflect on my learning!

 ... I just want to stick wires in breadboards and make froggies dance!!! Okay, but seriously, that stupid dancing frog was clearly my most ...