Today’s world is filled with electronics that need programming to make them perform. Every career will need a basic understanding of electronics and programming. This four day workshop introduces basic electronic and programming concepts with hands on projects so students get a clear understanding of how to approach a challenge, solve problems and understand the basics. One day and complete semester curriculum are available.
(c) Dataseam 2016
Programmable Electronics – Real world programming using microcontrollers.
Course introduces fundamentals, concepts, , industry specific terms to help students understand and build their own programmable electronics. Establishes a solid framework from which participants can further expand their knowledge either though continued academic coursework or through additional self-education using various online resources. Presented as a mix of short lectures and hand-on projects designed to illustrate and reinforce each key concept. Workshop includes complete electronics kit featuring an Arduino Nano microcontroller, various sensors, addressable LED strip, and a 128×64 graphical display.
For more information on workshops and in school programs contact firstname.lastname@example.org
Individual Sessions Include:
Although this is a programming class, not a Physics or Electrical Engineering class, we will be working directly with electrical components, so we need to understand a little bit about how they operate. Plus, computers are electrical devices, and knowing something about how they operate will give you some insight into why some things are done the way they are in various programming environments.
Diodes & Resistors
It is common to use pipes and water flow as an analogy for wires and current flow. While it breaks down at a certain level, it can be useful for visualizing the basics.
Along with resistors and diodes, capacitors round out the ‘big three’ basic electric components. To fit them into the fluid analog requires a little bit of creativity, and there are many examples on the internet and in various text books.
Series & Parallel Circuits
When you have two or more components in a circuit, they can be connected in two primary ways.
Transistors, Semiconductors, & Computers *(lecture only)
It is often said that semiconductors started the computer revolution. And that the transistor started the electronic era. And those statements are sorta true, but what exactly are semiconductors and transistors.
The Arduino IDE
An IDE is a TLA1 for Integrated Development Environment. In order to develop software for a system the programmer needs to use several tools and follow a variety of steps. The IDE can assists the programmer by simplifying or automating many of these processes.
Programming Language Basics
The processor in a modern computer can perform many millions of operations per second. Although as was discussed, the processor can only perform operations on numbers, specifically binary numbers. These numerical operations, when properly combined then result in everything from web pages, to video games, to Artificial Intelligence.
Interfacing with Microcontrollers
Now that you know what programming languages and
IDEs are all about, and the fundamentals of DC electrical flow, we need to look at the device we are going to be using for the rest of the class.
The Serial Monitor
As mentioned, many uses of microcontrollers have them embedded in a device interacting with either humans or components though very specific inputs and outputs — but sometimes they need to communicate with other systems. The programming process is one example of such communication, and observing the logic and workings of your program, aka debugging, is another.
Statements, Blocks, Lines & Symbols
In order to be as clear as possible when describing things, it’s helpful to use a very specific and well defined set of terms.
A program is essentially a list of instructions for a computer to follow. Unlike a person, the computer will follow the instructions exactly and in the order specified.
Working with Variables
In addition to doing things rapidly, one area where computers can easily best your average human is memory, trivially recalling things quickly and precisely, assuming they were explicitly asked to remember it.
Inputs, Comparisons, Branching
We saw how to read data from the serial port, but we also saw references to I/O ‘pins’ and something called GPIO, which is an acronym for General Purpose Input Output. We also saw how to turn on the built-in LED by writing a 1 to it.
Loop de Loop (Do)
Previously we talked about the ability for the processor to execute a branch instruction so that the next instruction it executes isn’t just the next one in the ordered list of instructions. We used that be able to jump back in the list to some that had already been executed, creating a loop.
Loop de Loop (For)
The do/while loop is pretty common and quite flexible, but sometimes a simpler mechanism is needed. And something that’s maybe a little easier for the programmer to read and understand.
Buttons & Tones; Bleeps and Blorks
As you probably know from science class, sounds are just air pressure waves at certain frequencies. Speakers are just diaphragms moved in and out to create these pressure waves.
Functions & Abstraction
Programming is about breaking down a complex problem into manageable, solvable pieces. As you go about this process a few will start to become apparent.
Binary Numbers: Bits, Bytes & Hex
As mentioned previously the primary building block of a computer is the transistor, and specifically a transistor used as a switch, which can either be on or off. These on/off, or Yes/No, True/False conditions can also be thought of as a 1 or a 0.
First, what is a ‘Pulse’. In Digital Electronics, a Pulse is transition of the state of the voltage and/or current on a part of a circuit. In our case what will be transitioning is the voltage on a GPIO pin from our micro controller. If we drive the pin HIGH when it was previously LOW, a transition has occurred. Another will occur when it returns to LOW.
A2D <-> D2A
In the PWM experiment we saw how a digital signal could create the appearance of an analog result — specifically we sent a series of digital pulses to rapidly flicker an LED such that appeared to us humans that it was just getting dimmer.
Protocols & Smart Devices
Working closely with the hardware, it is easy to see many key uses for abstraction. Perhaps one of the most obvious is dealing with complex subcomponents, often called peripherals.
Arrays and LEDs
In your kit is a short LED strip containing 30 LEDs. Actually it contains 90, since each of the LED units is an RGB LED. That is it internally contains a Reg, Green, and a Blue LED emitter.
One of the sensors in your box is a sound detector. There are various types of microphone and sound detection devices available. The particular one we are using is a simple digital sound detector, sending a trigger when it ‘hears’ a sound.
Included in your kit is a PIR motion sensor (HCSR501 clone). This ubiquitous sensor is actually quite complex. PIR is commonly said to be a TLA for ‘Passive InfraRed’, but it is probably more accurately called a Pyroelectric InfraRed sensor.
State Machines are another programming concept with an origin in mathematics. There are many complex components concerning various types and implementations of state machines. Entire text books and college classes are devoted to them.
An Ultrasonic Rangefinder
This sensor also uses the BIS0001 microcontroller internally, just as the motion detector did. It is also fairly simple to use, but quite complex in its actual design.
The Light Dependent Resistor (LDR), also called a photoresists or photocell is simply a resistor whose resistance value decreases based on the amount of light which strikes its surface.
An OLED display
Probably the most complex item in the kit is the OLED display. It includes a variety of components to manage the display and control all the individual LEDs — not to mention the LEDs themselves. The display is 128×64 OLED pixels in size — that’s 8,192 individual LEDs to keep track of and update.