We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

CodeValue: Electronics 101 for software developers

00:00

Formal Metadata

Title
CodeValue: Electronics 101 for software developers
Title of Series
Number of Parts
133
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
These days it seems as if everybody talks about the internet of things (IoT). With a cheap Arduino, Raspberry PI (or another microcontroller) every developer has the power to control the real world. Suddenly confronted with resistors, digital inputs, analog interfaces and a weird bread board full of holes – a developer is reminded that the world of hardware can be confusing and sometimes downright frustrating. The good news is that an electrical engineering degree is not required in order to understand and build electronic circuits. In this talk we’ll cover the basic rules that govern the electronics world (and why they matter). We’ll talk about capacitors, resistors and other components and how to read circuit diagrams in order to understand how to use them.
36
61
Thumbnail
1:11:04
73
107
SoftwareSoftware developerSoftware testingWordComputerDean numberCodeSoftware testingSoftware developerOnline helpInformation technology consultingWritingBlogInternet der DingeVisualization (computer graphics)Unit testingMultiplication signMoment (mathematics)ComputerJSONXMLUMLComputer animation
Software developerPoint cloudMultiplication signCodeComputer hardwareRight angleProjective planeData miningSoftwareGoodness of fitMobile WebWeb 2.0Bit1 (number)Axiom of choiceCellular automatonComputerComputer animationDiagram
Software developerIntegrated development environmentControl flowComputerGame theoryProjective planeRight angleMeasurementComputer animation
Software developerOrder (biology)ComputerComplete metric spaceWater vaporMedical imagingElectric currentMultiplication signBitOcean currentDataflowPhysical systemFreewareVector potentialDifferent (Kate Ryan album)Exception handlingGradientChemical equationForcing (mathematics)Right angleComputer animation
Food energyExecution unitSoftware developerVoltmeterDigital electronicsPower (physics)ComputerDifferent (Kate Ryan album)Line (geometry)Vector potentialComputer hardwarePhysical systemComputer animation
Software developerElectric currentDigital electronicsOcean currentPhysical systemComputerSlide ruleRectangleLine (geometry)Single-precision floating-point formatDataflowSoftware development kitOpen setConnectivity (graph theory)Data storage deviceDemonSeries (mathematics)Cellular automatonComputer animation
Software developerLTI system theorySemiconductor memoryNumberInformation securityMessage passingGoodness of fitData storage deviceLine (geometry)PentagonTable (information)Data miningBlogPhysical systemCalculationForm (programming)Group actionDisk read-and-write headInternetworkingFilm editingProjective planeGraph coloringComputer animation
Software developerPhysical systemDigital electronicsMetreOcean currentMultiplication signComputerCASE <Informatik>WindowComputer animation
Software developerOcean currentComputerRule of inferenceMetropolitan area networkPhysical systemConnected spaceMultiplication signNumberForcing (mathematics)Disk read-and-write headoutputDigital electronicsCalculationPhysical lawField (computer science)Computer animation
Physical systemElectric currentCalculationPower (physics)Finitary relationBoom (sailing)Software developerMetropolitan area networkMultiplication signOcean currentSupercomputerPower (physics)Connectivity (graph theory)BitCalculationVoltmeterMaxima and minimaPhysical systemFood energyOrder (biology)Right angleSystem callNumberArmExistencePhysical law10 (number)MereologyComputer animation
Digital electronicsCivil engineeringOcean currentCellular automatonPhysical systemMereologyCalculationPoint (geometry)Digital electronicsPermutationPhysical lawDefault (computer science)Computer clusterDemosceneMaxima and minimaDistanceSeries (mathematics)Connected spaceBinary multiplierMultiplication signComputerPlanningVector potentialTotal S.A.Digital divideParallel portBitComputer animation
Software developerSoftwareMereologyPoint (geometry)TheoryMultiplication signOrder (biology)Different (Kate Ryan album)Computer hardwareTape driveElectronic program guideLevel (video gaming)PlanningComputer animation
Software developerDigital electronicsDataflowTouchscreenOrder (biology)VoltmeterOcean currentGraph coloringConnected spaceThermal conductivityMultiplication signE-bookProper mapDirection (geometry)Game controllerPhysical systemElectronic mailing listMeasurementDialectShape (magazine)
Component-based software engineeringSoftware developerLine (geometry)ComputerConnected spaceGoogolSocial classRight angleComputer animation
Software developerDigital electronicsVideo gameWhiteboardGraph coloringGoodness of fitLine (geometry)Connectivity (graph theory)Connected spaceInstance (computer science)Lie groupPhysical systemDiscrete element methodFilm editingProxy serverComputer animation
Software developerDivision (mathematics)WorkstationGoodness of fitPhysical systemMathematicsMountain passComputer clusterQuicksortPoint (geometry)Power (physics)Magnetic stripe cardDistanceLevel (video gaming)ExistencePlanningCalculationSeries (mathematics)Computer animation
Software developerComputer virus1 (number)Multiplication signDefault (computer science)DialectGreatest elementWordMetropolitan area network
Software developeroutputCASE <Informatik>Right angleBuildingOcean currentGraph coloringMultiplication signPhysical system
Software developerMeasurementElectric currentParallel portSeries (mathematics)Digital electronicsNumberKeyboard shortcutMaxima and minimaVideo gameBitMeasurementOcean currentParallel portPhysical systemResultantDataflowMedical imagingCASE <Informatik>Mountain passComputer animation
Software developerDigital electronicsCASE <Informatik>Ocean currentOrder (biology)Video gamePoint (geometry)BitWebsiteHydraulic jumpMultiplication signNoise (electronics)MicrocontrollerComputer animationEngineering drawing
Software developerLatent heatElectronic visual displayGoogolQuicksortShift registerTouch typingOrder (biology)outputPersonal identification numberMultiplication signDemo (music)Cellular automatonRoundness (object)HypermediaWhiteboardNumberField (computer science)Goodness of fitGroup actionProgram flowchart
Computer virusGame controllerSoftware developerWhiteboardTesselationWordPrototypeWindowProduct (business)Goodness of fitSoftware testingCellular automatonMereologyLevel (video gaming)Function (mathematics)VideoconferencingCausalityReading (process)Computer programming
Software developerDigital electronicsBitPhysical systemoutputPower (physics)WebsiteWindowFunction (mathematics)Digital libraryAnalog computerComputer animation
Function (mathematics)outputDigital electronicsDigital libraryAnalog computerRun time (program lifecycle phase)Personal identification numberJava appletSource codeAnalog computerPhysical systemoutputMeasurementDigital electronicsCodeDigital libraryExtension (kinesiology)WritingComputer configurationImpulse responseFunction (mathematics)Multiplication signDemosceneProcess (computing)Computer animation
Analog computerDigital electronicsCASE <Informatik>Multiplication signGoodness of fitVoltmeterAnalog computerVariety (linguistics)Digital electronicsBoolean algebraRoundingMaxima and minimaWindowRow (database)NumberVotingMeasurementComputer animation
Software developeroutputGraph coloringForm (programming)Game theoryNumberQuicksortPower (physics)Function (mathematics)ComputerPoint (geometry)PlastikkarteMathematicsRange (statistics)AreaSoftwarePhysical systemSpacetimeGreatest elementMultiplication signVector potentialDigital electronicsDrop (liquid)Analog computerComputer hardwareComputerVideo gameCodePersonal identification numberComputer programming
Software developerSeries (mathematics)MeasurementOrder (biology)Shape (magazine)ExistencePhysical systemCASE <Informatik>Cellular automatonSpecial unitary groupSystem callComputer animation
Software developerDigital electronicsMaxima and minimaPower (physics)Emoticon1 (number)Digital electronicsRight anglePower (physics)Metropolitan area networkCASE <Informatik>Physical systemComputer animation
Software developerGoogolBuildingPlanningComputerConnectivity (graph theory)Musical ensembleDataflowGoogolDiffuser (automotive)Key (cryptography)Field (computer science)Projective planeDisk read-and-write headWebsite40 (number)Power (physics)CASE <Informatik>Software development kitComputer animation
Software developerSoftwareDigital electronicsPhysical systemMultimediaDigital electronicsGroup actionComputerForm (programming)Right angleCartesian coordinate systemBuildingConnectivity (graph theory)WhiteboardReal numberComputer animation
Letterpress printingCodeE-bookSoftware developerSimulationInternetworkingGoodness of fitCodeInternet der DingeWebsiteComputerIdentity management
Stack (abstract data type)Software developerProjective planeConnectivity (graph theory)WeightBuffer overflowDataflowInformationWindowRevision controlTotal S.A.1 (number)Stack (abstract data type)WebsiteContent (media)NumberOrder (biology)Key (cryptography)ComputerSoftwareOcean currentComputer animation
Software developerCodeBlogReal numberWater vaporType theoryRight anglePower (physics)PlanningPhysical systemEvent horizonInformation securityProduct (business)Software developerWebsiteWeightPrototypeTwitterSpecial unitary groupComputer animation
Transcript: English(auto-generated)
Hello, how do you do? Last session of the day, the end of NDC. Thank you for attending. I know it's hard, you know, sitting for three days of courses, of lectures, can be tearing.
So we have a fun thing for the end. We're going to play a bit with electronics, which I enjoy. Now, a few words about me. My name is Dror Helper. I'm a consultant. I specialize in clean code, actually. I work with developers about how to write unit tests and work with TDD and write clean code
with a consultancy which is called CodeValue. Because I don't have enough, I have too much free time, I guess, on my hands, I'm also the evangelist for a tool called Ozcode. That's a little wizard. Ozcode is a debugging tool for Visual Studio.
I urge you to try it out. It will save you time. Now, you must be wondering how come I'm talking about electronics. So, 20 years or so ago, I finished school and I learned electronics. And when this whole IoT thing came around, I was so happy because I get to use that diploma I got back then
and actually play with things that I enjoyed back then and I really, I'm starting to understand some of the tests I had in a completely different light. I also have a blog in blog.drorhelper.com in which I write of anything I find interesting at the moment, usually programming stuff, but, you know, check it out.
So, question. How many developers do you need to change a light bulb? Anyone? Who said that? Here you go.
Ah, good catch. Yes, it's a hardware problem. Exactly. And we all know this joke and it's funny, nevertheless. Anyone know why it's funny? Because it's true. Yes, exactly. But we're getting ahead of ourselves, but you're right. I've been to this hackathon with a friend of mine. He's a very talented developer.
He's written software for mobile, desktop, web, and cloud. And we had this project we tried to get up and he was sitting, hacking away, writing a bunch of code and I told him, why don't you, you know, connect a few bits, come and, you know, try to put the Raspberry Pi
and connect it to a few sensors and he said, no, no, you do that. I'm not touching that one. And it made me think. This talented developer didn't want anything to do with the hardware because, you know what, it's a messy world, the hardware. It doesn't work as cleanly as software. And it seems very difficult, although, hopefully, in an hour time you understand
that it's actually very simple. Now, why should you care about electronics? The way I see it, you don't really have a choice. We are surrounded by it. There are sensors all over the place, measuring the temperature in the room, the humidity of my plants. I have a watch now, personally,
by the guests, at least a few people in the crowd, have a watch that measure how well they slept at night, right? And all of that is connected to some place out there. And you know what? You should get on this game. And home automation is a good project to start with.
I saw many home automation that started as those simple thing. And it's easy, again. But first of all, before we start with actually connecting stuff, let's talk about the theory behind electronics. I like this picture. Electronics and water, two things that don't go together,
but can be explained in the same way. Usually, this is like the go-to image that, not this particular image, but the whole water thing when explaining about electric current. Why is that? Imagine that I have this pipe filled with water,
and well, I have some edges on the side so it won't spill, and I'm holding it in a complete balanced way. Nothing would happen, nothing interesting, right? What should I do in order to get something interesting to happen, a spill on the floor? I need to raise one end, right? So basically, I need to do that. Just raise one end, the water come rushing out.
Basically, similar to electronics, because in electronics, we have three things we care about. The first one is voltage, which we usually see when we go abroad to a conference and want to check that the voltage won't fry my computer, right?
Is it 220, 110, etc. Voltage is exactly what we did with the pipe, is raising the pipe, doing something to the system in order to take it off balance. We'll talk about that. Now, if voltage is taking the system off balance, then the water flow is the current. And if those two here,
there's only a third one we won't care to talk about, which is the resistance, which can roughly be explained as how wide the pipe is. If I have another pipe, I'll get less water in the same amount of time. If I have a bigger pipe, I'll get more water.
Now, don't worry. It is as simple as that, by the way, but there's a bit more to it. So, basically, we start with voltage. Voltage essentially is the electric potential. Now, when I heard that back then in the 11th grade, I didn't really understand what electric potential actually means.
Well, basically, what it means is the difference between one end of this battery or my power source and the other end. The difference being electrons minus charge. I have many electrons on one side of the battery, and if I connect it to the other side, they'll come running around. Actually, it's going to run around this end,
but we'll talk about that. When looking, how many people here read or saw electrical circuit schemas? You know, those lines are nice. All of you will see it by the end of this talk. Don't worry. So, voltage, if it's a battery or power source, we usually draw like that, the long line being the plus side
and the short line being the minus side. When we play with electric circuit, especially when you get into the Raspberry Pi and things like that, it could show like this thing. We have some voltage in, and we have the three lines, which is ground, essentially a dev null of hardware.
Here's a concept. It's not completely true because, actually, what actually flows the movement of the electrons in my system, the current goes the other way around. They go from the minus to the plus, not from the plus to the minus. Current is the flow of the electrons.
This is actually what makes the lights go on. And it goes from the minus, where I have a lot of electrons, to the plus, where I don't have that many. But for simplicity's sake, we imagine as if it goes from the plus to the minus, just because we humans are wired that way.
It's measured in amperes with the letter A. Usually you don't want many of those in your system because you'll get to see smoke when your component will do poof and die. Lastly, we have resistance,
which, as a teenage kid, I didn't really understand why I needed for. Resistance is how difficult it is for those electrons to pass through my system. Every single material out there has some resistance. There's the superconductor thing, but apart from that, which you probably won't connect to Arduino, apart from that,
every single wire or breadboard or whatever has some resistance. For the sake of our simple circuits, we don't care about it because it's very small. And then we want to use those guys. Those are the resistors, which is us adding artificial resistance to the system.
They look like this rectangle or the jagged lines. And in the real world, they look like this frightening thing, this blob with lines on top of it, right? Now, there are... Yeah, here you go. Just pass that around. This is a good example.
Open it. This is a resistor kit. Tell you the truth, I don't recommend it. It's a good place to start, but it costs a lot more than just buying the components by yourself. But it has a nice legend on the back and inside that shows the various resistors and resistance you have.
But you don't need that for two reasons. First one being the next slide. You can read and decide the resistance. Although, as I get old and my eyesight is not as good as it was, it's hard to see those colors. The brown is very similar to the orange and the red. It's not that clear-cut.
Who knows how to read those? You know, I believe I once knew, but I needed to refresh my memory because it's very frightening. In this table, you'll see it on the back of what I'm passing. Usually, if you buy or look in the Internet, you'll get one of those that show the same thing.
And basically, it's very simple. Every resistor has either four lines on it, five lines, or six lines. The first group of lines, either three or four, depending if we're talking about four or five lines, are the actual resistance.
The last two are how off the resistor can be from what I expect it to be. So basically, if you look at the top one, I have two reds, right? So red, I can see in the table, is the number two, right? So far, so good? This is the hardest thing you need to remember,
and you don't need to remember it, so no problem. So we have two and two. It's 22. It's not four. We're not doing any calculation yet. So it's two and two, and then I get brown. Brown is 10. So I multiply the 22 in 10 and get a 220-ohm resistor.
This is the resistance of that guy. He has a gold line, so plus minus five. If you buy a good resistor, you have lower tolerance. The lower the tolerance, the better resistor it is. If you go to the higher-end resistor, you have very low tolerance.
If you buy them, like I do, online from some shady unknown place, it might have a very high tolerance. And that's okay. For some projects, that's good enough. I'm not trying to build a security door for the Pentagon or something like that. I'm just, you know, connecting a few things.
Another thing to know about the cheap and expensive resistor, the cheap one is usually the legs are thinner. It's basically this blob with two legs that you need to connect inside your system. If you get thin legs, you won't be able to do that. They'll just bend when you push them in. And that's very frustrating, I'll tell you that.
So back to, let's do another one. So I have yellow. Yellow being? Four. And purple, seven. And I multiply it by 100. So I get 4700, as we use that in the industry. 4.7 thousand.
Because we like the K and the M's when talking about resistors and voltage. So I get this one. That's 4.7 K ohm resistor. Let's try another one. One plus ten. That's ten. One plus zero is ten. Times 100.
So that's a thousand. One K resistor. That's a useful one to remember. But you don't have to remember those. Basically what I did, I have a bunch of little drawers at home and I just keep them organized so I know which is where. So I don't need to overdo that all the time. It's very small, very hard to see.
And lastly, three and three times ten K. Ten thousand is obviously 330,000 K resistor. That's a very big one. Usually you don't really get to use those. So that's resistors and voltage and current. And together we get a circuit
because if you don't connect a circuit, if I have somewhere that the circuit is not connected, those electrons won't be able to run around. Usually when you connect something in an Arduino, nothing lights up, nothing goes over, you probably have a disconnection somewhere. And the rule that governed those three forces is called Ohm Law.
Have you ever heard about Ohm Law? Wow. A lot more than I expected, so I'll be brief. Basically current times resistance equal to voltage. It's a very useful thing to remember because I can play around with it. As a wise man said, a three-year-old can understand it,
not someone bring me a three-year-old. I can make heads or tails out of it. But it's a very simple rule. And I can play around with it. And basically I can even see it in my eyes. Here you go. This is the first simple experiment I've used. Three is different.
And I want you to play around with it, so I colored the inputs that you can touch with this side and then you get to see the lights go on. And the light will have different intensity because I have three different resistors. And if you really want to try and implement the knowledge you just got,
you can try and read the numbers on them. Here you go. Pass it around. So basically, this thing just decide for me this simple calculation, how much current or resistance I need in my system.
And it's very useful. Why is it useful? Because if I have too much current in my system, the system will go poof. I'll see small smoke and the component will not work anymore because I just burned it. So usually what I need to calculate is the current. I have a voltage and I have the resistors I just put in. I want to calculate the current.
Or if you're like me, post-mortem, you try to understand why the hell you just burned an RGB LED. This is what I did. And then I went over and discovered I just put too much current into it. Happens. So basically the current is what I care about. So if I know the resistance and I know the voltage, I decide here we have four batteries or one and a half volts,
so it means six volts in. So I need to put the right resistance in in order to get for the lights not to burn. And it happens from time to time. And nothing to worry about, by the way. Those are very cheap components. Buy a bunch of them and play with it.
The same goes here. I know that I have a 12-volt system and I want this current. And I'll explain why especially this current. Not the number, but a specific current I care about. It means I need a resistor of. Who can do that as fast as the... You have calculators called forms, but...
500-ohm resistor will give me that current with this voltage. All I have to do is take the voltage 12, divide it by 0.024, and I get 500. Half a kilo-ohm resistor. It's just playing with those three things. I times R equals V.
V divided by R equals I. And playing around with those is how we get... This is as complicated as it gets with direct current. Now, why do I care about the current? Because of another simple law.
This is power. Power is how much energy I can pass through my system. Basically, it's the current times the voltage. With Ohm's law, I can play with those. Because if the current times the voltage equals the power, it means that the current being the voltage divided by the resistance.
So, and this is... I know it's hard. It's five after noon. It means that the voltage squared divided by R will give me the power as well. And I can play with those. And why do I care about the power? Because if you take components or look in their specification,
you won't always see the maximum amount of current that's allowed to be there. You'll see the volts. You'll see how much power there can handle. And you need to make sure that you're not putting more power than that. Because if you'll do that, then, as another wise man said, she won't be able to take it.
And you get to see smoke and smell... Usually, you smell smoke. It's not a little fire that happens there. It usually does a small, cute, burning sound, and then you smell smoke, and then you understand that you can take the component out to the bin and find another one. And it happens, and that's okay.
Again, those are cheap components. Try not to burn the Raspberry Pi or something like that. Those cost a bit more, but also in the tens. We're not talking about a supercomputer that costs millions. Now we get to another semi-hard part.
Don't worry about the calculation on the side. Those are for complete sake. I'll explain. There are two ways to connect components together. And all the permutation between them. But essentially, two ways. I can connect them in parallel. This is two resistors in parallel to one another. R1 and R2 are connected in parallel,
which, if you remember, the voltage is the potential between two points, so they have the same voltage. When I connect system in parallel, I get the same voltage throughout the system because it's the same two points throughout the system, right? However, the current works a bit differently because the current going back to the water, or if you like, a car,
goes all the way here and gets to a fork in the road. And now some of the current will go down, and some will continue. How much current? Well, you can calculate it on your own because basically it's taking the voltage and dividing it by the resistance, and you get the current in that specific part of the system.
Now, this is basically playing around with Ohm's Law just to get the total current in the system. Don't worry about it. I'm sure that if you take some time off and think about it, you'll see it's a very simple calculation playing with that.
Basically, all I did is calculate the total resistance in the system, and because we are in parallel, it's not adding the two resistors. That's it. It's this thing. And then I just divide it. Voltage divided by resistance equals current. That's it.
Again, why do I care? So I don't get to burn anything. This is the parallel circuit. Now, the reason I'm telling you about it is for one simple reason. When you get to connect components together or measure them, and you want the voltage to be the same throughout the system, you connect it this way because it's the same voltage on all the resistors.
Although it seems very counterintuitive because we tend to think of voltage as something that we lose throughout the electron running there, but we don't, at least not until the battery runs out. So if this is parallel, this is series. Series is connecting one after the other.
Now, the voltage is divided because, again, those are two points, and now there's another point in the middle. This is a very useful circuit. I will show you how to use it. And the idea being that now the current is the same throughout the system because it got just one path to go to travel, but the voltage is not. And usually when I build this kind of circuit,
I care about only one of them, this voltage. I'll show you why. And the calculation playing with Ohm's law basically brings me to this part. If I want to know the voltage in this specific point, all I need to do is to divide it by the resistance in that point.
To multiply it in that resistance in that point, divide it by the total. Okay? It's just playing around with simple calculations. And you don't have to remember anything here by heart, first of all, because you'll get it. All of you work with computers enough
to open the calculator, and you can find calculators for that online, quite a few, because it's useful to know this voltage. We'll get to that. Okay. Now we're done with the theory part. Everybody's okay? Question. What's the difference between hardware and software?
Anyone? Yeah, software don't go poof, although I did, I'm... Software does go poof from time to time. No, no. You can kick hardware. That's the difference. The point being that once you connect those,
unlike our software, which we can rattle around and debug or whatever, if they'll fall or go with you on the plane, things might stop working. And that's why we try to be more gentle, at least at the prototyping stage, until I got a bunch of duct tape
in order to wrap everything around so nothing will move. But other than that, you need to be more careful. Now, basically, when talking about connecting stuff, we first talk about this guy, the LED. LED. LED not being a fancy screen. LED is a light-emitted diode.
Who knows light-emitted diode? Quite a few. So preaching to the choir. So you're already familiar with that guy? Probably because anyone who ever picked up electronic books of any kind, the first circuit you get is connecting that guy to the circuit and seeing it light up.
Basically, a diode is a component that allow current only in one direction, which is useful for certain things to balance what is known as AC, but not in our circuit. And a light-emitting diode is a diode that once the current go through, the light turns on. That's it.
And it comes in many shades and colors, and we can build cool things with that. And more than that, when I have problem in my circuit and nothing work and I don't have proper measuring tools, I just take one of those and try poking my system and see when it lights up and when not to see if I have this connection somewhere. Now, since it only allow flow in one direction,
that guy need to be connected in the correct order. The long leg should be facing the plus, where the... Well, you know now that the conduct come from that. Is that the way around? But for our sake, yes. The way that where the volt there comes in.
If you basically, if you ever connected one of those enough times or even on the first try, if you're really lucky, you'll get it the wrong way. And it won't light up, and then you pick it up, you turn it around like a USB. Same idea. Put that in, put that in. There are many kinds of such LEDs.
This one is the RGB LED, like the one I burned. Basically, it's not a LED. It's three LEDs. It has three different lights inside for three different colors. And according to the amount of current you put for each of them, you get a different color. Very nice to play around. It has only one long leg. That is the ground, the minus.
Unlike the regular LED, which is the other way around, to make it interesting. So you have to remember that. But don't worry. If you accidentally put that long on there, nothing bad will happen. Just won't light up. Because we disconnected the system, and then no current flows through it.
Now, the second thing we need is this guy, the solderless breadboard. Who's tried to play with it a bit? Wow. So, yeah. So we know everything now. Anyone ever opened the back of it? You know why I opened it? I also bought, I found online,
a transparent one as well, because I wanted to show you this. This is basically the magic, which is the breadboard. This is it. Those lines here. Basically, what the breadboard does is, you go, pass it around. What the breadboard does, actually does two things for me.
It holds my component in place. They won't fall off. And it also connects them. Because once I put it in, the same things on the same, let's call it a line, will be connected magically. Now, it's not magic, because if you look in the back, you'll see there's actually a wire going there. All the lines are the same thing. So basically, when I look in this Hello World kind of example,
this is anyone who ever wrote electronics in Google saw this one, right? Basically, I have the wires there that connect everything together. There are best practices to use that, although you don't have to follow them, but I found them to be useful. First of all,
when we're talking about the full-fledged breadboard or half breadboard, this one that passes around here, there are two lines going, let's say, horizontally, usually with plus and minuses or just color or not at all, depending where you bought it. And those lines usually are reserved, although it's up to you, for the plus and minus.
I'm doing that because it makes my life easier. It's easier to connect components when I have this long line with electricity run through it. And since, for our purposes, they have zero resistance, it's good enough. I'm not wasting anything for the current folder.
Usually, I will also connect it to the other side, so I'll get it from the other side as well. And that way, I don't get a mess of wires in my board. That way, I just connect them to the sides, and it's neat and clean, depending on how neat and clean you are. I'm not. You'll see that in a moment. And it's easy to follow the circuit.
Another thing I do is clip things. I clip, you know, you take a cutter, simple cutter, and you cut the end of the resistors so they'll be stuck and won't, you know, move around. Either that or you just push them to the side,
being very careful not to touch other wires on the way. Because if you do that, either your components will not work at all because you won't get the current the right way, or you get too much current, and then, again, poof. Now, when connecting, obviously, now everybody here probably understand it.
You can connect them diagonally or horizontally, you know, whatever you like, vertically, just not on the same line. Again, because you're essentially creating a bypass of your system, and it won't operate as you like. Another thing nice about the breadboard is the middle. The middle is this gap there.
It was put there on purpose, and usually what I do, I put the components over it, one leg in one side and the other leg in the other side because it's easier to see it and to play with them that way. And there are certain components that were built with that idea in mind.
Now, anyone know this guy? This is a special resistor. It's called the adjustable resistor. Yeah, I have one over here. You probably won't see it in the back. It looks like a little knob. The reason it looks like a knob is because it is.
All the older guys here in the room probably remember when we have radio with those, right, and you look for a station on your car. Basically, this is how they did that. I have this guy here, and when I turn it around, things change in my system, you know. The light will go on and off,
and there's a good reason for that, which I will explain in a minute. And the way to connect it is usually I'll take the plus sign, the plus wire connected to one end and the minus or the ground to the other side, and the middle one I'll connect to my system. Does it look familiar to anyone?
Did we see something of this sort in the distance past? Basically, what I'm doing here is I'm creating a series circuit, and by turning the knob, what we're actually doing, we're changing the resistance of those two resistors.
They'll change from zero or roughly zero because this is the real world. It's not some academic issue, and they change from zero to the amount that's written there. I think this one is 100,000 ohms. So by playing with it, I essentially change the voltage on the LED because, remember, the voltage change between them,
and once I change the voltage, because I'm connecting it in parallel, I'll change the current as well. And then you get more light or less light or dimmer. And then when you turn it around, the station will move because that's the way it works. I'm changing the voltage.
And connecting it is very easy. Burning it is even easier. I got two of them burned. I did that. I'm not really sure how because it's a resistor. Basically, it can do on its own, and it was very, very, very talented of me to be able to burn one of those,
but I managed. And basically, all you have to do is connect it, take the middle one, connect somewhere, and now that you know the calculation, you can actually know how much current going through your actual system because the whole point of this is to play with the current that's going in and out. Now, all of this is very nice,
and calculating is nice, and reading small stripes in a miniature resistor is roughly nice to whoever likes doing that sort of thing. But basically, one of the things I find most useful is this guy. Everybody knows that. Who owns a multimeter?
Am I explaining anything to you? Everybody here knows everything. Yeah, a multimeter. Do you know how to connect it? Have you played with it? Yeah, cool. Basically, it has two wires that come with it. I got the shitty ones. The reason I'm saying that is because the default ones usually come with those pointy things,
and I hate it because I have to use both my hands to put it on the circuit and hold them steady because it takes some time. This is a cheap one, relatively, so it takes some time and not that accurate. And basically, at the same time, I need to change the dial there.
At the same time, it doesn't really work. Basically, when I get to this guy, it has in the bottom, most of them in the bottom side on the side, have three holes here. The black, which is a minus, the negative goes in the middle. The red one will go either on the right side if we're using high current system,
which tends not to be the case if you're building things with Arduino or Raspberry Pi. And the right or the left side, if we're doing a simple 512-voltage thing. Now, if you get this mistake, you'll burn it.
But it's okay. It has a fuse inside that you can replace if you accidentally put too much current through it. But who never saw this thing before, ever? Okay, pass it back so they can check it out.
Then, basically, the way I go with it, when I use it, I can choose what I'm measuring, only one thing at a time. And I usually start high and get low slowly because, again, I can cause some damage if I do it the other way around. Now, the numbers are the maximum amount that it can measure.
And you'll know that because if you get a high number, you'll get rubbish. You won't see anything or you'll see a very, very, very small number. It has only four digits, I think, or three digits. It can't be too small. Or you see zero. And that's your cue to lower it a bit. Just take it down a notch, try again,
until you get the proper number. Now, when I measure resistance, which is in my case, in my multimeter, it's over here, and don't do it with the live circuit. You don't want to do it in the live circuit. You have two outcomes doing that. The good outcome will be a bad, wrong measurement.
The bad outcome will be you need to replace it. When I measure voltage, remember, I want to do it in parallel because voltage is the same in parallel. If I want to measure voltage, I need to take it out and put it on the side of where I want the voltage to be. And the same with current, only the other way around.
I want to open my circuit and put it on the way to measure the current. I want the current to flow through there, through the multimeter. But this is as difficult as it gets. And if, when you bind them, try to bind the one that has small clips on the side. It will make your life easier
because once you have clips, you can clip it on your system and you don't need to hold it with your hands while trying to turn the toggle on the way. Especially faster than with resistors because you hold it with your finger and you, as a human, do have resistance and it will mess with the results you get. So what I usually do,
I'll stick it in the breadboard and then put it on just to try and get it to be more accurate. Another thing, nice switch buttons, toggles, whatever you call them. There are push buttons, there are things you shift to the side. Essentially, all they do is disconnect on demand.
In this case, those toggle buttons, when you press them, they close the circuit. When they're not pressed, the circuit is open. It's that simple. And they are a cool thing to use because I can put them and decide when the lamp will go on and off.
Now, what I have here is, you'll see that in some of the instructions, some don't do that to make a life easier. You'll see another resistor connected in parallel as well. Why do I need it? Because if you use simple chip buttons, sometimes some current will manage to go through even if the button is not pressed.
If it gets a bit crooked or something inside, it could happen. I never really encountered it, but in order to reduce this noise, we actually let the current go to the side and we put a very big resistor there so that once the button will be pressed,
most of the current will go the other way and not to that side. And I get the light. So basically, if the button is closed, the current will go this way, and if the button is open, most of it will go the other way around. This is what's usually done. Although, you can connect it without this benefit and you might, especially if you're measuring the current
using one of the microcontroller, you might get to a point in which you do see small jumps in current because it can be sensitive and then you can do that in order to reduce that. You can put bigger resistors if you want to reduce them. I'll just put it down.
I'll get it. Anyone know what this is? Which component this is? No, no, no. Excuse me.
Yeah, there are seven LEDs here, and I'm probably sure you've seen at least one of those today because they are very common. Let me put it in the right order. Now, is it more familiar? This is what is known as the seven-segment display, the thing that shows the numbers.
Basically, this is what it is. It's seven LEDs connected in a specific way, but this is it, basically, and they usually have either a common ground minus, or they have a common input. Either that, the common ground is more common,
but you can get it the other way around, and basically what you have here is if you connect it correctly, and this is very easy to connect, although it can be frightening looking at it because it has 10 legs, and I usually stick it in the middle of the breadboard because I don't want those legs to interfere with one another,
and any other way will interfere because if you think about it, any other way to decide what am I doing, one of them will touch, or at least five of them will touch. But they are very simple when you understand. You don't even need to read the specification to see it working because I have a common ground.
Those are the middle pins. Connect them to the ground, then take through with resistor. You need a resistor here, otherwise you'll burn it, and just touch each leg. You know, connect a resistor, touch a resistor, and see what happens. You see something light up. Okay, this is A. Or you can open the specification and see exactly,
and specifications are very easy to find. Just Google for seven-segment display. You'll find quite a lot of those. And here I just did that basically without you needing to touch the ground. I just connected the buttons from the previous slide, and when you press, you just open it. Now that you know as much as you know,
you can even follow the lines and see which connected to which side and understand exactly which leg is responsible on which side. And basically, this is a cool thing because now I can display something, and it's no effort whatsoever. This is not a full-fledged screen,
but I can show the time. And it's a good start. After that, you can do shift registers and all sort of trickery, but this is the simplest thing. And this is the demo that my daughter loved the most. She got to press all the buttons, see if things light up. So this was basic electronics,
and I would probably do a disservice to you if I wouldn't talk about those guys, right? That's what everybody want to hear about, and that's okay. Who here tried to play with Arduino? Nice. It's very easy. You should, and I'll show you. Raspberry Pi with Windows on it?
Nice. Cool. Tessel. This one is Tessel. Tessel is an odd word. You program it using Node.js. And it has specific connectors and very little general-purpose outputs, and you need to buy the sensor from the same company.
And Microsoft did the hackathon with it, and it was very nice, but they're quite costly compared to the others. I also have here the Mino board, I think, and the red one on the side is also Arduino, only SparkFun created it, so they call it SparkFun Red, but it's Arduino. Basically, when you talk about Arduinos,
Raspberry or whatever, we're talking about the chip inside, not the whole board. The chip is Arduino compatible. The board is the prototype in board. Usually, it has a few more chips on it to program the chip that we use. For our purposes, it's good enough, but if you go into production,
I guess you won't put the whole thing, and I'm not sure if they're that reliable that you want to put them in production. Now, I am using the Arduino because it's very simple to understand, but the ideas go throughout those boards. This is basically the Arduino Uno. That's from the site.
And it has a bunch of legs, and what I like about the Arduino, they write on the legs what they do. You can actually see the numbering. Basically, what we have here is what you know until now. First of all, I have voltage going in. I can use those instead of my batteries. That's what I actually do at home. I connect the Arduino and just connect the circuit to it
because I get 5 and 3.3. Raspberry Pi, I think, does 5 as well, if I remember correctly, and Dospin will always output voltage no matter what. Very useful when I need to power up some of my system. This is what goes into the plus, essentially.
Now, on top of that, I have ground, usually more than one because I want to hack away a few systems together to work together. We'll see that. So I need a few grounds and not just one. I can use the same one if I want, or I can use one of the three. And now we get to the interesting bit, which is those. Those are the digital input and output of the Arduino,
and those are the analog's inputs. And basically, those guys are what is known as GPIOs, general purpose input and outputs. This is what makes those kinds of things fun because until now, all we did is connect a bunch of circuits together, and now we get to do fun stuff.
Now we can program them and decide when are things going in and out of the system, when we get voltage, when we're not getting voltage. Basically, we can do that in runtime. It depends on the system. Arduino basically has divided the analog inputs, goes from one side, and digital input and output is in another place,
and if you want analog output, we'll talk about what is analog and digital. Don't worry. If you want analog outputs, it can somehow emulate that behavior to some extent. But basically, I can change that in runtime, and Raspberry Pi, I think all the pins can be all four options. Input, output, analog, and digital, according to what you say.
Of course, you can use Python, .NET, or Java to write code for it, so that's fun. JavaScript, I think, as well. Essentially, this thing replaces my input source in some places, or I use it to measure things from what's going on in the outside world.
Now, as I said, there are digital and analog signals. Digital signal is very easy to understand. Either it's like a Boolean value. Either it's on or off. Although, in the real world, it's not true, but it's almost true, because it takes time to get from zero to the maximum amount.
In the case of Arduino, it's five volts, five volts being high, zero being low. Although it's not precisely five volts, it can be a few less or more, and same for zero, and it takes time to get from there to there. You don't move instantaneously from zero to five, but for our sake, that's good enough.
Analog can have a variety of values, and we're talking over time. Analog can have anything. In the Arduino, it measures zero and five volts again, but it's been divided between zero and 1,023. Nice round number.
And by measuring this voltage that's going in, I can, in those weird numbers, I can do fun stuff. If you remember, there was this nice circuit with the variable resistor, with the potential method that went around. I can do something very similar with Arduino.
Essentially, now I don't connect this guy to the system. I just connect it to the Arduino. Now, we'll talk about the code in a minute, but by reading the amount of voltage that's going in, I can understand what's going in the system. Basically, if you look only on the bottom part,
I'm putting voltage in, taking voltage out. That's a red and a black. By the way, the color doesn't matter. We used to put red as input, voltage black as output, and whichever color you want as whichever color you want. But it doesn't really matter. And I got the middle one going back in, remember?
Now, by turning it, I'll get a different voltage because the resistance will change between zero and whatever this guy can get. So I get a number inside my Arduino between zero and 1,023. Now, what happens here? That's the Arduino way of programming. In the beginning, it basically has two methods. You can write as many methods as you want,
but you have two methods. The first one is setup. All you have to do is say what the digital one does. Are they input or output? That's it. And then I read the analog signal that comes all the way around from A0. You see that one? A0 is my analog input. And I say analog grid, analog pin is zero. So it knows to go to A0 because A is the analog once.
And then I'm using a method that Arduino has that can map a range to another range. That's it. And I get a number between zero and 15. And then I do this little game of numbers here, and I get something back. And yeah, I'll connect that one.
Basically, what I get is a nice binary counter. When I turn it around, it starts counting in the binary space. And it's just to prove a point. It's easy. Another point I wanted to prove is if I take
the potential method out, what do you think will happen? If I take the input out, I essentially create, take this guy, and throw it away, what happens? Any ideas? Sorry? Nothing happens. In the software world, you will be right.
In the hardware world, however, you saw that one. Some things started to, okay, yeah, here you go. You see that one? You know why that is? Because apparently, I have a few wires
too close to one another, I guess. I can only imagine. I have no clear idea, because I need to probably measure it and might need to ask someone who actually understands it better than me. But you can see. And every time I do it, a different light goes on. It's not even the same light. Because the wires are pretty close to one another. You can see I can somehow affect them even.
And they cause some disturbance, enough for the lights to go on, even though we know that it's not supposed to measure anything. And when I did this with another board, I couldn't for the life of me get to 15, no matter what I did, because I guess that I played with it too much
and probably caused something not to work there, and it will only go as far as 10. No idea why. Or I connected too many things. This is a very poor input, by the way. When your circuit doesn't work with Arduino, Raspberry Pi will do that any day. If I connect this thing to the Raspberry Pi, I won't get any network.
That's not enough power for it to charge. My computer's not enough power. I need to put it in an outlet, otherwise I'll get a network drop. So keep that in mind, because we're not in the perfect world. Yeah, be careful. And those things will come and bite you any day of the week,
because it is an imperfect world. So let's talk about the fun stuff, sensors. This is the last topic, by the way. Sensors, essentially, when we want to use those Arduino, Raspberry Pi, or whatever, we want to connect them to either,
A, measure something from the outside world, or B, do something in the outside world. Measuring is something that is roughly done more, I guess. And basically, most of the sensors are just over-glorified resistors. That's it. All they do is change the resistance according to something, humidity, light.
This is the photoresistor. The more light you get, the higher the resistance will have. Now I have a problem, because this guy, the Arduino, doesn't know how to measure resistance. It's not a measuring tool. All he knows is voltage. What can I do in order to actually get it? Well, you should know that by now.
Yeah, in this one. Yeah, basically, that's exactly what happens here. I connect it in series with another resistor, and the more resistance I have, the voltage will go up or down, depending on what I want. If I want, when the resistance goes down, I'll not connect it this way, the other way around,
because once the voltage goes down, I'll get to roughly some threshold, because with no light outside, with a lot of light outside, the voltage will go down, because the resistance will go up. And then I know that it's day,
and maybe I need to make myself coffee. And the other way around is all those lights out there that once it gets darker side, they start lighting up. This is exactly how you build something like that by using this resistor. And most of those sensors will operate in a very similar manner.
Come to me later. You just want a book. This is yours. Now, resistors come in many shapes and flavors. This is the simple photoresistor, for example, and this is KS-1. Now, KS-1 already has the resistors in it. Basically, it has three legs because the circuit is already embedded in it.
So all you have to do is just find out what to connect where and how much voltage you want to put in, and you can stick it in your system, and that's it. And a lot of the resistors will have them, and most of the common ones, you'll also be able to Google and find the sheets that explain how to connect it. Basically, what you want to know is first,
A, where the ground goes, where's the minus sign, and connect that before everything else. And then you want to discover how much voltage, how much power to put in it, and then connect that one to another leg. If it has three legs, sometimes it's the third one, the middle one's not used. But if it has three legs, usually the left one, right one in your case, will be the minus,
the other side, the left one, will be the plus, and the middle will be the single one coming out, just like we connected it on our own, basically. But you can open, and there are tutorials and explanation all over the place that will show you what to do. And worst-case scenario, they're not that cheap. They're not that expensive.
You can burn and try again. So that's it, but let's talk about the next step. What can you do now? Basically, who here has a bunch of electronics at home you never touched? That's okay. You're in a good place because now you can go home, write home, and you can start playing with it.
But if not, you can build your own. Now, there are quite a few kits out there that you can buy. They are more expensive. They're buying the components on their own, and they usually come with a nice booklet that explains the experiments. And those are the companies I found and like.
Sunflower founder and Sparkfun has a very nice tutorial. The nice thing about Sparkfun, they share. If you go to the site, supposedly to look for, and I didn't know that, but once I started looking for kits, with the kit, in the place where you buy the kit, with the book that costs money, you can download the PDFs for the tutorial
and try them on your own if you want to. It's not that difficult. Seed is a special one. I don't know if you know about seed. I think Hanselman wrote about it. Basically, if you don't like to solve a thing or use a breadboard, there are special connectors, and you get to play like Lego and connect everything.
Same with Hanselman. It costs more, and you only get to use those sensors if you want. Make, very good site, very good books. We'll talk about that. And KS, I don't know why. When googling for sensors, or going to eBay or whatever to look for sensor, always follow KS.
They have a bunch of X in 1 sensor packs. 37, 41, whatever sensor packs. They have nice sensors that you can use and play with. Usually, you can either buy a bunch of those and don't let them lie around. Just play with them. Or you can choose a project.
Google, think about it, and then buy what you need, with a few extras in case something doesn't go well. And then all you need is usually a breadboard, a few resistors, some LEDs, and a sensor, and you can start from there. There are a lot of ideas out there, and I'll talk about them. Another thing is good. Those two things.
The first one on the left is 123D from electronics. You get to build circuit online, and then you get to see them actually working. They'll run your circuit. You can play with the toggles and everything, and you get to see them in action. That's a lot of fun. I used it to think about things.
There's also the emulator, the multimeter, so you can also measure along to think how your system will work. The one on the right is a desktop application called Fritzing, which you can, all the pictures I use till now were created with that thing. You can't run anything, but you can write the code
and connect the components together. It's very easy, and I have quite a few. I didn't find something I couldn't find there. And it's very user-friendly and nice. And if you press the tab, there's a schematic. You press the schematic and see the schematic as well. You can send it over in some form and even get a real board out of it,
but then you pay for it. Books. Unfortunately, the bookstore outside is closed. But Orelli was kind enough to give us a coupon that you can use. I recommend, although I haven't read any of the books,
just browse them and bought a few of those right now outside. The MEC Electronics and the MEC website is a good resource. And if you like to read about experiments and ideas, good place to go. Check them out, think about it, and you have this code that you can use. Orelli has a few books, very nice. Practical Electronics, a bunch of things about IoT
that you also can think about. And those books, basically those are two Arduino books. I didn't have enough place for everything. If you want to try specifically with Arduino, those are good books to start. One of them was written by the guy that created Arduino.
So, good place to start. And Internet. Arduino is a good site with a lot of tutorials and explanations and everything you need, including the software you need in order to control the Arduino. Raspberry Pi, the same thing. Raspberry Pi also has a nice store, but what they really have is project. They show in quite a few projects. They have also a newspaper that comes out,
and you can download the old versions of it and get ideas. Very good ideas there. Windows 10 IoT, very good resource as well, if you want to write .NET for your Raspberry Pi or Intel Edison. And Mac site. The Mac site has so much information and keys,
but even just browsing it and getting ideas, and there's quite a few tutorials. Other than that, if you Google for basic electronics, just Google for it, you'll find quite a few tutorials that explain all this voltage and current and things going around. Or if you have a component, you just bought one,
find out the serial number. They usually have a number 010 or something like that, and the name of the company. If you write it, I guarantee you'll find the fact sheet about it and the schematic to use it. Other than that, Stack Overflow. There are Stack Overflow sites for that as well.
There's one for electrical engineering, one for Raspberry Pi, and one for Arduino, in which you can read and ask questions. I think the Raspberry Pi is still in beta, so if you all go and ask questions, it might come out of beta as well. Okay, nice.
Any questions? Quite a lot. Yeah, come to me afterwards. Yeah, probably something went disconnected or the power went off, because it's not that big power, this thing. Any? Yeah.
Well, I haven't built a lot of things. I enjoy right now playing with my daughter on those things. And I am actually waiting for something to try. I am a big plant killer. Yeah, I killed all my plants whatsoever. And I want to try and build some water and system
for them so that they manage someone to survive. That's something I'm waiting for. And it's very easy, basically. It's just one sensor. And now I need to think how I'm going to handle the water going in. And it needs to be standing outside. So that's a real problem, not getting rain or too much sun
on it. Well, basically, both sites are shown. If you give them the schematic for this prototype you have, they'll have some.
I never tried it. But they can create a boat out of it. So that's a good place to start. I haven't tried production-ready, real-world things. I'm just playing around. But yeah. Any more? Any questions? Yeah.
Yeah, how hard was it to get full airport security? Right. Yeah, that was a real concern for me. That's true. Well, on the way here, I didn't have any problems. Way back, usually, is more problematic for my experience. And well, I'll tweet about it.
If I manage to clear security without explaining what the hell is I'm carrying around in my bag. Well, that's it. Well, thank you. And well, check out OSCode, by the way, if you're a .NET developer.