I have successfully completed projects 01 and 02 in the starter kit (phew!) but am trying to get my head around the circuit for project 02, the starship interface.
No problems with the coding aspect of it. I spent all my working life as a software engineer using very similar languages so that bit is fine.
But I would like to understand a bit better why the resistors in this project are placed where they are. My takeaway from project 01 was that a 220 ohms resistor needed to be placed at the start of the circuit to achieve a current of 23 mA as that was the maximum that could be safely used with these LEDs. But in this project the 220 ohms resistors are placed between the LED output and ground. Why are the resistors after the LED in the circuit not before?
If the resistors that you are referring to are being used to limit the current through an LED then it does not matter where they are positioned in the circuit as long as they are in series with the LED
Do not think of them being placed before or after the LEDs as long as the current through the LED also passes through the resistor
It sounds like you would benefit from brushing up on Ohms law
In a series circuit, the current is the same at every point because there is only one path for the current to flow. Therefore, it does not matter if the resistor is placed before or after the LED; the same current passes through both components. The voltage drops will distribute according to each component's resistance or characteristics, but the current remains constant throughout the series.
In the schematic above, R2/D1 and D4/R5 are as you say.
As mentioned, as long as the LED and Resistor are wired in series, current must be the same thru these components.
There may be an argument the resistor should be connected closest to the 5v pin as LEDs are usually mounted at a distance (example on the front panel of a case).
Since the resistor would be at the Arduino, maybe 8 inches from the LED,
If we accidentally shorted the wire at the LED to GND (0V), the resistor back at the Arduino limits the short circuit current.
It seems you might not be fully ready to start the project just yet, but that’s perfectly okay! We don't know your skill set or what resources you have at your disposal, so I recommend starting with some online tutorials. While the quality varies, many tutorials are excellent and will help you build a solid foundation.
Here’s How to Get Started:
Learn the Basics: Begin with the fundamentals, such as controlling outputs (like LEDs) and interpreting inputs (such as reading a switch or receiving a message). It appears you are on track with this. LEDs are a great starting point since they’re inexpensive and most Arduino boards come with a built-in LED.
Explore Basic Electronics Tutorials: Look for beginner-friendly tutorials on electronics concepts. These will help you understand key principles that you’ll need as you progress.
Recommended Resources:
Arduino Cookbook: Consider going through the Arduino Cookbook, which is a comprehensive guide filled with practical projects and step-by-step instructions.
Online Tutorials: Check out YouTube channels like CodeBeauty for easy-to-understand lessons presented in small, digestible parts.
Electronics Cookbook: Practical Electronic Recipes with Arduino and Raspberry Pi
Learning the IDE: During this process, you will also learn what an IDE (Integrated Development Environment) is and how to use it to write, generate, and upload your code to the Arduino.
Practice and Learn at Your Own Pace: Everyone learns at different speeds, and that’s completely normal. It may take a few months to grasp the basics, but with consistent practice, you’ll see progress.
Thank you, that is good to know. I read the brief introduction to Ohm's law in the Starter Kit project book but I had not grasped that the current would be the same everywhere in the circuit, so long as it is in series.
Thank you to everyone who has taken the trouble to reply. Your answers are very helpful and it is reassuring to someone just starting this journey to find so much support on here.
I will definitely be checking out some of those other resources mentioned to get a firmer grasp on the background.