Emma is a public-domain reference design for an imp-powered device from Electric Imp.
Never heard of Electric Imp? It's pretty neat. "The Imp" is a tiny wifi-connected microcontroller packed up in the same form factor as an SD card. It's really easy to build imp-powered things, and once it's built you can connect your device to any wifi network and interact with it from anywhere in the world. Check out the imp if you haven't before before digging deeper: http://electricimp.com/
Devices that are powered by or enabled to work with an Electric Imp are called "impees" (just like one who is employed is an employee).
Step 1: Emma Schematic Overview
Since Emma is a public domain reference design, anyone can take the schematics, gerber files, or bill of materials (BOM) and use them to order everything needed to build more Emmas. This is the case no matter how many Emmas you might want to make. Want to build a whole production run and sell them? Totally fine. Want to make some changes to they layout or tweak the design to add your own feature or twist? By all means, please do.
The pdf of the Emma design is attached to this step in addition to the screen shots shown. The full project source for this design is available from the Electric Imp Dev Center. Note that many other reference designs are also available at on the Reference Designs Page.
Emma's design consists of four functional blocks: the power supply, the imp slot and ID chip, the LED driver and digit circuit (which is repeated 9 times in the design), and a digital ambient light sensor which was added just for some extra flair. The light sensor can be excluded without any ill effect (except, of course, that you won't be able to view the light level from anywhere in the world).
Emma's power supply uses the Texas Instruments AP1117E33G LDO to obtain a 3.3V supply from the board's 5V supply voltage - the imp, as well as the driver ICs for each digit, require a 3.3V supply. This LDO is inexpensive and easy to solder, and is a new addition in revision two of this design.
Note the Atmel ATSHA204-TSU-T part at U2, in the "Imp Slot and ID Chip" section. This part is an ID chip which provides the impee with a unique ID number. This number is used when the imp comes online and registers with the Electric Imp cloud; this is how the Imp Cloud knows what firmware to provide to the imp when it comes online. This part can be purchased and installed right off-the-shelf; no special initialization or configuration is needed. Just solder it down and you're good to go.
The Taos 856-TSL2561FN is a simple I2C sensor which can be used to detect the ambient light level around the impee. As shown on the schematic, this part has I2C slave address 0x29. Source code to read the sensor is included in this tutorial.
Next we'll take a quick look at the circuit which controls each display digit.
Step 2: Display Digits, Decimal Points, and Drivers
Each display digit has 17 segments, with 16 of those segments being part of the alphanumeric display and the 17th segment being the decimal point. For simplicity in software, each digit has its own display driver part for the alphanumeric segments, while all of the decimal points are controlled by another driver, for a total of 9. The driver used is the Austria Micro AS1110. This part was selected because it combines the the function of a serial shift register and a low-side current sink driver for the LED display into a single chip, which makes Emma's layout a lot simpler and construction a lot easier. This part is capable of sinking over 2A per chip - far more current sinking ability than we need for a single display digit!
The AS1110 is a constant-current driver, and the current through each segment is controlled with the selection of a single resistor on each AS1110, Rext. Each display digit is rated up to 20 mA per segment, and Rext is selected so that each display segment will run at approximately 18 mA. Emma is quite bright! A piece of tinted plexiglass in front of the display digits can provide a higher contrast ratio without sacrificing too much brightness, for a really good visual effect.
Because the AS1110 is, functionally, a serial shift register, data is clocked through each digit. In software, this is accomplished by writing out a 9-byte binary blob on the single serial data out line. The first byte out controls the decimal points, the second out controls the left-most digit, and so on.
In addition to the clock, serial data in, and serial data out pins, the AS1110 has a load pin and an output enable pin. The load pin is toggled high to load the data into the output stage of the driver after shifting data in with the serial data in and clock lines. The new data will be displayed immediately if the output enable line is asserted (output enable is active-low, so the line is driven low to assert). Note that toggling the load pin high clears the input stage of the driver, so the old-school-calculator effect obtained by shifting data through the driver with the output enabled is not possible with this driver.
The output enable line provides a handy way to control display brightness, as well as allowing for fade-in and fade-out effects, by driving the line with a pulse-width modulated signal.
That's what's under the hood! Let's take a look at the board!
Step 3: Emma Layout
Emma's layout is quite straightforward because the board is so large; there's plenty of space to work. If you're planning to just fabricate the board as provided in the reference designs, you don't need to read this whole step (but it's probably a good idea!); just check out these specifics about the Emma design:
1. All of Emma's components are on the top side of the board. This gives a nice, clean look and means that you can mount the board straight to a flat surface like a wall.
2. Because all of the components are on the top, and the LED digits are ALSO on the top, all of the components go on under the LED digits. Because this would cause the parts to run into each other and make getting at your work after installing the digits impossible, the LEDs are held in place by 1/4" 10-pin machine sockets. THE DISPLAY DIGITS GO ON LAST AND ARE NOT SOLDERED. If you are putting on a display digit at any step before you're ready for your final test, you are too early. The sockets should go on second-to-last, and the digits should be brought out only when you're done with all your soldering.
Here's a couple of important notes for anyone building an imp device:
1. The "built for imp" graphic on the Emma board is the only Imp logo you are allowed to print on your manufactured designs. This is the only one on Emma, so you're all clear to build this one as-is!
2. Don't put any FR4 (fiberglass printed circuit board material) under the antenna region of the Imp card. Note the image below; we've left a nice cutout under the antenna region for this design. This is important as FR4 under the antenna will change the antenna tuning and degrade wifi performance.
3. Don't put any copper (signal traces or planes) in front of the holes for the plastic guideposts on the imp socket. Note the two holes to the left of the cutout in the image below; see how the copper of the ground plane stops just short of those holes? That's the Right Thing To Do. Stay clear of that antenna and let it do its magical RF things.
4. Low-impedance ground paths are important. As you can see in the Emma gerber files, we've chosen to pour ground planes around all the signals on both the top and bottom layers after all the signals were routed. If you're doing any new layout, make sure every path to ground is nice and clear; high-impedance connections to ground make noisy circuits, and noisy circuits are a lousy thing to have next to a wifi device!
5. Use lots of stitching vias to connect your top and bottom ground planes where possible. For an example, there's a nice vertical row of stitching vias along the right edge of Emma (they actually trace a grid over the entire board!) in the image below.
Step 4: Building Emma by Hand: Getting Started Soldering
You'll need a few special tools to build Emma, as the board is all surface-mount components:
1. Kapton tape - it insulates, it secures, it's great. Make sure you've got some kapton tape.
2. A good soldering iron and some narrow-guage solder
3. Flux and a heat gun are necessary for setting down the TPS62237 DC/DC converter and the Taos Light Sensor. This won't be the case when the updated design with LDO power supply is posted.
3. We've added the AP1117E33G LDO in the currently-posted revision, so hot-air reflow is no longer necessary. Using the LDO to obtain the 3.3V supply for the imp and AS1110 LED drivers reduces part count and cost, and makes Emma easier to build by hand.
4. A soldering microscope and good tweezers. Most of Emma's discrete parts are 0402-size parts.
5. A multimeter for checking your work and debugging when necessary
6. Some copper solder-wick for removing solder that will inevitably bridge pins on small packages like the AS1110
7. Isopropyl Alcohol, small brushes, and task wipes are really useful for cleaning up your work when you're done.
To fire it up and play with it when you're done, you'll need:
1. An Electric Imp
2. An Electric Imp Account (free for developers such as yourself)
3. A computer
4. An iOS or Android device to "blink up" your imp
To get started, secure your board under the scope with some kapton tape, turn on your preheater if you have one, and grab some solder.
The first step I always use is to put a small bead of solder on the top-most or right-most pad of each component I'll need to solder down. This makes soldering down those components much easier: bring the component in with tweezers, re-flow the solder already on the board to anchor the component down, then solder the other side down.
For hot-air-reflow soldering (used to solder down the TPS62237 and Taos sensor), prepare the area with some flux, then put a tiny bead of solder on each pad. Place the component down on top of the flux, taking care to align the pin 1 indicator (usually a white dot or divot) with the pin 1 indicator on the silkscreen (a white dot). Hold the part in place gently with the tip of the tweezers, then heat from directly above with the heat gun until the solder flows. Slight misalignment before you bring in the heat gun is ok - the surface tension of the solder will tug the part into position as soon as the solder starts to flow. Once the solder is flowing and the part is aligned, pull the tweezers away first, then the heat gun.
Step 5: Building Emma by Hand: Soldering Through-Hole Components
Once you've soldered down all the components on the top of the board, it's time to add a power connector and the 10-pin machine sockets used to hold the actual alphanumeric digits. To do this, you'll need to put the parts in place, then flip the board over and solder them on the other side. Since gravity tends to interfere with this process, kapton tape is really the way to go here. Put the components in place, tape them down (taking care not to tape over the solder joints on the back of the board, as you'll need to get at them with the soldering iron), turn the board over, and solder them down.
It's very easy to get the machine sockets soldered in crooked, and nearly impossible to align them after more than one pin has been soldered in place. To cut down on the likelyhood of this causing any problems for you, I highly recommend making sure the sockets are resting on a flat surface, and the board is sitting flat on the sockets.
Once you've got these components all soldered down, it's time to pull off the tape and check your work!
Step 6: Building Emma by Hand: Checking the Power Supply
Before you install the display digits or an imp, you should DEFINITELY test the 3.3V power supply. This also gives you a quick chance to make sure there are no shorts on your board.
Without an imp installed, plug the 5V supply into the barrel jack on the board. Grab your multimeter and test two voltages: the input voltage, which should be right around 5V, and the imp supply voltage, which should be 3.3V. Touch the black probe to ground (using one of the mounting holes at the board corners is probably most convenient), and use the red probe to probe for these two supply voltages. The pictures below illustrate where you should be touching the multimeter probe.
For the 5V supply, probe at the XW link (looks like two bare pads with a small exposed trace between them) just to the left of the barrel jack.
For the 3.3V supply, probe the bottom of capacitor C3, just to the left of the imp socket. (Note: ignore the small orange wires in the attached photo; the board used for this demo required a small rework that is not present in the design provided).
If all is well, it's time to clean up!
To clean up some of the messy flux on the board, Isopropyl alcohol is the best solution. Disconnect power and apply alcohol to a small area of the board at a time with a brush. Place a fragile-task wipe over the parts you've just covered with alcohol and use a short-bristled brush to work the wipe down into the corners next to the solder joints. You can do a quick wipe-down with a wipe moistened with alcohol when you're done to get any remaining mess off the board.
Then you're ready to install the digits!
Step 7: Building Emma by Hand: Installing Display Digits and an Imp
Installing the display digits should be easy, but it takes a little care to line them up correctly. Start at an angle and align all the pins on the far side of the board, then tilt the digit back down and line up the near side carefully. If you have one or two pins that are trapped out of alignment, you can nudge them gently back into place with tweezers. Make sure the digit is level, then apply gentle pressure and the digit will sink into place. Don't force the digits! If they're out of alignment, you'll bend the pins.
With the digits installed, you can now install an imp in the imp slot. This is just as simple as installing an SD card. Push the imp into the socket until it clicks.
Plug in your board, and you should see the imp power on and blink red a few times. If you've already configured this imp on your local network with BlinkUp, it will connect again after a few seconds and begin blinking green. Otherwise, you'll need to use BlinkUp to configure your imp. Sign in to the electric imp app on your phone, enter or select your wifi network, cover the top of the imp to reduce ambient light, and use the "send BlinkUp" button to send your network's SSID and key to the imp. After a few seconds, you should be connected.
With that, you're ready to run a few tests!
A good first test is an all-segments-on test to make sure you have connectivity at each segment of each digit. Open the electric imp IDE (ide.electricimp.com) and look for your new device - it will appear under "New Devices" in the left-hand navigation column. Click "New Devices" to expand the menu and show all the devices (likely just one - your new Emma board). If you don't see any devices here, refresh your browser. Once you've found your new device, click the device ID in the New Devices list to open the device settings; here you can give your device a name and set the device's model. A model is set of device firmware - a device firmware, which runs on the imp locally, and an agent firmware, which runs in a VM in the electric imp cloud. The agent and device communicate back and forth, and the agent acts as the device's gate to the internet. Create a new model now by typing a new model name in the model name box, then save the device settings. Your device will now appear under the name of the new model you've created, and the code editor will open.
The test code you'll use for the all-on test is at https://github.com/electricimp/examples/blob/master/emma/test/emma_all_on.device.nut. Head there, copy the code, and paste it into the "device" window in the IDE. We don't need the agent to do anything for this test, so the agent window is left blank. Hit "Build and Run", and your device will download the new code and run it. You should see all of the display segments illuminated.
If any segments are not lit, disconnect power and remove the imp, remove the offending digit, and check the connections at both the AS1110 and the machine sockets (check the solder joint on the back of the board). Also verify that none of the pins on the digit were bent or failed to seat inside the machine socket.
Once you've passed the all-segments-on test, you're ready for the second and final test; the rotating-ones test. This test simply rotates a single "1" bit through each of the shift registers to illuminate all of the segments one-at-a-time. You can create another new model for this test by clicking the gear icon next to your device name in the left-hand nav column in the IDE and typing another new model name. Just like before, paste in the device code from https://github.com/electricimp/examples/blob/master/emma/test/emma_rotate_1.device.nut and click "Build and Run" to run your code.
There are two main problems that the rotating one test can catch:
1. If some of the display digits stay lit: This usually indicates that the new data isn't being shifted into the drivers for these digits. Because the data must be passed through each driver to get to the next, a bad data connection on one driver chip will cause problems for all the digits to the left. Disconnect power, remove the imp, and remove the digits. Beginning with the left-most digit that exhibited the problem, check the solder connections to each AS1110, moving right.
2. If more than one digit lights at a time: This usually means you've got solder bridging two of the pins on the driver chip for the offending digit. Disconnect power, remove the imp, and remove the digits. Remove the digit that is lighting multiple segments and check the solder connections on the AS1110 to ensure that no solder is accidentally connecting any two adjacent pins.
When you've passed both tests, you're ready to switch to the default firmware and start interacting with your new board!
Step 8: Setting the Default Firmware: Emma's Done!
Once you've passed the all-on and rotating-1 test, create another new model. Unlike the test models, this model will include an agent; the default behavior is to display the date, but you can change your agent to talk to anything on the internet. Add the device code from https://github.com/electricimp/examples/blob/master/emma/emma-device.nut and the agent code from https://github.com/electricimp/examples/blob/master/emma/emma-agent-clock.nut and you're off to the races.
To get more out of your new board, try using your agent to talk to other web services - you might try using it to show the forecast with Weather Underground or show stock prices from Yahoo Finance, just for starters.