68

Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

  • Upload
    haphuc

  • View
    226

  • Download
    6

Embed Size (px)

Citation preview

Page 2: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

Cutting Corners, Without Compromise!Compact convenience and economic effi ciency are the hallmarks of our new RDX1 charger. Its space-saving, affordable design fi ts every workbench and budget. This potent AC/DC charger features a backlit 3.2-inch LCD screen and accessible front panel ports for easy charging of all your batteries. Integrated balancing, microprocessor-control, USB functionality and a PC interface combine to make the RDX1 the obvious solution to your charging needs.

FEATURES:• Optimized Operating Software• 10 Battery Memory• Internal Lithium Battery Balancer• Multiple Lithium Battery Charge Modes• Works with Hitec’s “Charge Master” Software• LiPo Battery Meter

SPECIFICATIONS:• AC Input Voltage: 100-240V• DC Input: 11-18V• Charge Power: 60W• Charge Current Range: 0.1 - 6.0A• Max. Discharge Power: 5W• Discharge Current Range: 0.1 - 2.0A• Balancing Port Current Drain: 200MA/Cell

Hitec RCD USA, Inc. / 12115 Paine St. Poway, CA 92064 / 858.748.6948 / www.hitecrcd.com /

Full Page.indd 2 12/6/2016 2:46:47 AM

Page 4: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

4 January 2017

20 An Electronic ChessboardUsing RGB LED Strips and HallEffect SensorsThe game of chess is considered by many to be verycomplicated and played by people who enjoy a challenge.However, with this game board that is set up for twohuman players, you’ll be able to actually see the variousallowable moves for each chess piece.■ By Theron Wierenga

27 Vintage Computing — TheRetro PIC Single-Board ComputerOver the years, I have accumulated a bunch of chips frombefore the era of true PCs when computers with nameslike Altair, KIM-1, and Cosmac ELF were popular. I’ve beenlooking for a way to use them in new projects, so Idesigned a system around a 40-pin PIC16F887. I figuredthis would put some of my historic chips to work and be agreat learning tool for understanding how amicrocomputer works.■ By Dan Gravatt

32 An ESP8266 RSS News ReaderAre you a fanatic when it comes to keeping up withcurrent events? Then, you’re gonna love this reader thatwill continuously display headlines from selected newsfeeds that’s constructed from the same circuit that alsoallows you to build an auto setting clock and/or weatherclock.■ By Craig A. Lindley

36 REVIEW: Bench Werx Offers aVersatile PCB HolderEver need a “third hand” when soldering your circuitboards? Perhaps the PCB Rax system is just what you’relooking for.■ By Dane Weston

40 Computer Control andInterfacing with the NI MyRIOPart 2: As we continue our series on using the NationalInstruments’ MyRIO, we will build and deploy the VI wecreated last month as an embedded program, and willcontrol the MyRIO wirelessly with an iPad.■ By David Ward

08 TechKnowledgey 2017Events, Advances, and NewsRead about pollutants becoming fuel, printer problems,

building your own Tesla, plus other interesting stuff.

12 Q&AReader Questions Answered HereFind answers to questions on phantom power, extending

Wi-Fi range on the cheap, and PBX and auto dialers.

16 The Ham’s WirelessWorkbenchPractical Technology from the Ham WorldHam Metrics and the DecibelThe “dee-bee” is everywhere in ham radio, and is used

for characterizing everything from antenna performance

to nano-sized signals. Learn the decibel, and you and your

signal will go a long way!

48 The Spin ZoneAdventures in Propeller ProgrammingMaking MenusMenus are important — in restaurants and in consumer

devices — and we should never take them for granted. Big

project or small, take your time when it comes to the user

interface, and design a system that is sensible and easy to

use.

56 The Design CycleAdvanced Techniques for Design EngineersA Look at the nRF52832’s SPI Peripheral

The Nordic Semiconductor nRF52832 isn’t just a BLE

radio. It’s a full-blown ARM microcontroller as well.

This time, we will take an in-depth look at the nRF52832’s

SPI peripheral. Along the way, we’re going to “generate”

a bit of eight-bit SPI Slave

PIC code too.

Nuts & Volts (ISSN 1528-9885/CDN Pub Agree #40702530) is published monthly for $26.95 per year by T & L Publications, Inc., 430 Princeland Court, Corona, CA 92879. PERIODICALS POSTAGE PAID ATCORONA, CA AND AT ADDITIONAL MAILING OFFICES. POST MASTER: Send address changes to Nuts & Volts, P.O. Box 15277, North Hollywood, CA 91615 or Station A, P.O. Box 54, Windsor ON N9A6J5; [email protected].

January 2017

06 DEVELOPINGPERSPECTIVESThe Zombie Apocalypse — Are You Ready?

07 READER FEEDBACK07 SHOWCASE

54 NV WEBSTORE62 TECH FORUM64 CLASSIFIEDS65 ELECTRO-NET65 AD INDEX

Departments

Subscription InformationNuts & Volts — PO Box 15277

North Hollywood, CA 91615-9218Call 877-525-2539 or go to www.nutsvolts.comSubscribe • Gift • Renewal • Change of Info

Page 27Page 32

TOC - Jan 17_TOC NV Mar 15.qxd 12/6/2016 12:07 AM Page 4

Page 5: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

• Saelig Company, Inc. • www.saelig.com • [email protected] • 1-888-7SAELIG •

More Unique Products

Signature Analyzer• Controlled via USB

• 5-in-1 Functions

• Includes OscilloscopeAWG, I/O

• WIN, MacOS, Linux

• Under $400

Oscilloscope, Waveform Generator, Digital I/O Port - All in One!

• Terrific educational toolwith lessons/experiments

• AWG, I/O, PWM, FFT

• $99.95

SDS1102X Scope Free Serial Decode Option

• 1GSa/s Sampling• 14 Mpts Memory

• FFT

• 8” LCD

• 60,000 wfm/s

• $424

Wide Selection of Spectrum Analyzers

• Desktop to USB stickversions cover up to12GHz to find signalqualities or interference

• Starting at $518

Power Supplies - 30W to 1500W• Desktop to

rack-mount powersupplies to fit almostany need.

• Programmable on/offvoltage level cycles

• From $56

PCB Repair Equipment• Repair, don’t throw

away costly PCBs.BoardMaster systemsare easy-to-use andcan be used byanyone to find andrepair PCB faults.

EMC Precompliance Testing• Check your PCB

design beforeexpensive formaltesting to makesure you’ll passEMC specs withour affordablesolutions.

Wide Selection of Spectrum Analyzers

• Starting at $518

Automotive Diagnostic Equipment• Picoscope test kits

are designed to makediagnosing & testingvehicle electronics,components easy.Find faults fast!

SIG-101 CGM-101

Full Page.indd 5 10/3/2016 5:36:56 PM

Page 6: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

The power grid is down, noInternet, no cellular, and no

landline communications, and killerzombies are on the loose. Nowwhat? Well, let’s replace the zombieattack with a hurricane, tornado, orearthquake. Is that any better? Couldyou make do? Could you leverageyour skills in electronics to call forhelp, cook and preserve your food,and provide light?

One of my favorite activitiesrelated to ham radio is ARRL FieldDay. Once a year, hams throughoutthe US set up a tent or othertemporary structure and — using solarpower or gasoline poweredgenerators — cook, have lights,perhaps an electric cooler or two,and of course communicate witheach other. The goal of Field Day isto test every ham’s preparedness andability to function in the event of anatural or manmade disaster.

So, let’s say you have an electricgenerator in your basement andperhaps a portable bank of solarcells. Can you change the points inthe generator? Adjust the carburetor?Do you know how to ground thesystem? What about loaddistribution? Do you have theequipment and know-how tocombine the output of your solarpanel and gasoline poweredgenerator?

What about electrical repairs toradios, vehicles, and other electricalequipment? Do you have a butanepowered torch or soldering iron sothat you can work without 120 VAC?Do you have spare parts? If yourbasement pump fails, do you havethe parts and know-how to fix it?What if someone in your group getsa nasty shock because of a ground

fault or other problem with theemergency electrical system? Do youknow how to administer CPR?

Let’s say your friendlyneighborhood nuclear power stationhas an event. Do you have a Geigercounter and do you know how touse it? Do you know how to cleanthe probe if it becomescontaminated? Do you know how touse your Geiger counter todistinguish between the differenttypes of radiation?

The bottom line is that youshould be ready for anything — fromangry aliens to mudslides. Plan aheadnow, while you have time to thinkthings through. What’s the mostlikely scenario (hopefully notzombies)? What skills should youhave? What equipment do you needto have on hand? Clearly, if you liveon the Gulf coast, you’ll need toconsider a scenario dominated byhurricanes. If you’re in the Bay area,then the aftermath of earthquakesdeserves your attention.

As an electronics enthusiast, youhave a vast skill set that lends itself torecovering from any number ofdisasters, but you have to plan aheadand practice those skills so that youcan bring them to bear when they’reneeded. If you’re a ham, don’t forgetthe annual ARRL Field Day, heldevery fourth weekend in June.

If you’re not a ham, thenconsider practicing your skills withinthe context of a club, neighborhoodgroup, local Civil Defense, or othergroup. You could practice on yourown, but my Field Day experiencestaught me that competition is thebest way to sharpen emergencyresponse skills. NV

Published Monthly By

T & L Publications, Inc.

430 Princeland Ct.Corona, CA 92879-1300

(951) 371-8497

FAX (951) 371-3052

Webstore orders only 1-800-783-4624

www.nutsvolts.com

Subscription OrdersToll Free 1-877-525-2539

Outside US 1-818-487-4545

P.O. Box 15277North Hollywood, CA 91615

FOUNDERJack Lemieux

PUBLISHERLarry Lemieux

[email protected]

ASSOCIATE PUBLISHER/ADVERTISING SALES

Robin [email protected]

EDITORBryan Bergeron

[email protected]

VP OF OPERATIONSVern Graner

[email protected]

CONTRIBUTING EDITORSFred Eady Kristen McIntyreDavid Ward Jon McPhalenJeff Eckert Ward SilverCraig Lindley Dane WestonTheron Wierenga

CIRCULATION [email protected]

SHOW COORDINATORAudrey Lemieux

WEBSTORE MARKETINGCOVER GRAPHICS

Brian [email protected]

WEBSTORE MANAGER/PRODUCTION

Sean [email protected]

ADMINISTRATIVE STAFFRe Gandara

Copyright © 2017 by T & L Publications, Inc.All Rights Reserved

All advertising is subject to publisher’s approval. Weare not responsible for mistakes, misprints, or typographical errors. Nuts & Volts Magazine assumesno responsibility for the availability or condition of advertised items or for the honesty of the advertiser.The publisher makes no claims for the legality of any item advertised in Nuts & Volts. This is the soleresponsibility of the advertiser. Advertisers and theiragencies agree to indemnify and protect the publisherfrom any and all claims, action, or expense arising fromadvertising placed in Nuts & Volts. Please send all editorial correspondence, UPS, overnight mail, and artwork to: 430 Princeland Court, Corona, CA 92879.

by

Bryan

Bergeron,

EditorDEVELOPINGPERSPECTIVESThe Zombie Apocalypse — AreYou Ready?

6 January 2017

Bergeron - Developing Perspectives - Jan 17_Dev Perspectives - ReadFeed Feb15.qxd 12/5/2016 10:04 PM Page 6

Page 7: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

SMV1404-09 VaractorDiode

This is in regards to the sweepgenerator (N&V December 2013), theRF generator (June 2014), and theelusive varactor diode.

Unfortunately, shortly after thesearticles of mine were published, themarket on these parts literally dried up.They are not obsolete and are still incurrent production, but due to thefocus on GHz media products, the bigtime distributors seem to be onlyinterested in varactors that support thatsector.

I have had tremendous response tothose articles, and the main problemwas that those building the projectscould not find an outlet for purchasingthem at a respectable price other thanthe large Asian secondary distributorswanting as much as $95 each pieceand minimum quantities of 1,000pieces. So, as a service to them, I tooka big risk and purchased the minimumorder direct from the OEM (hundredsof dollars). To my surprise and delight,they were completely sold out in onemonth.

Due to continuing demand, Irepeated this one more time with thesame results. I am still getting requestsfor them, and with an upcoming articleon an adapter unit for the RF generatorthat will add sweep function to it, Iexpect even more interest in thoseparts. So, once again, I am consideringtaking the "plunge" for a large OEMorder on these parts.

What I would need to know is

how many of you would be interestedin purchasing them. As in the past, Iwill be charging $12 for a packet oftwo pieces with free shipping. I makevirtually no money on thesetransactions and offer this only as aservice.

If you have a desire to purchasethese parts, please email me [email protected]. When the demand

Continued on page 64

READER FEEDBACK

January 2017 7

FREEPCB Layout Software &PCB Schematic Software

DOWNLOAD our free CAD software

DESIGN your 2 or 4-layer PCB

CHECK your design with xCHECK DRC

SEND us your design with just a click

RECEIVE top quality boards in just days

12345

MADE IN THE USA | www.expresspcb.com

$613 PCBs

2-layerMiniBoardPro

(Shipped in 2 business days)

$413 PCBs

2-layerMiniBoard

(Shipped in 1 business day)

+ shipping + shipping + shipping$813 PCBs

4-layerMiniBoardPro

(Shipped in 3 business days)

Now Offering

SMT STENCILS

– Nano Coating available–

Reader Feedback - Jan 17_Dev Perspectives - ReadFeed Feb15.qxd 12/5/2016 10:25 PM Page 7

Page 8: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

8 January 2017

TECHKNOWLEDGEY 2017 n BY JEFF ECKERT EVENTS, ADVANCES, AND NEWS Post comments on this article at www.nutsvolts.com/magazine/article/January2017_TechKnowledgey_Tidbits.

Pollutant Becomes Fuel?

Among the various strategies for reducing the amount of CO

2 released by fossil fuel power plants

is a process known as CCS (for “carbon capture and storage” or “... sequestration”). In concept, CCS is bonehead simple: you just capture CO

2 at the source and

deposit it somewhere else — generally an underground geological containment. One interesting example of this is the Weyburn-Midale Carbon Dioxide Project, which from 2000 to 2012 focused on injecting CO

2 into an

existing oil field to increase pressure and thereby enhance oil recovery.

The positive finding was that you can get an extra barrel of oil from each metric tonne of injected gas. Unfortunately, estimates indicate that CCS would increase the cost of power generation by anywhere from 21 to 91 percent, and there is some question about how much gas would leak back into the atmosphere over, say, the next 5,000 years.

However, a promising twist on CCS has been conceived by some scientists

at the Cornell Center for Materials Research (www.ccmr.cornell.edu), as revealed in Science Advances Magazine (advances.sciencemag.org) last year. Instead of just squirting the CO

2 into a hole in the ground, the authors

have proposed an aluminum/carbon dioxide power cell that actually generates electricity while producing a valuable oxalate as a byproduct. This electrochemical cell uses aluminum as the anode and a mixture of CO

2 and

oxygen as the cathode’s active ingredients.The group reported that the cell is capable of

generating 13 Ah per gram of porous carbon (used as the cathode) at a discharge potential of about 1.4V. One

observer noted that this technology is not limited to power plant applications. “It fits really well with onboard capture in vehicles, especially if you think of an internal combustion engine [with] an auxiliary system that relies on electrical power.”

One drawback is that the cell’s electrolyte is extremely sensitive to water, but they’re working on that. ▲

World’s Smallest Transistor — Sort of

According to the laws of physics, an operational transistor gate can be no smaller than 5 nm, which is about a fourth the size of today’s commercially

available 20 nm gate transistors. This is because below 5 nm, a phenomenon called “tunneling” takes place in which the gate barrier can no longer keep the electrons from zipping straight from the source to the drain terminals, and the transistors can’t be turned off. However, lawbreakers at Berkeley Lab (www.lbl.gov) observed that this is true when we’re talking about silicon, but not necessarily other semiconductor materials. By using molybdenum disulfide (MoS

2) as the semiconductor material, they managed to

create a gate only 1 nm in length. (One nice thing is that MoS

2 is not a particularly exotic or expensive material and,

in fact, is sold in auto parts stores as a lubricant.)Part of the explanation as to why the device works is

that “electrons flowing through MoS2 are heavier,” so their

flow can be controlled with smaller gate lengths. This is something of a head-scratcher, given that yours truly has always been led to believe that all electrons have exactly the same mass. (In fact, Prof. John Wheeler — no slouch in

the physics field — went so far as to claim that all electrons are the same because, in fact, there is only one in the entire universe, and we are just looking at it on different slices of space time. But let’s not go there.)

Another factor is that MoS2 can be produced in

thinner sheets (≈ 0.65 nm) which also helps to control the current flow.

As with most early developments, it’s a long way from commercial implementation. As observed by Berkeley scientist, Ali Javey, “We have not yet packed these transistors onto a chip, and we haven’t done this billions of times over. We also have not developed self-aligned fabrication schemes for reducing parasitic resistances in the device. But this work is important to show that we are no longer limited to a 5 nm gate for our transistors.”▲

ADVANCED TECHNOLOGYCOMPUTERS and NETWORKING

Diagram of Cornell’s Al/CO2 electrochemical cell.

Diagram of world’s smallest transistor.

Eckert - TechKnowledgey - Jan 17.indd 8 12/5/2016 8:06:40 PM

Page 9: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

January 2017 9

EVENTS, ADVANCES, AND NEWS Post comments on this article at www.nutsvolts.com/magazine/article/January2017_TechKnowledgey_Tidbits.ADVANCED TECHNOLOGYCOMPUTERS and NETWORKINGIt Takes Lenovo to Tango

If your Galaxy 7 has fallen to spontaneous combustion, your iPhone screen keeps freezing, or some other malady has plagued your mobile device, you might

be thinking about giving a less popular vendor a shot at providing your replacement. If so, you could take a look at Lenovo’s (www.lenovo.com) latest model — the Phab2 Pro — partly because it is the first implementation of Google’s Tango platform.

Project Tango (in case you haven’t kept up) is a technology that uses a 3D depth-sensing camera to provide devices with an awareness of their location without using GPS or other external signals. This enables developers to include features such as 3D mapping, augmented and virtual reality, indoor navigation, and so on. Its market appeal may be limited by the 6.4 inch display, given that many people find existing 5.5 inch phones are unwieldy, but one might surmise that the bigger 1440 x 2560 display is more suitable for VR apps.

You also get a 16 MP camera with phase detection autofocus, face detection, and touch focus; 64 GB of

storage and 4 GB of RAM; and, yes, a 3.5 mm headphone jack. We’re looking at a $499 price tag, and it’s unlocked right out of the box. ▲

Printer Problems?

If your HP OfficeJet printer has suddenly started malfunctioning, it may be the result of a firmware update that the company downloaded to your printer

last year. The company’s official explanation is: “We updated a cartridge authentication procedure in select models of HP office inkjet printers to ensure the best consumer experience and protect them from counterfeit and third-party ink cartridges that do not contain an original HP security chip and that infringe on our intellectual property.” Or, to put it a different way, “We noticed that some of you are avoiding our rip-off pricing policies by buying cheaper cartridges from third-party vendors. Well, take that, sucka!”

In a way, you can understand why they are miffed. After all, an HP 02 black cartridge contains 10 ml of ink and sells for $26 at Walmart. That comes to about

$9,842 per gallon — just a tad more than insulin.Anyway, after receiving thousands of complaints,

HP decided more or less to back off and offer another update that removes the “dynamic security feature.” However, it also made it clear that such “security” features will continue to be employed in the future “to protect the quality of our customer experience ...

and protect our IP, including authentication methods that may prevent some third-party

supplies from working.”By the time you

read this, the new firmware should be available, but note that you don’t receive it automatically; rather, you have to download it yourself. Just log onto www.hp.com/support and follow the directions. ▲

Lenovo’s Phab2 Pro, the first Google Tangophone.

HP’s OfficeJet 8600, one of the affected printers.

Eckert - TechKnowledgey - Jan 17.indd 9 12/5/2016 8:06:45 PM

Page 10: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

10 January 2017

Killer on the Loose

It’s becoming painfully evident that we all need to be careful about what gets plugged into our USB ports. For example, Australian police have been investigating

a number of cases in which people found nicely packaged thumb drives in their mailboxes and assumed that they must be some kind of free sample or clever advertisement. After plugging them in, what looked like a promotional offer from a streaming service like Netflix appeared, but in reality, the drives were loaded with ransomware.

More recently, a company in Hong Kong has been selling a potentially nasty product called USB Kill (www.usbkill.com). Ostensibly a piece of equipment designed for testing a device’s resistance to power surges, it draws power from a USB port, uses that power to charge some capacitors, and then discharges 240V back into the port. These spikes continue at a rate of several per second until: (a) you are satisfied that the device is sufficiently surge resistant; or (b) the device is fried.

The company has revealed that more than 95 percent of the tested devices were in some way affected, and

“almost all consumer-level hardware fails when tested against USB Kill.” It’s not difficult to imagine the mischief that can be created with one in both private and publicly accessible equipment. Plus, with a price tag of €49.95 (about US $55), it’s within the budget of most pranksters.

Interestingly, the company is working both sides of the street and will also sell you its USB Protection Shield (€13.95/$15.50) which protects a connected device not only from power surges but also prevents “juice jacking.” This is where things like public charging stations can use the USB data connection to access stored data in your device or inject malware into it. Buy both at once, and you’ll receive a 50 percent discount on the shield plus free shipping. Such a deal! ▲

Small Energy Device IntroducedQuite a few IoT (Internet of Things) devices are

designed to operate under power that they harvest from the surrounding environment, thus eliminating the need to change batteries periodically. To function properly, such devices need to incorporate a power source that is compact, yet high capacity; has a long maintenance-free life; and offers fast charging and discharging. With this in mind, Murata (www.murata.com) has developed a lithium-ion electro-chemical system that is basically a modified phone battery.

The original product was dubbed the UMAC — a cylindrical device. To meet the demand for a thinner, larger capacity device, the company now has the UMAL laminate-type unit, offering a low profile of 2.0 mm, 12 mAh of capacity, low internal resistance (200 mΩ), and improved life cycle characteristics. The device is capable of continuous discharge at a C-rate of 10 (120 mA), and the charge recovery rate is 90 percent or better after 5,000 cycles. Murata plans to continue to expand its product lineup to meet future demand for even larger capacity. ▲

Shine a Light

In what is referred to as the μAFS project, a German research alliance headed up by OSRAM Licht AG

(www.osram.com; better known as Sylvania in North America) and working with functional requirements specified by Daimler AG (www.daimler.com), has developed a new automotive lighting system that promises to revolutionize road safety. In the system, each headlight contains three LED light sources, each with 1,024 individually controllable high-res light points. This means that the headlights can be adapted to provide optimal lighting to suit any traffic situation or light condition.

According to a press release, the lights “take account of every conceivable bend in the road so that there are no dark peripheral areas.” Sensors in the vehicle analyze the car’s surroundings to illuminate oncoming traffic without shining into the eyes of oncoming drivers, so it will no longer be necessary to flip over to dims.

The so-far unnamed system is still in the form of a demonstration model, but is highly likely to appear in vehicles reasonably soon. (A relatively primitive version is already used in Mercedes-Benz E-Class cars.) It looks like we’ve come a long way since the sealed-beam headlight was introduced in 1939. ▲

CIRCUITS and DEVICES

LED control module for new headlight system.

USB Kill: Don’t plug it in!

Murata’s UMAL powers IoT and similar devices.

INDUSTRY and the PROFESSION

Eckert - TechKnowledgey - Jan 17.indd 10 12/5/2016 8:06:50 PM

Page 11: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

January 2017 11

Build Your Own TeslaNo, sorry, we’re not talking about the car. Admit it, though. You’ve always

wanted a Tesla coil, right? You’d love to impress your friends with that spray of purple discharge sparks and plasma streamers. Well, if you’re willing to fork over $219 for something that’s otherwise useless, you can pick up a tinyTesla Musical Tesla Coil Kit from oneTesla (onetesla.com), available in 110V or 220V versions.

The completed kit shoots sparks up to four inches long, and a USB interruptor allows control of the coil from a laptop. As if that’s not enough, you can also make the sparks react to music you pipe in from MIDI files.

Still not impressed? Then check out the company’s full-size dual resonant solid-state musical Tesla coil ($399.99) which generates sparks up to two feet

long.In either case, it is

recommended that you also buy a set of spare replacement parts (including insulated-gate bipolar transistors [IGBTs]), as they tend to go kaput after a while. Okay, it sounds like a lot of money for a one-trick pony. But it’s a lot cheaper than the car. ▲The oneTesla MIDI controlled DRSSTC.

Murata’s UMAL powers IoT and similar devices.

R.I.P. Ali Javan

MIT Professor Emeritus, Ali Javan, the institute’s first Francis Wright David Professor of Physics, has died at

the age of 89. A trailblazer in the fields of laser technology and quantum electronics, he was primarily known as the inventor of the first gas laser. Javan was born in Tehran, Iran in 1926, and came to the United States in 1949, where he studied and worked at Columbia University with Nobel prize-winning physicist, Charles H. Townes. Having neither a bachelor’s nor a master’s degree, Javan earned his Ph.D. in physics at Columbia in 1954, with Townes serving as his thesis advisor.

While at Columbia, Javan also studied music, continuing a lifelong passion for the arts that he often connected to his groundbreaking scientific work. “Physics and music — you find the same spirit in both of them,” he wrote. “It just manifests itself in different directions. There’s something immensely beautiful about physics, even though it’s very difficult. Take the atom — a single atom is absolutely gorgeous. Ask anybody in physics.”

In 1993, Javan was presented the Albert Einstein World Medal of Science in recognition for his more than 30 years of research into the physics of lasers. In 2006, he was inducted into the National Inventors Hall of Fame. He died in Los Angeles, CA on September 12, 2016 of natural causes. ▲

Prof. Ali JavanInventor of the gas laser.

INDUSTRY and the PROFESSION

Eckert - TechKnowledgey - Jan 17.indd 11 12/5/2016 8:06:55 PM

Page 12: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

12 January 2017

In this column, Kristen answers questions about all aspects of electronics, including hardware, software, circuits, theory, radio troubleshooting, and anything else of interest to the hobbyist. Send all questions and comments to: Q&[email protected].

Q & A n WITH KRISTEN A. McINTYRE

Phantom Power and Stopping a Cough

QI am interested in creating a mute (a.k.a., “cough”) button for the microphones used by the hosts in our podcasting studio. The microphones are Audio Technica AT831B

Lavalier phantom powered from our mixer. I would like to build the circuit in a small desktop box with a button on top and XLR IN and XLR OUT on the back to insert the box between the mixing board and the microphone. I have seen a few “mute” schematics that suggest shorting pins 2 and 3, but I think this might short out the phantom power. Do you have a schematic that might work for me?

Lance HarveyMidland, TX

AI think that the schematics you’ve found are on the right track. I have a collection of Nagra audio tape recorders (beautiful machines with superb audio quality, by the way), and that’s

where my experience with this comes from. Let’s first take a look at how phantom power works.

Since some types of microphones and accessories require voltage and a little bit of power to operate, engineers came up with the idea of impressing a little power supply voltage on the signal wires. Since the audio signal is changing with time, it can be separately extracted or injected with either inductors or capacitors, depending on the implementation. In the case of balanced audio such as we see in three-wire systems using XLR connectors, we can take advantage of the three conductors to further separate the AC component from the DC component.

The convention for these balanced systems is to raise the two differential audio signals roughly equally above the

shield/ground wire. There’s a whole article that could be written on whether the shield is the same as the ground, or even if they should be connected to each other. Ward Silver’s article from the November 2016 Nuts & Volts tells the story well. An example of a simple circuit to implement phantom power on a balanced three-wire system is shown in Figure 1.

As a side note, loop-start telephone systems like POTS (Plain Old Telephone Service) lines are an example of phantom power that isn’t balanced. The phone company supplies roughly 48 volts open-circuit to the telephone instrument. That becomes a power supply that’s used to pass current through a carbon microphone where the resistance varies with sound pressure. A certain impedance across the incoming pair causes the phone switch to sense that the phone is off-hook, and the audio is impressed as small AC variations on the line. There are many more things (ring voltage, hook flash, DTMF, etc.) that can be signaled in a loop-start system. It’s a really clever design.

Of course, when we build equipment, we are never sure what will be connected to any terminals that we expose, so we have to plan for wires to be shorted and other bad situations. Phantom power is no exception, so that is why there are resistors shown in the figure to limit the worst case current supplied by the phantom power supply. Even if you were to short all of the wires from the XLR connector together, a properly designed device should be fine. We never know for sure if things are properly designed, though. Let’s just assume that for the moment.

The audio signal coming from a microphone in a balanced or differential audio system is derived from subtracting the voltages from the two differential audio pins. In the case of XLR connectors, that’s pins 2 and 3. If there is a voltage between the shield/ground (pin 1) and the other two, it is not considered to be part of the audio signal. What this implies is that pins 2 and 3 will generally be close to each other in voltage.

In order to build our cough button, we don’t need to short the entire phantom power system. All we need to do is bring the voltage difference between pins 2 and 3 to zero. That means we can indeed simply short them together with a switch (Figure 2). To be a little paranoid, you might use a very low impedance — but not zero — to connect them together.

An important consideration, though, is making sure that noise can’t leak into the system from the switch. It is probably a good idea to use a metal box to shield the switch from stray electromagnetic fields, and to connect that box to the shield/ground on pin 1 of the XLR

connectors. If an electromagnetically shielded switch is available, that would be a good choice.

Extending Wi-Fi Range on the Cheap

QMy (step) granddaughter wants to make a Wi-Fi signal extender for a science fair. I was wondering if a purely passive circuit might work. Could we put a dipole at one end of some coax

and then at the far end just have the thing loop back? If the loop was big and part of it passed near a laptop, would it rebroadcast? Would it help if the circuit was tuned to 2.4 MHz or 5.whateveritis MHz? Am I being crazy?

Randy SmithPalo Alto, CA

ANo Randy, you’re not being crazy at all! What you propose is close to what you want. It’s called a passive repeater. I’ve done it myself on the two-meter amateur band.

Instead of a loop at the far end, you’d want another dipole. The idea is to construct a dipole that is resonant in the middle of the Wi-Fi channel spectrum (or on a particular channel that she’s using), pass it through some coax, and then build a dipole of the same dimensions at the other end of the coax.

If the dipole is resonant, in other words 1/2l (or wavelength), then the feed point impedance would be 72 ohms resistive, which is very close to the characteristic impedance of RG-6 75 ohm low loss coax — what’s used in cable television everywhere. One dipole would couple energy from the propagating electromagnetic energy from the Wi-Fi base station into the coax. The energy would flow down the coax, shielded from radiating externally. Then, the dipole at the far end would reradiate that energy into the destination area.

Calculating the dipole length requires a slight adjustment to the speed of light in a vacuum. This is a somewhat complicated calculation that is dependent on the thickness of the wire relative to the wavelength. We call this unit-less number the velocity factor, and for this we will just guess that it will be around 0.95. A simple rule-

QUESTIONS and ANSWERSPost comments on this article and find any associated files and/or downloads at

www.nutsvolts.com/magazine/article/January2017_QA.

• Phantom Power and Stopping a Cough• Extending Wi-Fi Range on the Cheap• PBX and Auto Dialer

n FIGURE 1. One way to supply Phantom Power

n FIGURE 2. Example Cough Button Circuit.

McIntyre - Q&A - Jan 17.indd 12 12/6/2016 2:33:39 AM

Page 13: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

January 2017 13

shield/ground wire. There’s a whole article that could be written on whether the shield is the same as the ground, or even if they should be connected to each other. Ward Silver’s article from the November 2016 Nuts & Volts tells the story well. An example of a simple circuit to implement phantom power on a balanced three-wire system is shown in Figure 1.

As a side note, loop-start telephone systems like POTS (Plain Old Telephone Service) lines are an example of phantom power that isn’t balanced. The phone company supplies roughly 48 volts open-circuit to the telephone instrument. That becomes a power supply that’s used to pass current through a carbon microphone where the resistance varies with sound pressure. A certain impedance across the incoming pair causes the phone switch to sense that the phone is off-hook, and the audio is impressed as small AC variations on the line. There are many more things (ring voltage, hook flash, DTMF, etc.) that can be signaled in a loop-start system. It’s a really clever design.

Of course, when we build equipment, we are never sure what will be connected to any terminals that we expose, so we have to plan for wires to be shorted and other bad situations. Phantom power is no exception, so that is why there are resistors shown in the figure to limit the worst case current supplied by the phantom power supply. Even if you were to short all of the wires from the XLR connector together, a properly designed device should be fine. We never know for sure if things are properly designed, though. Let’s just assume that for the moment.

The audio signal coming from a microphone in a balanced or differential audio system is derived from subtracting the voltages from the two differential audio pins. In the case of XLR connectors, that’s pins 2 and 3. If there is a voltage between the shield/ground (pin 1) and the other two, it is not considered to be part of the audio signal. What this implies is that pins 2 and 3 will generally be close to each other in voltage.

In order to build our cough button, we don’t need to short the entire phantom power system. All we need to do is bring the voltage difference between pins 2 and 3 to zero. That means we can indeed simply short them together with a switch (Figure 2). To be a little paranoid, you might use a very low impedance — but not zero — to connect them together.

An important consideration, though, is making sure that noise can’t leak into the system from the switch. It is probably a good idea to use a metal box to shield the switch from stray electromagnetic fields, and to connect that box to the shield/ground on pin 1 of the XLR

connectors. If an electromagnetically shielded switch is available, that would be a good choice.

Extending Wi-Fi Range on the Cheap

QMy (step) granddaughter wants to make a Wi-Fi signal extender for a science fair. I was wondering if a purely passive circuit might work. Could we put a dipole at one end of some coax

and then at the far end just have the thing loop back? If the loop was big and part of it passed near a laptop, would it rebroadcast? Would it help if the circuit was tuned to 2.4 MHz or 5.whateveritis MHz? Am I being crazy?

Randy SmithPalo Alto, CA

ANo Randy, you’re not being crazy at all! What you propose is close to what you want. It’s called a passive repeater. I’ve done it myself on the two-meter amateur band.

Instead of a loop at the far end, you’d want another dipole. The idea is to construct a dipole that is resonant in the middle of the Wi-Fi channel spectrum (or on a particular channel that she’s using), pass it through some coax, and then build a dipole of the same dimensions at the other end of the coax.

If the dipole is resonant, in other words 1/2l (or wavelength), then the feed point impedance would be 72 ohms resistive, which is very close to the characteristic impedance of RG-6 75 ohm low loss coax — what’s used in cable television everywhere. One dipole would couple energy from the propagating electromagnetic energy from the Wi-Fi base station into the coax. The energy would flow down the coax, shielded from radiating externally. Then, the dipole at the far end would reradiate that energy into the destination area.

Calculating the dipole length requires a slight adjustment to the speed of light in a vacuum. This is a somewhat complicated calculation that is dependent on the thickness of the wire relative to the wavelength. We call this unit-less number the velocity factor, and for this we will just guess that it will be around 0.95. A simple rule-

of-thumb calculation to determine the length is shown in Figure 3, where A is this velocity factor. When I run the numbers with a frequency of 5.5 GHz, I get 0.026 meters, or 26 millimeters. That’s the entire length of the dipole, so each leg is half of that.

Cable TV coax is usually terminated with F connectors. She could get some solderable F connectors and then construct the dipole from copper wire. The skin effect is the tendency for electromagnetic energy to flow on the surface of a conductor at AC. This effect is more pronounced with increased frequency. As less depth of the conductor is used, the effective resistance increases.

The skin effect is quite big at the frequencies used for Wi-Fi, so low resistivity material is important, and copper is one of the metals with the lowest resistivity (though not the lowest). RG-6 coax is usually made with aluminum which is also quite good, but not as good as copper. It’s significantly less expensive, though. So, building the dipole out of copper wire is recommended.

Supporting structures should be made with something that exhibits a low relative dielectric constant so that the pattern and impedance aren’t distorted much. While the dimensions are important, they aren’t critical. A dipole has a fairly low Q (quality factor — a measure of how narrow its operational bandwidth is) given its high radiation resistance, so it works without too much impedance shift over a fairly wide range. Even if it’s off, it’s not fatal. There is just a slightly higher loss in the coax and changes to the antenna’s field strength pattern. Careful construction is warranted because of the skin effect, though. Figure 4 gives you a basic idea of what the passive repeater looks like electrically.

With this arrangement, place one dipole near the Wi-Fi base station’s antenna — preferably polarized the same way as its antenna for maximum coupling — then place the other one in another room and take signal strength measurements both with and without the apparatus. Almost all Wi-Fi transceivers have a way to measure relative field strength, often called RSSI. It is usually displayed in dBm (decibels against 1 mW).

A similar measurement of noise is usually available from the transceiver. Measurements of the RSSI and noise can be combined to produce a signal-to-noise ratio. Another study for the science fair might be how critical the dipole dimensions are to performance; both the dipole length and the separation of the wires at the feed point.

To refine the passive repeater a bit, you’d want to put around two or three ferrite beads (little toroids) on the coax near the feed point, or even just loop the coax tightly two or three turns near the feed point to decouple the outer side of the coax shield from the dipole and

QUESTIONS and ANSWERSPost comments on this article and find any associated files and/or downloads at

www.nutsvolts.com/magazine/article/January2017_QA.

• Phantom Power and Stopping a Cough• Extending Wi-Fi Range on the Cheap• PBX and Auto Dialer

n FIGURE 2. Example Cough Button Circuit.

n FIGURE 3. Dipole length rule of thumb.

McIntyre - Q&A - Jan 17.indd 13 12/6/2016 2:33:39 AM

Page 14: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

14 January 2017

improve the pattern. The shield actually looks like two conductors because of the skin effect, so you can increase the inductance of the outer part near the feed point to keep current from fl owing from the outer side of the shield to the dipole. If you don’t do that, the coax is part of the antenna and radiates along its length.

This could be good or bad, depending on what gain pattern is desired. It sounds a little crazy that the coax has two effective conductors along the shield, but you really see it in practice, even below 30 MHz. Of course, at lower frequencies like 160 meters or 1.8 MHz, you need lots of ferrite beads to make enough inductance.

There are other antenna designs that could change the gain pattern for different results, but dipoles are simple to build and they conveniently have a feed point impedance close to common RG-6 coax. I hope she gives it a try.

PBX and Auto Dialer

QI love my small PBX system and want to add an auto dialer between the CO line and the PBX. I want to detect outgoing digits (if more than two digits, no action). If they are 1, 1, then the

dialer should add prefi x 9 and dial 911 (or disconnect and dial 911) as is required by new laws. Are there simple commercially available devices or can you suggest some simple circuit to achieve such a thing?

Ankur Bhakta

AThis seems like a bit of a complicated device that will require some careful programming to make sure that the right thing happens. It’s possible to detect DTMF (dual-tone multi-

frequency) dial signals in software if the audio signal is digitized, using what’s called the Goertzel algorithm. That is a very sharp IIR (or infi nite impulse response) digital fi lter. It’s also possible to build some hardware band pass fi lters that could be monitored with a controller. Lastly, there are some specialized DTMF decoder devices like the MT8870 from Mitel. Then, you’d need some isolation transformers and relays to switch the circuit from pass-through to a way to inject generated DTMF signaling into the CO line. The algorithms for what you want to do could be written for a microcontroller like an Arduino or Raspberry Pi.

Sadly, I think this is a rather complicated thing to both construct and implement both in hardware and software — particularly as an add-on. Unless your PBX system has a software upgrade to provide the desired functionality, constructing an add-on won’t be simple. That’s not to say it’s impossible by any means. How to build such a device does exceed the extent of what I could write here, though it would be a fun undertaking if you had the time.

It turns out, though, that building up a new PBX from scratch isn’t hard. There’s an open source PBX called Asterisk (www.asterisk.org) that runs on an ordinary PC running Linux. Asterisk is designed to work with VoIP phones, but there are also POTS interface cards available.

The website has a section under “Products” that can direct you to manufacturers of hardware POTS interfaces compatible with Asterisk. Being open source, if you aren’t happy with how it works, you can change it in software.

While you’re on the Web, if you are plagued by unwanted marketing calls, be sure to search for “PBX” and “Lenny” ... NV

n FIGURE 4. Schematic representation of a Passive Repeater.

www.melabs.com

Development Tools and Learning Systems forPIC Microcontrollers

PICBASIC PRO™ CompilerPBP3

PICBASIC PRO is a trademark of Microchip Technology Inc. in the USA and other countries.PIC is a registered trademark of Microchip Technology Inc. in the USA and other countries.

Check out our popular products for PIC® developers including: U2 Programmer PICBASIC PRO 3.0 Compiler Prototyping Boards Experimenter Boards ME Labs Trainer Board and Programming Tutorial

ME Labs has been been a global leader in the creation of development tools for PIC microcontrollers for 20 years.

Contact us at [email protected] or go to melabs.com

McIntyre - Q&A - Jan 17.indd 14 12/6/2016 2:33:52 AM

Page 15: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

Toll Free: 1-800-227-7312 Fax: (480) 451-9495www.chaneyelectronics.com Toll Free: 1-800-227-7312 Toll Free: 1-800-227-7312

CHANEYELECTRONICS, INC.

PO BOX 4116, SCOTTSDALE, AZ 85261All Orders Must Include Shipping

Order Online at:

12VDC 12KV High Power Negative Ion Generator • Compact powerful

12KV negative ion generator.

• Size is 0.94” X 1.17” X 2.3” (excluding mounting ears).Requires about 200mA for operation.

• Negative ions will be emitted (6 million/CM3 at 12” from emitter brush) by just connect 12VDC to the red and black power input leads.

• Cleans air of impurities and provides a fountain of fresh air.

C9007 $8.00 ea. LIMIT 5

35 in 1 Digital LabThis reusable digital breadboard lab contains a total of 35 lessons and experiments that operate on a 9V battery(not included). Learn about Logic gates, build “0 to 99” digital counters, sequential flashers, lucky number generator and more. Includes 96 page manual and all parts. C6721 $36.95 ea.

IR VISION ROBOT KIT Kit emits invisible beams of IR lightwhichreflectsoffanyobstacles in its path. It can even be remotely controlled from up to 25 feet away. The Rover emits beeps and blinks bright colorful LEDs as it explores. Operates from only two AA batteries (not included).Skill level 2. Requires Soldering.

C6761 $36.50 ea.Learn To Solder 9V Battery Tester This kit is perfect to create a very useful 9VDC battery analyzer/tester. It lights up 2 LEDs to indicate whether the battery is in new/fresh condition, has some life left (about 7.5V to 8V) or is dead (under 7V). Size of PC board 1.9” x 3.4”.

Skill Level 1. Requires Soldering. C6972 $9.25 ea.

Exploding Star Color Organ Kit Very colorful, bright and highly animated exploding star effect is controlled by the beat of the music and a 2 IC circuit. Kit uses blinding output LEDS in red, green and yellow colors (25 total), 6 transistors and 2 ICs. Operates on one 9V battery (not included). Size of PC board is 5 1/16” x 3”. Skill Level 3. Requires Soldering.

C6818 $17.75 ea.

26 in 1 Robotics Lab • Educational, fun and inexpensive to build and

operate electronic robots. • Some of the topics

covered include: Sensor Technology, Infrared (IR) Vision, Transistor Operation, Integrated Circuits, Relay Operation, Electronic Motors and basic electronic concepts including Ohm’slawandcomponentidentification.

• Operates from one 9V battery (not included) .• Complete with detailed instructions, illustrations,

schematic, wiring guide and theory of operation.• Requires Soldering.

C6890 $54.95 ea.

Brilliant Strobe Kit This strobe light kit which features variable speed and brilliant flashes of white light from a horseshoe shaped xenon flashtube. Great for parties, discos, dances, etc. Reliable design circuit has control to vary flash rate from about 120 to 200 flashes per minute. Christmas lights, lamps, etc. Size of board: 3” x 5”. Operates from standard 120VAC. Skill level 2. Requires Soldering. C4823 $14.75 ea.

Guitar Practice Amplifier Kit With CaseThe Guitar Practice Amplifier Kitoperates on one 9V battery (not included) and delivers up to 1Watt of guitar music from a built in 3-1/2” speaker, Features standard 1/4” female jack for guitar cord, volume control, tone control, on/off switch, “on” indicator and compact case of 4.25” square x 2.25” high. Skill Level 2. Requires Soldering.

C7058 $20.25ea.

Wheel Of Fortune Kit Very popular game device! Push the start button and a bright red “ball” (LED) appears to spin around ten numbers gaining speed as you hold the button down. When you release the button, the electronic ball appears to slow down and finallycomestoastopononenumber. Skill Level 3. Requires Soldering & 9V battery.

C3806 $12.25 ea.

Lie Detector KitSimple to build kit emits a tone which changes with amount of skin resistance between two fingers.Features2copper touchplates on circuit board and small speaker. Size of circuit board: 1 1/2” x 2”. Skill level 1. Requires Soldering.

C4657 $5.50 ea.

Powerful 12VDC, 1.5Amp Switching Adapter • Compact powerful 12VDC,

1.5Amp regulated switching adapter is only 2” X 2.84” X 1.27”.

• Has 5 foot cord and 6.3mm barrel plug with 3mm center (+).

• Operates on 120VAC 60HZ.

G21027 $3.00 ea. LIMIT 5

Handy USB Power Meter This handy digital power meter displays the USB output voltage and current being drawn by whatever load you have connected to your USB port. Has male USB connector, USB adapter, USB charger and 2 output (female USB ports) to connect your Smartphone; device, accessory Ipad®, etc. Size 2.9” X 1.1” X 0.58”.

G21171 $10.95 ea. LIMIT 5

“Speedster 500” Robot Kit The “Speedster 500” robot operates from two tiny electronic brains that consist of flashingrainbow LEDs. Each time one of the LEDs flash, it causesthe robot to turn in a different direction. Operates from one 9V battery (not included). Size of board is 2.7” x 2”. Skill level 2. Requires Soldering & 9V battery.

C7048 $14.25 ea.

Mini Servo for Arduino/Robots/RC Tiny servo weighs only 9 grams but provides 1.5kg cm torque. Great for use with Arduino boards, R/C devices, robots, etc. Operating voltage 4.2V-6VDC, and 250mm flexible cable with 3position female connector. Size only 0.89” L X 0.49” W X 1.05” Tall (excluding mounting ears and top gear.)

G21501 $4.00 ea. LIMIT 5

66

Merchandise Orders of $20.00or More Can Receive:

FREE! Handy Component Holder/Clip

Simply Add Stock#NVHOLDER

To Your CartBefore Checkout LIMIT 1 coupon per Order

Compact Reliable 3.5Watt 18V at 0.19Amp Solar Panel • Monocrystaline silicon solar panel model

SW3.5W-S2.• Rated Pmax = 3.5W,

Vmp = 18V, Imp = 0.19A, Voc = 20.7, and Isc = 0.21Amp.

• Fully sealed glass frame is 6-7/8” x 7-5/8” and uses 36 silicon solar cells soldered in series!

• Perfect for hundreds of solar powered projects including: making solar powered battery chargers, cell phone chargers, landscape lighting units, etc.

G20110 $10.00 ea. LIMIT 5

Expires Feb 15, 2017

“Speedster 500” Robot Kit

Guitar Practice Amplifier Kit With Case

Full Page.indd 15 12/6/2016 2:56:58 AM

Page 16: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

We’ve all experienced the feeling of visiting a groupoutside of our own background and being

completely flummoxed by the rapid-fire jargon beingthrown around. Just as confusing are the measurements inthis alternate universe. Wireless communication seems toinvolve many such terms, but many seem to be calculatedor expressed in terms of the decibel. This column covers anumber of these measurements and values, and showsyou how to use decibels for them.

The DecibelThe “dee-bee” is everywhere in ham radio, and is

used for characterizing everything from antennaperformance to nano-sized signals. Learn the decibel(abbreviated as lower-case ‘d’ followed by an upper-case‘B’ or ‘dB’) and you and your signal will go a long way!

From the ARRL Ham Radio License Manual’s onlinemath tutorials for beginning hams (arrl.org/chpt-2-radio-signal-fundamentals), we introduce the decibel. “Youhave probably recognized deci as the metric prefix thatmeans one-tenth. The unit we are really talking about hereis the bel (a ratio of sound levels named for AlexanderGraham Bell), so a decibel is just 1/10th of a bel. We usea decibel instead of a whole bel because the belrepresents a rather large change in levels. The dB is a just-perceptible change and more useful as a unit ofmeasurement.” As used in wireless, the decibel is the ratioof two power levels:

dB = 10 log10 (P2/P1)

Note that the dB has no units because it is a ratio. The

dB is just a number that describes how much bigger orsmaller one quantity is compared to the other. Bothquantities themselves must have the same base units,though — watts, for example. If P2 is larger than P1, the dBvalue is positive, such as for amplifier gain. If P2 is less, thevalue is negative and represents attenuation or loss.(Somewhat confusingly, it’s common to specify an amountof attenuation as a positive value of dB. For example, “Thisfilter attenuates the signal by 20 dB.”)

If you want to compare voltage (or current) levels, youhave to account for the relationship between voltage (orcurrent) and power not being linear — doubling voltage(or current) is a quadrupling of power:

P = V2/R = I2R so dB = 20 log10 (V2 /V1)

You don’t necessarily have to have a calculator at theready. Just memorizing the few power dB relationships inTable 1 is easy. Remembering a simple rule for factors of10 will come in quite handy, too. Speaking in terms ofpower, any change by an exponent of 10 is a change indB of 10 times the exponent. A change of 100 (102) is achange of 20 (2 x 10) dB; a change of 1000 (103) is achange of 30 (3 x 10) dB; and so forth.

Another handy thing to remember is that multiplyingthe ratio by a factor allows you to add the dB equivalentof that factor. For example, from Table 1, a change of 20is the same as a change of 5 x 4, so a change of 20 in dBis equal to 7 + 6 = 13 dB. You could also figure that outfrom 20 = 10 x 2, so the dB equivalent is 10 + 3 = 13 dB.Doubling power — another common situation — is achange of 3 dB. By memorizing a few values and rules,you can navigate dB quite easily!

Decibel-defined Values (dBm,dBW, dBV, dBuV)

It’s quite common to need an “absolute” power level,

[email protected]

THE HAM’S WIRELESS WORKBENCH

Ham Metrics and the DecibelKnowing the language of metrics is not optional!

PRACTICAL TECHNOLOGY FROM THE HAM WORLD

Table 1 — Decibel Values for Common Power andVoltage Ratios.

P2/P1 dB V2/V1 dB

0.1 –10 0.1 -20

0.25 –6 0.25 -12

0.5 –3 0.5 -6

1 0 1 0

2 3 2 6

4 6 4 12

5 7 5 14

10 10 10 20

Online GlossaryThe ARRL’s Technical Portal (arrl.org/tech-portal) includes

several references, and you’ll also find an online glossary(www.arrl.org/ham-radio-glossary) that explains terms as hamsuse and understand them. If you are studying for your ham radiolicense, these would be good websites to bookmark in yourbrowser.

16 January 2017

Silver - Ham's Wireless Workbench - Jan 17_Hams Wireless Workbench - Sep 15.qxd 12/5/2016 10:09 PM Page 16

Page 17: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

Post comments on this article and find any associated files and/or downloads atwww.nutsvolts.com/magazine/article/January2017_HamsWirelessWorkbench_Ham-Metrics-and-Decibels.

yet need to work with gain and attenuation in dB. Thesolution is to use a single fixed reference level for allmeasurements. The value for P1 in the equation shown(the one in the denominator) is the ratio’s reference level.By using the same absolute reference value for all of yourcalculations, you also know the absolute power of themeasurement.

For example, if you use one milliwatt (1 mW) as yourreference level, all of your dB values will be calculated“with respect to one milliwatt.” This is so common inwireless that the abbreviation dBm was created. A powerlevel of 10 dBm is 10 times 1 mW or 10 mW; 3 dBm is 2mW; -20 dBm is 0.01 mW; and so forth. Because values indB are added or subtracted when the quantities aremultiplied or divided, you can easily use dBm valuesthroughout your radio system.

For example, when a 1W transmitter signal (30 dBm)is amplified with a gain of 15 dB, it becomes a 30 + 15 =45 dBm signal. A received signal of -47 dBm experiencinga cable loss of 6.2 dB is reduced to -47 – 6.2 = -53.2 dBm.

Other common abbreviations you’ll encounter in thewireless world are the dBW (reference level of one watt),dBV (reference level of one volt), and dBuV (referencelevel of 1 µV). When you see a letter appended to “dB,” itis specifying a common reference value.

Signal-to-Noise RationAnother common measurement expressed in dB is the

signal-to-noise ratio, or SNR or S/N. SNR compares thesignal power to the power of the background noise: SNR= 10 log10 (PSIGNAL / PNOISE). Often left out of thediscussion is the bandwidth of the channel over whichnoise is measured.

For example, a telephony circuit (mobile or landline)may be assumed to have a communications-qualitybandwidth of 3 kHz. It’s usually assumed to be thereceiver or amplifier bandwidth, but don’t assume that’salways the case. If you really need to know SNR with fullaccuracy, specify the bandwidth of the measurement.

In the case where interfering signals are also present— such as for a data link in a shared unlicensed frequencyband like 900 MHz or 2.4 GHz — a better measurementmight be signal-to-noise plus interference ratio or SNIR.(This measurement is also written as signal-to-interferenceplus noise ratio, or SINR.) If your data link will beoperating in a crowded band, this might be a better wayto measure and plan your communications link.

Finally, each step in the modulation/demodulation andsignal amplification chain adds some distortion productsto the desired signal. The measurement signal-to-noise plusinterference and distortion, or SINAD accounts for theseeffects: SINAD = 10 log10 [(PSIGNAL + PNOISE + PDIST) /(PNOISE + PDIST)].

Gain: Power or PatternI have mentioned “gain” several times so far in this

column and it’s time to explain there are two commondefinitions, both specified in dB. The most used definitionand probably the one you imagine when you see theword is power gain. This is what happens when an activedevice such as an op-amp or transistor or vacuum tubeuses a low level input signal to control a more powerfuloutput signal. The output signal has more power than theinput signal. That input-to-output power ratio is the gain ofthe circuit or device — pretty straightforward.

The other type of gain is created by antennadesigners. You’ll frequently see antennas specified to havesome value of gain in dB. The antennas themselves do notadd any power to the signal applied to their feed point. Infact, due to resistance, the antenna has a slight loss. Thegain being referred to — pattern gain — comes fromfocusing the signal in a certain direction so that it appearsstronger in the favored direction. This is equivalent tohaving amplified the signal by the same amount.

An antenna’s pattern gain, however, is alwaysmeasured or specified with respect to some standardreference antenna. The two most common references arethe isotropic antenna which radiates equally in all three-dimensional directions, and the dipole which radiates bestbroadside to the antenna and very weakly off the ends.(Dipoles and their radiation patterns were discussed in theSeptember 2016 column.)

If you imagine the isotropic antenna’s radiationpattern as a spherical balloon filled with radiated power, adirectional antenna like a beam or dish creates patterngain by “squeezing” the sphere. Where the signal isfocused, the sphere extends farther from the center thanwithout focusing. The ratio between the focused directionand the original equal-in-all-directions is the antenna’s gainin that direction.

Since the ratio depends on the reference antenna’spattern, antenna gain must always be specified withrespect to the reference antenna. If the reference was anisotropic antenna, the abbreviation dBi is used; dB withrespect to an isotropic antenna. If a dipole was used, theabbreviation dBd is used with the understanding that thedipole’s pattern is used where the dipole’s radiation isstrongest: broadside to the dipole. In fact, a dipole has a

■ BY WARD SILVER N0AX

Noise in Analog-to-Digital Converters (ADCs)It’s the norm these days to digitize analog signals and

manipulate them in software. As such, it’s important to understandthe noise performance of ADCs. The Analog Devices’ tutorial —“Understand SINAD, ENOB, SNR, THD, THD + N, and SFDR So YouDon't Get Lost in the Noise Floor” (AD MT-003) — is an excellenttutorial on different noise metrics of ADCs.

You can download it for free at www.analog.com/media/en/training-seminars/tutorials/MT-003.pdf.

January 2017 17

Silver - Ham's Wireless Workbench - Jan 17_Hams Wireless Workbench - Sep 15.qxd 12/5/2016 10:12 PM Page 17

Page 18: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

gain of 2.2 dBi, so you can convert dBd to dBi by adding2.2 dB and vice versa by subtracting dBi. When you seean antenna advertised as having “x dB of gain,” you haveto ask, “With respect to what?”

SWR and Return LossThe notion of standing wave ratio, or SWR was

introduced in the January 2016 column. Basically, it is ameasure of how much power in a feed line is transferredto the load and how much is reflected back toward thesignal source. Reflections occur because of a mismatchbetween the load impedance and the feed line’scharacteristic impedance. SWR can have a value of 1:1(no reflection, all power transferred to the load) and ∞ (allpower reflected, as at an open- or short-circuit).

Such a wide range (1 to ∞, but not beyond) is okayfor the relatively imprecise world of amateur radio andmost hobby applications. Typically, if the SWR atransmitter “sees” looking into a feed line is less than1.5:1, everything works well. Professionals, however, wanta more precise measurement at both high and low valuesof SWR. They use return loss, or RL.

RL is measured in dB as the ratio between powerreflected back toward the signal source and the forwardpower from the source: RL = -10 log (PREFL / PFWD ). If PREFL

= 0, then RL = ∞ and SWR is 1:1. If PREFL = PFWD, then RL= 0 dB and SWR is ∞. There is a handy online converterfor RL and SWR at the Microwaves101 website atwww.microwaves101.com/calculators/872-vswr-calculator.

Effective Radiated Power (ERP)When planning a wireless communications system or

broadcast installation, you have to know the strength ofthe transmitted signal in order to figure out how well it willbe received. With so many different factors affectingradiated signal strength, it’s hard to compare “apples toapples.” As a result, the concept of effective radiatedpower, or ERP was devised. ERP accounts for gains and

losses throughout the entire antenna system, from thetransmitter to the antenna. The resulting valuerepresents how much power it would take to create thesame signal strength using a standard referenceantenna. The standard antenna can be an isotropicantenna with no pattern gain in any direction or adipole antenna which has 2.2 dB more gain broadsideto the antenna than an isotropic antenna. Like thedecibel-defined value discussed earlier, a letter can beadded to ERP to indicate which reference is used. EIRPis the ERP calculated with respect to an isotropicantenna; if no letter is added (ERP), then a dipole isassumed to be the reference. To convert ERP to EIRP,add 2.2 dB to account for the dipole’s higher gain.

An example is useful in explaining how ERP works.Figure 1 shows a typical transmitting installation thatmight be installed at a shared communications site. Let’sstart with the transmitter power output, or TPO of 1.5 kW.This is an absolute power level of 10 log10 (1500) = 31.7dBW. The transmitter is connected to a filter that removesany harmonics but also has an insertion loss, or IL of 0.5dB. (This loss is due to losses in the inductors andcapacitors and connecting wires.) To prevent othertransmitted signals from coming down the feed line andgetting into our transmitter output, an isolator is used thatonly allows power to flow toward the antenna. It, too, hasinsertion loss, and the amount of loss is 0.8 dB. Feed linesalso have loss, and at the frequency of the transmittedsignal (for this length of feed line) the loss is 2.5 dB.Finally, the antenna is a bay of folded dipoles with apattern gain of 6 dBi. So, what is our EIRP and ERP?

• EIRP = TPO – Filter IL – Isolator IL – Feed Line IL +Antenna Gain

• EIRP = 31.5 dBW – 0.5 dB – 0.8 dB – 3.5 dB + 6 dBi =32.7 dBW = 1862W

• ERP = EIRP – 2.2 dB = 32.7 dBW – 2.2 dB = 30.5 dBW= 1122W

This makes sense because our transmitter would haveto work 2.2 dB harder to create the same signal strengthat the receiver if it only used an isotropic antenna. As youcan see, it’s quite easy to work with dBW and dB insteadof having to calculate everything in watts.

Bandwidth and SpuriousEmissions

Finally, interference is a fact of life with wirelesssystems. Sometimes it’s accidental, but it’s alwaysannoying. The FCC (Federal CommunicationsCommission) sets standards for how transmitters mustbehave in order to be good neighbors and sharespectrum. Key to establishing common ground is a cleardefinition of terms, and one of the most important is

FIGURE 1.

18 January 2017

Silver - Ham's Wireless Workbench - Jan 17_Hams Wireless Workbench - Sep 15.qxd 12/5/2016 10:09 PM Page 18

Page 19: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

bandwidth. While there are lots of differentdefinitions of bandwidth floating around, there’sonly one that matters on the air and that is theFCC’s definition! For the amateur service,bandwidth is defined in the FCC’s rules, Part97.3(8): The width of a frequency band outside ofwhich the mean power of the transmitted signal isattenuated at least 26 dB below the mean powerof the transmitted signal within the band. Whatthat means is for whatever signal you aretransmitting — data, AM voice, FM voice — theFCC will average (take the mean of) thetransmitted signal power and find the frequencieson either side of the signal at which the signal’sstrength is 400 times (26 dB = 20 dB + 3 + 3 dB =100 x 2 x 2 = 400) weaker. The differencebetween those two frequencies is the signal’s bandwidth.Figure 2 gives you an idea of how this works.

Spurious emission is the term for any component ofthe transmitted signal that is unnecessary or unintentional,and which is stronger than 26 dB below the signal’s meanpower. As you can see from the figure, spurious emissionsfar from the signal can cause interference to signals onadjacent channels and, in fact, this is quite common.Perhaps the transmitter isovermodulated, causing extrasidebands to appear to either side.Perhaps a speech processing circuitisn’t operating properly and distortsthe signal and creates these extrasignals. Harmonics of a signal arealso spurious emissions. These arealmost always present because notransmitter is perfect. There arealways some minor non-linearitiesthat produce harmonics. If you havean AM broadcast station nearby witha frequency below 800 kHz, set yourcar or portable radio to twice thestation’s frequency and drive towardthe transmitter. At some point, you’llhear a distorted version of the sameprogramming from the secondharmonic of the transmittedfundamental. (There is no “first”harmonic — that’s the fundamental.)If you have a general-coverage short-wave or “world band” receiver, youcan probably find the third harmonicas well. Don’t get too close to thetransmitter or your receiver will beoverloaded and start generatingharmonics internally all by itself!“Spurs” aren’t always the fault of thetransmitter!

Signing OffDecibels are everywhere in wireless communications.

They allow us to compare and discuss signals many ordersof magnitudes different in amplitude without having to usecumbersome notation or lots of zeroes! Gettingcomfortable with the “dee-bee” is a great first step inunderstanding radio signals and the systems that producethem. NV

FIGURE 2.

January 2017 19

Silver - Ham's Wireless Workbench - Jan 17_Hams Wireless Workbench - Sep 15.qxd 12/5/2016 10:09 PM Page 19

Page 20: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

20 January 2017

BUILD IT YOURSELF

The game of chess is considered bymany to be very complicated andplayed by people who enjoy achallenge. Actually, the rules of howthe chess pieces can move are fairlysimple and easily learned. What makesthings complicated is the total numberof different ways a game can progress.After each side has played threemoves, the pieces could form any oneof over nine million possible positionson the board. The number of distinct40 move games is far greater than thenumber of electrons in the observableuniverse. If you are not familiar withchess, Wikipedia has an excellentintroduction to the game athttps://en.wikipedia.org/wiki/Chess.The chessboard layouts shown hereillustrate the various allowable movesfor each chess piece. The moreesoteric castling, en passant, andpromotion moves are not included inthis project, although they could beadded to the software.

By Theron Wierenga

Rook moves.

Queen moves.

Pawn moves.Knight moves.

An Electronic ChessboardUsing RGB LED Strips and

HALL EFFECTSENSORS

Bishop moves.

King moves.

Wierenga - LED Chess - Jan 17 - part 1_Blank Project NV.qxd 12/5/2016 10:18 PM Page 20

Page 21: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

The black circlesrepresent the squares

where each piece canmove. The knight is theonly piece that can jumpover other pieces. Thepawn’s first move can beeither one or two squaresforward if those squares areempty. After the pawn’sfirst move, it can only moveforward one square ifempty. The X positionsmark where the pawn cancapture an opponent’spiece, which is limited to adiagonal move forward ofone square.

My Path toBuildingThis

Some time back, mygrandson mentioned acircuit board for gaming hewas working on in hiscollege program. Ourdiscussion led me tothinking about building achessboard using an arrayof RGB LEDs and somesort of detector to monitorthe position of the chesspieces. I experimented withan array of 256 individualRGB LEDs placed in a 16 x 16 array, using a block of 2 x2 LEDs for each board square. For the detector, I triedusing reflective IR sensors. After many attempts, I got aprototype to barely work. Scanning 256 LEDs is notsimple, but worked fairly well. The problem was the IRdetectors. Their output was read with an Arduino Mega2560 analogRead() which gave differing values for each IRdetector. This coupled with the fact that as the ambientlight in the room changed, the IR detector’s valueschanged as well, it was just a matter of a few chess movesbefore the IR detectors gave an error.

After some experience using RGB LED strips, itoccurred to me that this might be an easier way of drivingthe LEDs on an electronic chessboard. Once an LED is

turned on, it does not need to be continually refreshed.My previous experience had me deciding against using IRdetectors, so I went instead with Hall effect sensors.Thechess pieces have a small magnet in their base to triggerthe Hall effect sensors. I also moved from using anArduino Mega 2560 to a Teensy 3.1, which has moreRAM and a 72 MHz clock, as opposed to 16 MHz for theArduino. It can also be easily programmed with theArduino GUI. You will need to download and install theTeensyduino software package to program the Teensy 3.1with the Arduino GUI. Download information andinstructions can be found at https://www.pjrc.com/teensy/teensyduino.html.

This chessboard does not play a chess game againstyou. The chessboard is used by two players, and the basicobjective is to keep track of the board and the rules of thegame for both players. This makes it a nice learning devicefor the beginning chess player. The LEDs light up to showa player where a piece can be moved, and whether there

January 2017 21

Post comments on this article and find any associated files and/or downloads at www.nutsvolts.com/magazine/article/January2017_Electronic-Chessboard-LEDs-Hall-Effect-Sensors.

Arduino Mega 2560 Teensy 3.1

RAM 8K 64K

Program Space 256K 256K

Clock Speed 16 MHz 72 MHz

(Full size schematicavailable at article link.)

■ FIGURE 1.Schematic of thecompletechessboard circuit.

Wierenga - LED Chess - Jan 17 - part 1_Blank Project NV.qxd 12/5/2016 10:18 PM Page 21

Page 22: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

is an opponent’s piece that can be taken. Illegal moves aredetected, as well as when the king is in check.

The chessboard operation does not include the threemore esoteric moves — castling, en passant, andpromotion — although these could be added. This projectcan be expanded upon and if you are interested in chessprogramming, it has the potential to add intelligentresponses or even game play. Teensy 3.1 pins 0, 1, 9, and10, RX1, TX1, RX2, and TX2 were left unused and broughtout to pads, allowing for an interface to a PC. Thehardware for this project is fairly minimal. The main costwas the printed circuit board. I designed mine using thefree software available from ExpressPCB and thenuploaded my design to them when ordering the boards.Their web address is https://www.expresspcb.com. Thisboard is 11-1/2 x 11-1/2 inches, and a minimum of twoboards must be ordered. If you can make your own board,that will save you some money. It might be possible tobuild the hardware on a breadboard of some sort, but itwill take some effort with all the connections that are

necessary. As for thesoftware, it is alreadywritten and is availableat the article link. Whatthe circuit basicallyconsists of is an 8 x 8array of Hall effectswitches that arescanned a row at atime. The results of thisscan produce an 8 x 8array indicating wherethe chess pieces are

currently placed. Surrounding each Hall effect switch is asquare of four RGB LEDs which represents a square onthe chessboard. The LEDs are laid out and glued down as16 strips that wind back and forth across the board.

Connections are also available on the board tooptionally connect a four-line LCD display and a Real TimeClock (RTC) using an I2C interface. The LCD display hasbeen incorporated in my software, but the RTC was not.

The BuildI have provided two different versions of the printed

circuit board layout for an ExpressPCB board at the articlelink. The only difference is that one uses a standard DIP(Dual Inline Package) layout for the 74HTC138 and theother an SMT (Surface-Mount Technology) layout for thisintegrated circuit. The RGB LED strips were laid outstarting at the top of the printed circuit board (PCB),alternately going left to right and then right to left asshown in Figure 2. This simplified the layout of the PCB,reducing the length of the traces between strips.

The RGB LED strips have adhesive on the bottom toattach them, and my first thought was just to stick themdown on the PCB. Since these strips would be placed overvarious circuit board traces on the top of the board, Ibecame concerned about creating a possible short on thePCB. I ended up gluing a strip of very thin tag board to thebottom of the RGB LED strips with Super Corona Dope™from MG Chemicals, which is an excellent insulatingvarnish. The tag board surface was then glued down to thePCB with the Super Corona Dope. (Perhaps a little overkill,but it guaranteed no short circuits.) These strips areconnected to the PCB by short pieces of wire solderedfrom the tabs on the LED strip to pads on the board.

There are two caveats when using these strips. I foundthat a short delay (I used one millisecond) was necessarybetween setting individual pixel colors. An example is inthe colorSquare() function. Without this delay, the pixelcolor appears to be off by one position. This error wasintermittent and the higher clock rate of the Teensy 3.1may be the issue here. The other precaution I took withdriving the RGB LED strip was not to drive the signal inputdirectly from the Teensy 3.1 3.3 volt output. I placed a7413 dual NAND Schmidt Trigger inline between theTeensy and the signal input. These are four input NANDs

22 January 2017

■ FIGURE 2. Layout of the first four RGB LED strips on the chessboard.

■ FIGURE 3. The circuit board mounted in a small woodenframe with the LCD display and restart switch.

Wierenga - LED Chess - Jan 17 - part 1_Blank Project NV.qxd 12/5/2016 10:18 PM Page 22

Page 23: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

and because one will invert the signal, the two NANDgates were used is series. With this in place, the strip isdriven by a five volt line.

The Teensy 3.1 is essentially a faster replacement forthe Arduino line of microcontrollers with added features. Itwas chosen because of its higher speed, adequateprogram space, and additional RAM, which is needed forthe software that drives the chessboard. I elected to usean IC socket for the 28-pin Teensy 3.1, with the thought ofease of removal if the Teensy is damaged. Unsoldering abad 28-pin IC is inviting damage to the PCB. The Teensy3.1 can be powered by a 3.7 to 5.5 volt source, but itsI/O is at the 3.3 volt level. While this will interface directlywith five volt ICs like the 7400 TTL and HTC series, itshould be noted that its output will not directly drive aPNP transistor powered with five volts. This is because the3.3 volt high output does not come close enough to thefive volts to turn off a PNP transistor. The chessboardcircuit has a five volt powered 74HCT138 three- to eight-bit decoder between the Teensy and the PNP transistorsthat power the rows of Hall effect sensors, which takescare of this problem. The 74HCT138 also reduces thenumber of I/O lines needed on the Teensy 3.1.

Allegro 3144 Hall effect sensors were chosen becausethey are inexpensive and readily available. They have aSchmidt trigger open collector output with a littlehysteresis which gives noise-free switching when themagnet moves into or out of the field of the sensor. Smallneodymium disk magnets — 10 x 3 mm graded N50 —were glued into the bottom of a set of plastic chesspieces, with the correct magnet face placed at the bottomof the piece. I put together a single 3144 on a breadboardwith an LED for output to determine the correct magnetface to place toward the 3144 to switch it on (see Figure5). The pins on the 3144 are bent at a right angle so thatthe face of the 3144 with the part number on it pointsupward when mounted on the PCB. Care needs to betaken to insure that the 3144 stands high enough off thecircuit board to allow the magnet to switch this sensor;therefore, I used the full length of the 3144 leads.

I mounted a piece of 1/4 inch Plexiglas to the top ofthe circuit board using 5/8 inch spacers and 4-40 machinescrews. I soldered in one 3144 to a height where I wasconfident the magnets in the bottom of the pieces wouldactivate the 3144 through the Plexigas surface. The chesspieces sit on the Plexiglas with the LEDs underneath,

representing the chessboard squares.After mounting the single 3144, I cut a small strip of

wood that just fit snugly under a row of the 3144s andtaped it down with blue masking tape. This served as a jigwhen soldering in a row of 3144s such that they would allbe the same height above the PCB and is shown in Figure6. The 3144 has an open collector output and all theoutputs of a column of eight are connected together. Arow of 3144s is then powered by the PNP transistor andeach column read one at a time by the Teensy 3.1.

The chess piece set I used was purchased fromhttps://www.wholesalechess.com and is their AnalysisChess Pieces set. They are inexpensive and small; the kingis 2-1/2 inches tall and the pawns are 1-1/4 inches, but arejust the right size for the chessboard. The bottom has a 10mm hole which perfectly fits a 10 mm diameter by 3 mmthick neodymium disk magnet. The magnets press-fit intothe base of the chess pieces very easily. However, there isa problem — especially with the lightweight pawns.

When another piece gets near a pawn or you place apiece slightly off center, the magnets repel each other and

January 2017 23

■ FIGURE 4. Prototype printed circuit board before installingthe 64 Hall effect sensors.

■ FIGURE 5. Hall effect test circuit.

■ FIGURE 6. Wooden strip used to hold a row of 3144s in place forsoldering.

Wierenga - LED Chess - Jan 17 - part 1_Blank Project NV.qxd 12/5/2016 10:18 PM Page 23

Page 24: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

you can unintentionally move a piece causing thechessboard to throw an error. My solution was to gluedown thin cork disks to the bottom of the pawns creatinga little friction. This keeps them from sliding away fromother nearby pieces unless they are nearly touching. Thepieces must be placed directly above the Hall effectsensors to work. A piece well off center will not be readby the sensor, causing an error.

SoftwareThe first thing the program must do is turn on the

LEDs to display a chessboard. This is made quite easy byusing Adafruit’s Neopixel library to drive the RGB LEDstrip. For complete information on this library, visitAdafruit’s website at https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library. All operations onLEDs will operate on squares of four LEDs. A little simplemath is needed to go from one of the 8 x 8 positions onthe board to the linear strip of 256 RGB LEDs.

The LEDs were mounted starting at the top of theboard going left to right, with the next row going right toleft, and then repeating eight times. This minimizes thelength of the traces on the PCB that connects each row ofLEDs. The colorSquare() function takes the x,y position ofthe square, its color, and whether it should be turned onimmediately, and with a little math, turns on the four LEDs.Note that I went from using multiplication in my formulasto bit shifting, which is faster:

// Color an x,y square with a specific colorvoid colorSquare(byte x, byte y, uint32_t color, bool on){

if ((x >= 0) && (x < 8) && (y >= 0) && (y < 8))// is it a legal square ?

{int num1 = (y << 5) + (x << 1);

// same as num1 = y * 32 + x * 2;int num2 = num1 + 1;int num3 = (y << 5) + 31 - (x << 1);

// same as num3 = (y * 32 + 32) - (x * 2) - 1;int num4 = num3 - 1; // Needs a short delay, otherwise intermittent // errors on positionpixels.setPixelColor(num1, color); delay(1);pixels.setPixelColor(num2, color); delay(1);pixels.setPixelColor(num3, color); delay(1);pixels.setPixelColor(num4, color); delay(1);if (on) pixels.show();

}}

The colorSquare() function not only displays thestandard chessboard layout, but by using other colors canshow the correct positions that pieces can occupy with amove, or positions where pieces can be taken.

From here, a function is created that lights up all theLEDs in a chessboard array of blue and red:

// Color a chessboard with blue (for black) and red // squaresvoid standBoard(){

for (int y = 0; y < 4; y++)

{for (int x = 0; x < 4; x++){

colorSquare(x * 2, y * 2, colors[RED], false);colorSquare(x * 2 + 1, y * 2, colors[BLUE], false);colorSquare(x * 2, y * 2 + 1, colors[BLUE], false);colorSquare(x * 2 + 1, y * 2 + 1, colors[RED], false);

}}pixels.show();

}

Note that instead of turning on each square as it iscreated, we wait until all the squares have been set totheir desired colors and then turn them on at once. Thisreduces flicker in the display:

// Color all squares, red for error alert, blue for // checkmate// Seems to work OK without a delayvoid colorBoard(uint32_t color){

for (int i = 0; i < NUMPIXELS; i++){

pixels.setPixelColor(i, color); }pixels.show();

}When an error occurs — like trying to make two

moves in a row — the function colorBoard() is used tocolor the entire chessboard in red. No math is needed inthis case. Each RGB LED is simply set to red using a 32-bitcolor code, and then turned on. Writing the software torespond to moves on the chessboard is a challenge. Afterdoing a little research on the Internet to make a decisionon how best to represent the chessboard in a program,my impression was that there are as many ways to do thisas there are programmers writing chess programs. Thebasic math structure chosen to represent the chessboardgreatly affects how the program will operate on its data.Because many programs run on PCs (or even fastercomputers) that actually play chess, there is a pushtowards speed. With 64-bit computers, the match to the64 squares on a chessboard works well, and “bitboard”structures are common.

A board representation called “0x88” might havebeen a better choice for my program. The name comesfrom the fact that ANDing hexadecimal 0x88 with a boardlocation in this structure and getting a result that is notzero tells you if you are off the edge of the board. Thecode of the 0x88 structure is efficient and brief. However,it consists of a lot of bitwise operations. Reading the codeusing this structure is not intuitive and can be confusing —especially if you are not a seasoned programmer or arenew to chess.

For ease in understanding the logic of my code, Iselected 8 x 8 and 12 x 12 arrays of bytes to represent thechessboard, which helps visualization and keeps the mathstructure simple. This board representation may not be themost efficient, but I really wasn’t too concerned about

24 January 2017

Wierenga - LED Chess - Jan 17 - part 1_Blank Project NV.qxd 12/5/2016 10:18 PM Page 24

Page 25: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

speed since the chessboard is not going to look at allpossible plays several moves ahead. Due to the differentsizes of the two different types of arrays, the programcode does contain a large number of array indices thatadd a -2 or +2 to the index. Some of the worst bugs in myprogram code were simply due to forgetting this point.

There are two key arrays that represent the board. Thefirst — which I label piecesVal[12][12] — identifies eachpiece and their placement on the board at startup. Asecond array — piecesValCur[12][12] — maintains thepiece’s current positions and identifies each piece as theyare moved. Various 8 x 8 arrays are used when readingthe Hall effect sensors to determine where pieces arelocated. Just about any set of numbers could be used torepresent the different pieces. The 1 through 16 numbers Ichose supposedly represent the relative values of thepieces. The number 128 was added to the byte value (bit7 set) to indicate the white pieces. These values areplaced in #define statements so the piece names can beused in place of the numbers:

// White = 128, white at bottom, starting positions// Black = 0, add color to piece value// // Black White// Pawn = 1 and 129// Knight = 3 131// Bishop = 4 132// Rook = 5 133// Queen = 9 137// King = 16 144

// Defines for chess pieces and spaces#define BORDER 255#define EMPTY 0#define BLACK_PAWN 1#define BLACK_KNIGHT 3#define BLACK_BISHOP 4#define BLACK_ROOK 5#define BLACK_QUEEN 9#define BLACK_KING 16#define WHITE_PAWN 129#define WHITE_KNIGHT 131#define WHITE_BISHOP 132#define WHITE_ROOK 133#define WHITE_QUEEN 137#define WHITE_KING 144

byte piecesVal[12][12] = {{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255},{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255},{255, 255, 5, 3, 4, 9, 16, 4, 3, 5, 255, 255},{255, 255, 1, 1, 1, 1, 1, 1, 1, 1, 255, 255},{255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255},{255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255},{255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255},{255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255},{255, 255, 129, 129, 129, 129, 129, 129, 129, 129, 255, 255},{255, 255, 133, 131, 132, 137, 144, 132, 131, 133, 255, 255},{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255},{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}};

The 8 x 8 array is surrounded by two rows andcolumns of values set to 255 or 0xFF Hex. This boundarymakes it a little easier to check for pieces moving off theboard. The bank of two was necessary because a knight

can jump two spaces over. So, for example, in code wecould use:

if (piecesValCur[y][x]) == BORDER)// We are off the board in one comparison

instead of:

if ((y < 0) || (y > 7) || (x < 0) || (x > 7))// We are off the board in possibly four comparisons

Instead of using numbers like 255 and 16 in thesoftware, it is much more understandable to use thedefines like BORDER and BLACK_KING. This has beendone wherever possible in the software.

The piecesValCur[y][x] array contains not only theposition using the indices, but the number values thatidentify the exact piece as well. However, when we readthe Hall effect sensors, we will only get a reading that tellsus where pieces are located — not their values. So, whenreading the Hall effect sensors, we can find that position3,4 has changed and there is not a piece there comparedto a previous reading. We then use the 3,4 indices in thepiecesValCur[y][x] array to find which exact piece wasremoved. Reading the Hall effect sensors gives us thisarray on startup:

byte piecesCurrent[8][8] = {{1, 1, 1, 1, 1, 1, 1, 1},// [y][x] Where current piece are located

{1, 1, 1, 1, 1, 1, 1, 1},{0, 0, 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0, 0},{1, 1, 1, 1, 1, 1, 1, 1},{1, 1, 1, 1, 1, 1, 1, 1}};

In addition to the piecesCurrent[y][x] array, similararrays are maintained that are used when doing the actualreading of the Hall effect sensors. The two arrays are thencompared to determine what piece has been moved.Notice that these arrays do not need the two rows andcolumns of additional values to denote positions off theboard:

// Read a row of 8 Hall Effect sensorsint readLine(int row, byte piecesTemp[][8]){

// Read each sensor in a row looking for a zero, // which means a piece is there.// The 3144 Hall Effect sensors are open collector // output and pull to ground when activated.// We invert the zero to place a one in our array if // a piece is on a square.// After each read we add to count to keep a running // total.int count = 0;piecesTemp[row][0] = !digitalRead(2);count += piecesTemp[row][0];piecesTemp[row][1] = !digitalRead(3);count += piecesTemp[row][1];piecesTemp[row][2] = !digitalRead(4);count += piecesTemp[row][2];piecesTemp[row][3] = !digitalRead(5);count += piecesTemp[row][3];piecesTemp[row][4] = !digitalRead(6);

January 2017 25

Wierenga - LED Chess - Jan 17 - part 1_Blank Project NV.qxd 12/5/2016 10:18 PM Page 25

Page 26: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

count += piecesTemp[row][4];piecesTemp[row][5] = !digitalRead(7);count += piecesTemp[row][5];piecesTemp[row][6] = !digitalRead(8);count += piecesTemp[row][6];piecesTemp[row][7] = !digitalRead(12);// Oddball because we skipped 9, 10 count += piecesTemp[row][7]; // for serial RX, TX, Serial2 on Teensy 3.1return count; // return number of pieces found in this row

}

// Read all 8 lines of the Hall Effect Sensorsint readHall(byte piecesTemp[][8]){

// The function calls readLine() 8 times to read all // 8 rows of Hall Effect sensors// When finished piecesTemp[8][8] has positions of // pieces on board// Before each read we set the 3 bit address to the // 74138// The total number of pieces on the board is // returnedint count = 0;digitalWrite(A0, LOW);digitalWrite(A1, LOW);digitalWrite(A2, LOW); // 000delay(1); // let 3144 settlecount += readLine(0, piecesTemp);digitalWrite(A0, HIGH); // 001delay(1);count += readLine(1, piecesTemp);digitalWrite(A0, LOW); // 010digitalWrite(A1, HIGH);delay(1);count += readLine(2, piecesTemp);digitalWrite(A0, HIGH); // 011delay(1);count += readLine(3, piecesTemp);digitalWrite(A0, LOW); // 100digitalWrite(A1, LOW);digitalWrite(A2, HIGH);delay(1);count += readLine(4, piecesTemp);digitalWrite(A0, HIGH); // 101delay(1);count += readLine(5, piecesTemp);digitalWrite(A0, LOW); // 110digitalWrite(A1, HIGH);delay(1);count += readLine(6, piecesTemp);digitalWrite(A0, HIGH); // 111delay(1);count += readLine(7, piecesTemp);delay(100);return count; // return count of all pieces on the board

}The functions readLine() and readHall() do the work of

scanning the 64 board positions and creating an 8 x 8array telling us where pieces are located, and also returnthe number of pieces found. The readLine() function scansa single row. Notice here that it would have been simplerto do a read of the D port pins 0-7 on the Teensy 3.1. Inone line of code, we would have read all eight Hall effectsensors in one row. However, that would mean that wecould not use pins 0 and 1 with our serial monitor.

In most of my projects, I try to leave these two pins

unused by circuitry external to the microcontroller. Beingable to use Serial.print() statements in your code to beread in real time using the embedded serial monitor in theArduino GUI is a great aid in debugging code. Pins 9 and10 were also left unconnected and brought out to padson the PCB. This pair of pins implements RX2 and TX2 onthe Teensy 3.1 and can be used to connect thechessboard to other external circuits or a PC.

Instead of a D port read, we use eight digitalRead()statements that are negated to read a single row ofsensors. The Hall effect sensors are open collector, andwhen activated they read as a 0. So, for clarity, this isnegated to a 1, representing a chess piece in that location.

The readHall() function calls readLine() eight times,after setting the three-bit address to the 74HCT138 toselect each row. Here again, a port C output could havesimplified things a little, but that could have interferedwith the A4 (SDA) and A5 (SCL) I2C signals which arereserved for communicating with an LCD display or RTC.After the call to readHall(), the piecesTemp array will showthe locations of all the pieces on the chessboard andreturn the total number of pieces found on the board.

At this point, all of the functions that interact with thehardware need to be described.

We will pause here for this month. Next time, therewill be an overview of the main sections of the softwarethat contain the logic for supervising a chess gamebetween two players. The loop() section of the programtakes you through the first player's turn and then, on thenext pass through, changes the turn to the second person.Inside the logic is the ability to detect which piece is liftedand display all its possible moves. There will also be someerror checking and looking for a king in check orcheckmate. If you just can't wait, you can obtain the entireArduino program from the download section. Keep inmind that this program is intended to run on a Teensy 3.1.NV

26 January 2017

Teensy 3.1 microcontroller74HCT138 3-to 8 decoder7414 Dual Schmidt triggerAllegro 3144 Hall effect sensors (64)2N3906 PNP transistors (8)470 ohm Resistors (8)2700 μF 6.3 volt Electrolytic capacitor0.1 μF Disk capacitors (2)Five volt/two amp Power supply, wall wart typePower jack to match power supplyLCD display, four-line/20 character with I2C two-wire

interfaceMomentary pushbutton switchProgrammable RGB LED strip, five meters, 60 LEDs per

meter(You'll need 256 LEDs of the 300 LEDs in the strip.)

Printed circuit boardInsulating varnish like Super Corona Dope™Analysis Chess Piece set from www.wholesale chess.comNeodymium disk magnets, 10 mm diameter by 3 mm thick,

grade N50 (32)Miscellaneous header pins, four-pin header jumper cable,solid 22 gauge hookup wire, screws, nuts washers,spacers, wooden frame, 1/4 inch Plexiglas

PARTSLIST

Wierenga - LED Chess - Jan 17 - part 1_Blank Project NV.qxd 12/5/2016 10:18 PM Page 26

Page 27: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

Vintage ComputingThe Retro PIC Single-

Board ComputerBy Dan Gravatt Post comments on this article and find any associated files and/or downloads at

www.nutsvolts.com/magazine/article/January2017_Retro-PIC-Single-Board-Computer.

First, I’m not a very good programmer and Idon’t do assembly language; and second,those computers stored their code inEPROMs (programmable read-only

memory chips that were erased with ultravioletlight through a clear window in their cases) and I didn’thave an EPROM programmer. After looking at some of theproposed schematics for Z80 based systems atwww.z80.info, I was inspired to design such a system(Photo 2) around a 40-pin PIC16F887 which I do knowhow to program. I figured thiswould put some of my historicchips to work and be a greatlearning tool for understandinghow a microcomputer works.

In general, a microcomputeris a small (relative to a mainframe— the other type of computer inuse when this term was coined inthe 1970s) self-containedcomputer with separate CPU,RAM, ROM, I/O, and some sortof non-volatile storage medium,with the separate componentslinked by address and data busesthat can be expanded to includeadditional devices. A

microcontroller, on the other hand, has these separatecomponents merged on a single chip with limitedamounts of memory and I/O, and usually no expansionbuses. I’ve used microcontrollers for years and love theirsimplicity, but when programming them with high-level

languages it’s easy to forgetwhat’s going on “under thehood” between those variouscomponents. Sometimes a betterknowledge of the hardware-levelprocesses can make you a betterprogrammer and debugger.

For this project, the PIC getstreated like a true CPU withPortC as a dedicated address busand PortD as a dedicated databus (Figures 1a and 1b). ThePortC address bus connects tostatic RAM and EPROM totaling64 kilobytes, and uses an eight-bitlatch to form the necessary 16address lines. The PortD data bus

January 2017 27

Over the years, I have accumulated abunch of chips from before the era oftrue PCs (Photo 1) when computerswith names like Altair, KIM-1, andCosmac ELF were popular. I’ve beenlooking for a way to use them in newprojects, but until now I’ve held backfor a couple of reasons.

PHOTO 1 : CPUs,RAMs, EPROMs,

and supportchips — all

waiting to bereused.

PHOTO 2 : The PIC SBC.

Gravatt - Retro PIC SBC - Feb 17_Blank Rough NV.qxd 12/5/2016 11:00 PM Page 27

Page 28: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

connects to the RAM and EPROM, as well as an eight-bitoutput latch and an alphanumeric LCD. Size constraintson the circuit board kept me from including more period-appropriate peripheral chips such as the 8255 parallel I/Ocontroller, the MC146818 real time clock (RTC), andsome sort of disk controller chip, so I had to compromisethe “retro” nature of the project a bit by including an I2C

bus for the RTC and nonvolatile storage EEPROM.Of course, a computer needs a keyboard and a

display, so there’s a PS/2 keyboard interface and an RS-232 serial link to use an old laptop computer as a “dumbterminal.” The block diagram in Figure 2 shows the

functional relations between all these parts. Let’s dive inand see how to make these parts work together.

KeyboardThe PS/2 keyboard uses a synchronous serial interface

to send 11-bit packets of data to the host computer, withthe keyboard generating the clock signal for theinterface (see References). PS/2 keyboard scan codesare a random nightmare — there’s just no other way todescribe them. Take a look at the spreadsheet I created(available at the article link) to help me figure out howto translate them into ASCII. The keyboard sends databoth when you press a key (usually one or two packets)and when you release it (usually two or three packets),but most of that data is irrelevant for our purposes.

If that wasn’t complicated enough, paired keys likeshift, ctrl, alt, numbers, and enter send different codesdepending on which one you press! There is no formulathat can transform the scan code data into thecorresponding ASCII character, so I used the 256-byteEEPROM in the PIC as a one-to-one translation matrix,where the scan code is the address of the byte

Vintage Computing

28 January 2017

FIGURE 1B: Schematic of the memory and latchportions of the SBC.FIGURE 1A:

Schematicof the CPUand I/Oportions ofthe SBC.

Full size schematics are availableat the article link.

FIGURE 2: Block diagram of the SBC.

Gravatt - Retro PIC SBC - Feb 17_Blank Rough NV.qxd 12/5/2016 11:03 PM Page 28

Page 29: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

containing the character.The code for keyboard input supports the core

functions (all characters, shift, backspace, enter, escape)necessary for this project without taking up too muchcode space, and without using interrupts. It works wellwith a 4 MHz clock speed as long as you are not a super-fast typist. See the comments in the code at the articlelink for more on how it works.

MemoryCPU communication with external memory consists

of an address bus to select the required byte, a data busto either read or write that byte, a chip select signal toactivate only the desired chip on the bus, and read andwrite signals to tell the memory chip whether to send orreceive data. The CPU starts by placing the address on thememory chip’s address inputs, and then places data onthe data bus (for a write) or sets its data bus pins to inputsto read data. The desired memory chip is activated with itsindividual chip select input, and then its read or writeinput is activated to complete the transfer.

The order and timing of these steps is specified in thedatasheet for each type of memory chip (see References).This project uses a 62256 32 kilobyte static RAM and a27C256 32 kilobyte EPROM. The EPROM can be hard tofind as a new part, so use one from your collection ofvintage chips. Address bit A15 is used to handle the chipselect signal for the two memory devices through aninverter logic gate, so one or the other chip is alwaysselected. Address bits A0-A14 then select the byte withinthe selected chip. This means that sending the 16-bitaddress handles the chip select and byte addresssimultaneously, which is okay if you respect the overall

signal timings for the chip.The read and write signals are generated with the

PIC’s PortE: a three-bit port that drives a 74HC138 three-to-eight decoder chip. Until the memory chip receives aread or write signal, its data bus connections are internallydisconnected or “tri-stated” so they do not interfere withdata transfers with other chips on the bus. When thesignal is received, the selected memory chip accepts thedata on the bus for a write, or places the data from theselected address on the bus for a read. I’ve placed a“Data” LED on output 0 of the decoder which will flickerwhen data is being transferred; it can also be used to sendblink codes to the user.

From the PIC’s perspective, the PortC address bus andthe PortE decoder bus are always outputs, but the PortDdata bus must rapidly switch between outputs and inputsas necessary throughout the code. Look for lots of trisd =255 and trisd = 0 statements in the code in the datatransfer subroutines. Also look for the address latchoperation that presents the 16-bit address to the bus astwo separate bytes — similar to the way the old CDP1802microprocessor and some others addressed their memory.

Latch and LCDA true CPU can only use its data bus pins to drive the

inputs of other logic chips because they are a “logic level”interface that has almost no capacity to supply current.They cannot directly control an LED, serial port, or anyother device in the “real world.” In addition, since the databus is usually busy talking to the memory, it cannot affordto be tied up with those functions. A variety of interfacechips usually share the data bus to provide the necessaryreal world connections and free up the bus. Interfacechips have their own read, write, and enable inputs, andare generally accessed similarly to memory chips exceptthat they usually don’t use the address bus.

In this design, a 74HC574 octal latch acts as a simpleoutput-only interface chip on the data bus. To use it, thePIC places a byte on the data bus and uses the 74HC138decoder to send a pulse to the latch’s clock pulse input.The data is then available on the latch’s outputs and is nolonger just “data,” but can be used to control real worlddevices.

The alphanumeric LCD in the project also acts a lotlike a latch on the data bus. The HD44780 compatibledisplay controller has an eight-bit data interface, aread/write input, an “RS” input which tells the controllerwhether the data on the bus is text to be displayed or acommand to be executed (such as clearing the display),and an “E” input that latches the data into the controller.The RS input can be shared with address line A7 to save apin on the PIC since you will never being accessing thememory at the same time you are writing to the LCD. The74HC138 decoder’s active-low output drives the LCD’sactive-high E latch input through an inverter. The high-levelLCD control commands available in various PIC

Vintage Computing

January 2017 29

REFERENCES“Legacy Communication with the 32-bit Micro

Experimenter,” Nuts & Volts, October 2011

Retro microcomputer designs using the Z80www.z80.info

Retro microcomputer designs using the CDP1802www.cosmacelf.com

Description of PS/2 keyboard protocolswww.burtonsys.com/ps2_chapweske.htm

62256 SRAM datasheethttp://web.mit.edu/6.115/www/document/62256.pdf

27C256 EPROM datasheethttp://ecee.colorado.edu/~mcclurel/fnm27c256.pdf

PCF8563 datasheetwww.nxp.com/documents/data_sheet/PCF8563.pdf

PIC16F887 datasheetww1.microchip.com/downloads/en/DeviceDoc/41291D.pdf

24LC512 datasheetww1.microchip.com/downloads/en/DeviceDoc/21754M.pdf

Gravatt - Retro PIC SBC - Feb 17_Blank Rough NV.qxd 12/5/2016 11:00 PM Page 29

Page 30: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

programming languages simply automate the process ofpresenting data bytes to the display controller and togglingthe RS and E inputs to complete the data transfer. For thisproject, the R/W input of the controller is hard-wired toground (write-only) on the LCD module itself.

I2CThe I2C bus is a true bus like the CPU’s address and

data buses, in that multiple devices share the sameconnections to the CPU but can be accessed individually.In contrast to the separate parallel address and data busesdiscussed above, I2C provides data, address, chip select,and read/write control to its devices over a singlesynchronous serial connection. This greatly cuts down onthe physical connections needed for the bus. Note thatmuch of the schematic in Figure 1a is taken up by thewires for the CPU’s address and data buses. The tradeoffis that the I2C’s serial data streams transfer data moreslowly than the parallel-mode buses.

For this project, we’re moving relatively modestamounts of data on the I2C bus a few bytes at a time toand from the PCF8563 real time clock chip, and up to64K bytes for the 24LC512 EEPROM. The entire EEPROMcontents can be read in a few seconds — not unlike theperformance of an early eight inch floppy drive. Much ofthe time required for a write to the EEPROM is taken up

by pauses to let the chip complete its write cycle, which ison the order of 5-10 milliseconds — an eternity in CPUtime. This is an example of how better understanding thehardware improves your code. If you don’t allow for thesepauses between write cycles, the writes will fail!

The EEPROM is internally broken up into 128-byte“pages” and supports a block-write mode where a singleI2CWRITE instruction can save up to 128 bytes. This modeis faster than writing a byte at a time since there is onlyone 5-10 ms pause required per block. It also saves wearand tear on the EEPROM, which is guaranteed for a largebut not infinite number of write cycles.

If you use this mode, you must keep track of theEEPROM addresses you are writing to so that the blockwrite does not cross a page boundary and garble yourdata in the process. This does not affect read operationsfrom the EEPROM, which can start and end anywhere.

The PCF8563 RTC can be hard to find in an eight-pinDIP package. I’ve specified a surface-mount part in theParts List because it is readily available. You can use acommercially-available adapter to attach the SO-8 packageto the circuit board, or fabricate a “spider” adapter fromsome leftover resistor leads. The DS1307 RTC is availablein a DIP package and is mostly pin-compatible with thePCF8563, so you could substitute that with somemodifications to the code and circuit board.

StackCPUs and

microcontrollers have asmall array of registersthat are used to store theaddress of a programinstruction that jumps toanother instructionlocation but needs to beable to find its way backto where it started, suchas CALL or GOSUB. Thisarray is called a stack, andit is limited in size. ThePIC16F887 has an eight-level stack that cansupport eight nestedCALLs (i.e., a CALL withina CALL within ...).PICBasic PRO uses four ofthese levels for its owninternal purposes, leavingfour nested levels for usein your code.

I learned the hardway that neither the PICnor PICBasic PRO willwarn you if you writecode that creates a stack

Vintage Computing

30 January 2017

ITEM PART # (DIGI-KEY) DESCRIPTIONU1 PIC16F887-I/P-ND PIC microcontroller, 40-DIPU2 1450-1182-5-ND 32 Kb static RAM, 28-DIPU3, U6 (2) 296-1598-5-ND 74HC574 octal latch, 20-DIPU4 32 Kb EPROM, 28-DIP (see text)U5 296-1577-5-ND 74HC14 hex inverter, 14-DIPU7 296-1575-5-ND 74HC138 decoder, 16-DIPU8 24LC512-I/P-ND 64 Kb EEPROM, 8-DIPU9 568-6650-1-ND PCF8563 real time clock, SOIC-8U10 LM34DZ/NOPB-ND LM34 temperature sensor, TO-92(optional)LCD NHD-0224BZ-FL-GBW-ND 2x24 character displayD1, D2 1N4148FSTR-ND Signal diodeD3 754-1720-ND Green LED, T-1D4 516-1769-ND Amber LED, T-1D5 1N5399-E3/54GICT-ND Reverse protection diodeC1, C2 Optional, see PIC datasheetC3 399-1418-ND 10 μF tantalumC4-C7 399-4151-ND 0.1 μF ceramicC8, C9 Optional, see textC10 Frequency trim cap; see PCF8563 datasheetR1 10KEBK-ND 10K 1/6 wattR2, R3, R6, R7, R12 4.7KEBK-ND 4.7K 1/6 wattR4, R8, R9, R10 1.0KEBK-ND 1K 1/6 wattR5 22KEBK-ND 22K 1/6 wattR11 1.0MEBK-ND 1M 1/6 watt (optional)SP1 445-2525-1-ND Piezoelectric beeperX1 631-1081-ND 4 MHz crystalX2 300-3007-ND 32 kHz crystalX3 Optional, see textJ1-J6 S1011EC-40-ND 0.1” straight headerJ7 CP-1560-ND PS/2 Mini-DIN-6S1 ED3048-5-ND 40-pin DIP socketS2, S4 (2) ED3052-5-ND 28-pin DIP socketSW1 450-1665-ND SPST momentary switchBT1 BS-7-ND Battery holder for CR2032(none) S1111EC-40-ND 0.1” right-angle header for

memory jumpers

PARTSLIST

Gravatt - Retro PIC SBC - Feb 17_Blank Rough NV.qxd 12/5/2016 11:00 PM Page 30

Page 31: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

overflow by trying to store too many addresses on thestack. You can’t read the stack pointer to tell howmany levels have been used, so you have to keeptrack manually while coding. Reading the fine print ofthe PIC’s datasheet may be overwhelming, but it willhelp your coding and debugging!

Putting It All TogetherWhile it is theoretically possible to breadboard this

circuit (Photo 3), you’ll really want a circuit board. I’vebuilt some flexibility into the hardware — particularlywith respect to the memory. The pinouts of the 62256SRAM and 27C256 EPROM are not identical, but onlythe functions of pins 1 and 27 differ. I added two two-position jumpers on the back of the circuit board (notshown on the schematic for clarity) to swap thefunctions of these two pins (Write/Vpp and A14) andallow Socket 0 to hold a SRAM oran EPROM. If you have smallercapacity memory chips such as a6264 8K SRAM or a 27C128 16KEPROM, these can also be used withsome caveats. You’d think that theun-needed address pins for thesechips would simply be “no-connect,”but sometimes they are used asadditional chip select inputs. Checkyour datasheets carefully and eithermodify your code to set these inputsas necessary or break a trace or two on the circuit boardto set them in hardware.

The schematic and PCB layout support a few otherhardware options, including a general-purpose crystaloscillator using a couple of leftover inverters; an externalcrystal oscillator for the PIC for greater clock accuracy orif you want to run faster than its 8 MHz internal clocklimit; access to the clock and interrupt outputs of the RTCchip; and a three-terminal analog temperature sensor.There is also an unused output on the 74HC138 decoderthat can be used to access other data bus devices or drivea piezo speaker.

Note that there are no pads for R11 on the circuitboard as I just couldn’t find space for it, so you’ll have tosolder it across the pins of crystal X3 on the back of theboard; the same goes for R12, the pull-up resistor for theopen-collector CLKOUT pin of the RTC.

The circuit board holes for the case mounting tabs ofJ7, the mini-DIN PS/2 keyboard jack are not full size asthey are too close to the edge of the board. Use a cutoffwheel or hobby saw to cut notches in the edge of theboard to accommodate these tabs.

A potential application for this project is an EPROMprogrammer or “burner.” One of the Socket 0 jumpersisolates the programming voltage pin on the EPROMwhich is set at logic high for read operations, but typicallyneeds around 13 volts for programming. A simple external

circuit under PIC control (Figure 3)applies the programming voltage tothe EPROM as needed and turns theproject into an EPROM burner.Check the programming voltagespecifications for your particularEPROM and adjust the values of R2and R3 accordingly. Make sure toUV-erase your EPROMs first; this setsall the bits to “1” and the burningprocess turns some of them intozeros. A better programmer than I

could write a bootloader that would run PIC code storedon the EPROM to expand the 8K code space in the16F887. The main reason that this project uses an eight-bit-at-a-time memory address scheme is to free up theeight PortB pins on the PIC for general-purpose I/O. Usethem as another data bus to talk to some of your vintageinterface chips on a separate circuit board, or takeadvantage of some of the special functions available onPortB like analog inputs or external interrupts.

The code I’ve written for this project uses a verysimple command-line structure to select subroutines thatdemonstrate the hardware functions described above.Among other things, it will check for the presence ofSRAM or EPROM in Socket 0 and adjust the SRAM startaddress accordingly. I’ve also included a very bare-bonesfile system to use the EEPROM as a tiny disk drive; itsstructure is explained in a separate tab of the referencespreadsheet available online.

A 9600 baud serial link with a laptop running aterminal program displays the list of files on the “disk” andsupports data import to and export from the SBC. Acommand reference that explains how each subroutineworks is also available online. There are plenty ofcomments to explain the code and help you roll your ownPIC based operating system. So, dust off those vintagechips, read their datasheets, and build a microcomputer tocall your own! NV

Vintage Computing

January 2017 31

FIGURE 3: Voltage selector circuitfor EPROM programming.

PHOTO 3:Prototype SBC on

breadboards.

Gravatt - Retro PIC SBC - Feb 17_Blank Rough NV.qxd 12/5/2016 11:00 PM Page 31

Page 32: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

For those of you who aren’t familiar with RSS,according to Webopedia: “RSS is the acronymused to describe the de facto standard for thesyndication of Web content. RSS is an XML

based format and while it can be used in different waysfor content distribution, its most widespread usage is indistributing news headlines on the Web.”

An RSS XML document — also called a feed orchannel — includes summarized headline text along withmetadata like publication date and author information.

The RSS acronym itself has had numerous definitionsover time. Originally, it meant RDF Site Summary; later,RSS was defined to mean Rich Site Summary. Currently,RSS is understood to mean Really Simple Syndication.Regardless of the true definition, in this article I will usethe term RSS to mean an Internet feed of headlines fromone or more news/information sources. If you have beenreading Nuts & Volts regularly, you probably have noticedthat I have written quite a few articles about putting theNodeMCU Amica module with an embedded ESP8266-12chip to work. Those articles include:1. “Meet the ESP8266: A Tiny Wi-Fi Enabled ArduinoCompatible Microcontroller” in the October 2015 issue.2. “Thinking of You” in the November 2015 issue.3. “ESP8266 NTP Clock” in the June 2016 issue.4. “ESP8266 Weather Clock” in the November 2016 issue.

All of these projects were developed within theArduino integrated development environment (IDE) usingthe ESP8266 as a relatively high performancemicrocontroller with a built-in Wi-Fi interface. That is to sayno other microcontroller was used to control the ESP8266as a peripheral like in so many other ESP8266 projects Isee on the Internet. Hosting applications directly on theESP8266 itself both drives project costs down andincreases reliability at the same time as a result of fewerparts and less software involved.

In this article, I’m going to describe an RSS newsreader application I built on the same hardware as myprevious two articles. Again, that’s the NodeMCU Amicamodule, an Adafruit 1.8” TFT LCD display, a pushbuttonswitch, USB cable, USB power supply, and some wire.With this hardware, you can upload the NTP clocksoftware and have an auto setting time and date clock;upload the weather clock software, and get current andforecasted weather conditions for your location along withthe NTP clock functionality; or the software I provide withthis article to have the RSS news reader all withoutchanging a single wire or component.

As supplied, the software for this news reader hashardcoded RSS feeds for NPR, CNN, AP, L.A. Times, BBC,Reuters, and USAToday, and it is a simple matter to addyour own feeds and/or delete or reorder any that I havesupplied. Once the RSS reader is configured, it willconnect to your local Wi-Fi network and then make arequest for headlines from NPR (which happens to be atthe top of the feed list, but more on that later). It willcontinuously cycle through the display of headlines byhorizontally scrolling them across the LCD. After allheadlines have been displayed, a new request to NPR will

I admit it. I am a self-proclaimed news nut. I don't know, but this might actuallybe an undiagnosed illness since I look at the news on the web constantly duringthe day and then watch the news in the evenings on TV. There is alwayssomething going on in our world (for better or worse) that I don't seem to wantto miss. So, when I was thinking about other applications for the amazingESP8266, I thought why don't I write an RSS reader so I can monitor theheadlines from many different news sources from around the world. Then, ifsomething catches my attention, I can open up my laptop and read the full story.

ESP8266 RSSNews Reader

32 January 2017

FIGURE 1. Fritzing connection diagram/schematic.

Lindley - RSS News Reader - Jan 17_Blank Rough NV.qxd 12/5/2016 11:07 PM Page 32

Page 33: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

be made and the process repeats.If, however, you press and

hold the feed advancepushbutton until the last headlinehas scrolled off of the screen, youwill advance to the next feed onthe feed list and its headlines willthen be displayed. When aheadline has an associatedpublication date, this will bedisplayed on the LCD as well.

To summarize, the RSS newsreader will continuously displayheadlines from the selected newsfeed until the feed is changedusing the feed advancepushbutton or it is powereddown. Since the news readermakes a new request every timeall of the headlines have beendisplayed, the headlines you seewill be as up-to-date as the newssource itself.

HardwareAs mentioned, the RSS news reader uses the same

hardware as described in my previous ESP8266 articles. Tosave you from going back and (re)reading previousarticles, the hardware information is repeated here startingwith the Parts List. Figure 1 shows a Fritzing connectiondiagram/schematic for the RSS news reader. Figure 2shows the design wired up on a breadboard. The newsreader is powered via a USB cable and a USB powersupply module, although it could be powered by pluggingit into your computer. The wire by wire connections areshown in Table 1 because they might not be clear fromthe Fritzing diagram.

The GPIO designations are shown as that is howthese digital I/O lines are referred to in the Arduino code.

The Adafruit LCD display also has a micro-SD memorycard interface which can be used with the ESP8266, but itwas not needed for this project.

SoftwareAs mentioned, the software for the ESP8266 RSS

news reader was developed using the Arduino IDE.See my previous articles and/or the Resourcessection for how to set up the Arduino IDE on yourcomputer for targeting ESP8266 type devices. Makesure to select “NodeMCU 1.0 (ESP-12E Module)” asthe board type in the tools menu.

The ESP8266 news reader software is availablefor download at the article link. To use this software,

unzip it and copy/move theESP8266RSSNewsReader directoryfrom the zip file into your Arduinodirectory. While the hardware isabout as simple as it gets, thesoftware is somewhat complicatedand is made up of the files shownin Table 2.

In addition to the files listed inTable 2, a modified version of theAdafruit_GFX library is required.This library provides text andgraphics functions for the LCDdisplay when connected to anESP8266 device. Whereas thestock library is available athttps://github.com/adafruit/Adafruit-GFX-Library, the modifiedversion of this library I used todevelop the RSS news reader isincluded in the zip file for thisarticle. Remember, libraries must

be installed in the arduino/libraries directory on yourdevelopment computer and the Arduino IDE must berestarted to recognize them.

RSS News ReaderSoftware Operation

Before you can use the RSS reader, you must supplylogin information for your Wi-Fi network. You do this byopening up the main sketch/program fileESP8266RSSNewsReader.ino and finding the following userconfiguration section:

// ******************************************// Start of user configuration items// ******************************************// Set your WiFi login credentialsconst char * WIFI_SSID = “xxxxxxxx”;const char * WIFI_PASS = “xxxxxxxxxxx”;// ******************************************// End of user configuration items// ******************************************

FIGURE 2. RSS news reader breadboard.

By Craig A. Lindley Post comments on this article and find any associated files and/or downloads atwww.nutsvolts.com/magazine/article/January2017_ESP8266-RSS-News-Reader.

Parts List

Part Source

NodeMCU Amica R2 Module Electrodragon.com

1.8” TFT SPI LCD Display (blacktab) Adafruit.com — Product ID: 358

Pushbutton Switch SPST RadioShack or anywhere else

USB Cable — USB A to USB Micro B RadioShack or anywhere else

USB Power Supply(capable of at least one amp at five volts)

RadioShack or anywhere else

Hook-up Wire and Breadboard RadioShack or anywhere else

January 2017 33

Lindley - RSS News Reader - Jan 17_Blank Rough NV.qxd 12/5/2016 11:07 PM Page 33

Page 34: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

This information allows the ESP8266 to login to yourWi-Fi network as required to access the RSS feeds acrossthe Internet. The login screen shown in Figure 3 is displayedon the LCD while the login process is occurring. It will bereplaced with the RSS news reader screen shown in Figure4 when the login process completes successfully. Checkyour Wi-Fi login credentials (WIFI_SSID and WIFI_PASS) ifthe login screen doesn’t go away. You’ll also notice towardsthe top of the sketch this array of character strings:

// Array of feed URLsconst char *rssFeedURLs [] = {

“www.npr.org/rss/rss.php?id=1001”,“http://rss.cnn.com/rss/cnn_topstories.rss”,“http://feeds.bbci.co.uk/news/rss.xml”,“http://hosted.ap.org/lineups/SCIENCEHEADS-rss_2.0.xml?SITE=OHLIM&SECTION=HOME”,“http://www.latimes.com/rss2.0.xml”,“http://rss.cnn.com/rss/cnn_tech.rss”,“http://feeds.reuters.com/reuters/topNews”,“rssfeeds.usatoday.com/usatoday-NewsTopStories”,

};

This is the RSS feed list with the NPR feed as the firstentry. That is why the first feed displayed by default isNPR. As you use the feed advance pushbutton, you movedown the list one RSS feed at a time. When youincrement past the last entry, you wrap around to the firstagain. You can easily delete feeds from this list orrearrange their order to suit your preferences. You caneven add feeds to this list by Googling the news provideryou are interested in and looking for the URL they publishfor their RSS feed(s). Once you have that, insert it into thefeeds list, recompile the code, and upload it to theNodeMCU Amica module, and you will be all set.

Most of the remaining code in theESP8266RSSNewsReader.ino sketch file is concerned withdeclaring instances of the LCD driver, the text scroller, andthe RSS reader classes and initializing them. The loop()function in the sketch continually calls the read function ofthe RSSReader class, passing the URL of the RSS feed todisplay. The code for the RSSReader is the most complexin this application. The complexity is a result of having to

request the headline information from a newssource and then to extract the information ofinterest from the XML returned from the source.For those not familiar with XML, it is a softwareand hardware independent tool for storing andtransporting data in human readable format.• XML stands for EXtensible Markup Language• XML is a markup language much like HTML• XML was designed to be self-descriptive• XML is a W3C Recommendation

More information on XML can be found in the linksin the Resources section. Usually in an RSS news readerapplication hosted on a PC, a full blown XML parserwould be employed to extract the headlines and otherpertinent data. Unfortunately, I couldn’t find an XMLparser that could fit in the memory available on theESP8266, so I had to use a different approach for dataextraction. Without going into too much detail, theportions of the RSS XML that I wanted to retrieveresemble the following:

<title>This is some headline from a news feed</title><description>This optional component of the news story provides more detail than the title</description>

<pubDate>Fri, 06 Nov 2015</pubDate>

All of the components have the same format: a starttag like <title>, followed by the actual content, followedby an end tag </title>. Whereas the title portion of anews headline is required in the RSS XML, the descriptionand the pubDates are not. Note that this applicationdoesn’t currently use the description information fromthe XML even though the code supports retrieving it.

To extract data from the XML, I wrote a Finite StateMachine (or FSM) that is fed every character returnedfrom the news source over the Internet. The FSM ignores

34 January 2017

Table 2.

File Description

ESP8266RSSNewsReader.ino

Main program. Initializes the hardwareand software, logs into the local Wi-Finetwork, initializes the RSS readercallbacks, and prepares the loop()function for accessing and retrievingthe selected RSS feed.

ESP8266_ST7735.cppLCD driver code specific to the Adafruit1.8” (blacktab) display utilizing thehardware SPI interface of the ESP8266.

ESP8266_ST7735.h Header file for the LCD driver code.

RSSReader.cpp

Implementation of the RSSReaderclass. The RSSReader has a lot offunctionality including implementing acrude parser for extracting informationfrom RSS XML documents; has codefor parsing URLs to extract the hostand the path components; and thecode that requests the RSS documentsfrom news sources across the Internet.It also manages the feed advancepushbutton.

RSSReader.h Header file for the RSSReader code.

TGFunctions.hMisc functions for formatting text andgraphical data for display on the LCD.

TextScroller.cppClass for horizontally scrolling textstrings on the LCD display.

TextScroller.h Header file for the TextScroller code.

Icons.hData for the Wi-Fi icon used on thelogin screen in XBM format.

Table 1.

NodeMCU Amica PinAdafruit 1.8” LCD Display

ConnectionNews Feed Advance

Pushbutton SPST Switch

D1 (GPIO 5) SW1

D3 (GPIO 0) LITE

D4 (GPIO 2) D/C

D5 SCK

D7 MOSI

D8 (GPIO 15) TFT_CS

3V3 VCC

GND Gnd SW2

Lindley - RSS News Reader - Jan 17_Blank Rough NV.qxd 12/5/2016 11:07 PM Page 34

Page 35: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

all characters until it sees an opening<. Then, it starts to listen for the tagsof interest, which in this case are: title,description, and pubDate. If it findsone of these, it starts collecting thetext starting after the > in the start taguntil it sees < which is the start of theend tag. Once the text is collected, acallback (more on callbacks shortly) ismade to the main program passing this text. Afterthe callback completes, the FSM goes back tolistening for an opening < character and the processrepeats.

The complete XML text is processed this way.This is not as elegant or as easy of a solution toparsing XML as using a real XML parser, but it getsthe job done. The RSSReader class has three functions thatallow application code to register interest in the dataextracted from the RSS XML. They are:

void setTitleCallback(pt2Function titleCallback);void setDescCallback(pt2Function descCallback);void setPubDateCallback(pt2Function dateCallback);

where the argument to these functions is a functionpointer defined as follows:

// A function pointer for callbacktypedef void (*pt2Function)(char *);

A pt2Function is a pointer to a function that takes asingle argument which is a pointer to a char string andreturns nothing or void. Because the code in the mainsketch is interested in both the title and pubDateinformation from the RSS XML, it defines the titleCallbackand the pubDateCallback functions as shown here:

// Callback called every time a title tag is // found in the RSS XMLvoid titleCallback(char *titleStr) {

char buffer[TITLE_BUFFER_SIZE];// Make buffer emptybuffer[0] = ‘\0’;// First add a leading space char to make // reading easierstrcpy(buffer, “ “);// Then add the title stringstrcat(buffer, titleStr);

// Then add some trailing spacesstrcat(buffer, “ “);// Scroll the composite texttextScroller.scrollText(SCROLL_Y, buffer);

}// Callback called every time a pubDate tag is // found in the RSS XMLvoid pubDateCallback(char *dateStr) {

drawCenteredText(DATE_Y, 1, dateStr, COLOR_RED, COLOR_BLACK);

}Later in the setup() part of the code, the RSSReader is

made aware of these functions via the following:

// Setup callbacks for title and pubDate tags // in RSS XMLreader.setTitleCallback(&titleCallback);reader.setPubDateCallback(&pubDateCallback);

At runtime, the following sequence of events occur:1. A request is made to a news source for its RSS

information.2. The returned XML is parsed by the RSSReader

code, and when a title element is found, the titleCallbackfunction is called; when a pubDate element is found, thepubDateCallback function is called.

3. The titleCallback formats the title data and sends itto the text scroller for horizontal scrolling across the LCDdisplay.

4. The pubDateCallback simply displays the dateStringpassed in, centered on the LCD display.

Using callbacks is a way to keep the code organizedand structured, and to prevent the code from becomingone big mess to maintain.

ConclusionBy using a single circuit, you can have an auto setting

clock, a weather clock, or an RSS news reader. If you area self-proclaimed news nut like myself, why don’t youbuild one of these devices for your desk?

This way, you are never very far away from the latestheadlines. NV

January 2017 35

ResourcesInformation about XML can

be found atwww.w3.org/XML.

Information aboutprogramming the ESP8266in the Arduino environment

can be found at github.com/esp8266/Arduino and

in my four articlesmentioned previously.

Information about theNodeMCU Amica can be

found at www.electrodragon.com/product/nodemcu-lua-amica-r2-esp8266-

wifi-board.

Information about theAdafruit 1.8” TFT SPI LCDdisplay can be found at

www.adafruit.com/products/358.

FIGURE 3. Wi-Fi loginscreen. This screen willbe displayed duringthe Wi-Fi login process. FIGURE 4. RSS news reader

screen. The large font is thescrolling news headline.

Lindley - RSS News Reader - Jan 17_Blank Rough NV.qxd 12/5/2016 11:07 PM Page 35

Page 36: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

Bench Werx describes the PCB Rax system asan easy-to-use, versatile circuit board holderfor board repair, prototyping, and assembly.The basic PCB Rax consists of two side rails

with feet, connected by threaded rods that allow the railsto clamp rectangular circuit boards between them, plusfour extension brackets that connect to the rails atadjustable angles to hold smaller or different shapedboards. Figure 1 shows these components assembled intothe PCB Rax system, ready to hold a circuit board forassembly or rework.

To put the system through its paces, I assembled fourcircuit boards of varying size and complexity that I foundlurking in my goody box. These included an Elenco SP-3BSolder Practice Kit (partially completed by the grandkids),an ancient Parallax S-2 Robot Badge kit, an old PocketMini Computer kit from Propellerpowered, and oneParallax EDU circuit overlay board that I used to build out

a current project of mine. These boards are mostlythrough-hole construction with a few surface-mountcomponents, and they have varying component densitiesand component proximity to board edges. They representmost of the PCB assembly tasks that I encounter as ahobbyist. I also placed a few components on an oldprototype board, then removed and replaced them tosimulate some board repair (Figure 2).

To cut right to the chase, I’ve been building thingselectronic for a long time, and I was a bit skeptical that thePCB Rax could add much value to the process I’vedeveloped over the years. With my curiosity still intact, Ispent about eight hours over six different sessionsevaluating the system. I found it easy to learn and easy touse, and I discovered that circuit board assembly and repairwent noticeably quicker and easier using the PCB Rax. I likethis tool, and I’m going to order one. Here’s why.

With 50 plus years of hobbyist soldering under mybelt, I’ve become something of a minimalist, now relyingon tape, clips, and trained fingers to get the most out ofmy simple 15 watt iron. I no longer have a full-timeelectronics bench or even a soldering station, and I longago traded in my big oscilloscope and signal generator fortiny PC-driven devices that hide in a desk drawer and see

I was recently asked to review a product that readers may soon seeadvertised in this magazine — the PCB Rax system from Bench Werx. A quicklook of the Bench Werx website (see www.benchwerx.com/pcb-rax) had meintrigued, and I agreed to put the PCB (printed circuit board) Rax through itspaces and report back the results. Here’s what I found.

Bench Werx Offers aVersatile PCB Holder

FIGURE 1. The PCB Raxsystem from Bench Werx.

FIGURE 2. Projects completed for thisevaluation. Note the different board sizes,shapes, and component densities.

REVIEW

36 January 2017

Weston - PCB Rax review - Jan 17_Blank Rough NV.qxd 12/5/2016 11:12 PM Page 36

Page 37: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

the light of day only occasionally. This minimalist approachhas been working okay for me for some time. So, couldthe PCB Rax teach this old dog a new trick? It turns out itcould, and did. The first thing you notice when unpackingthe PCB Rax is the care with which it was packed. Whilenot as fancy, it brought to mind the pride Apple andothers display with their product packaging. The nextthing you notice is the heft and finish of the PCB Rax. It isaircraft grade aluminum, anodized with a nice blue finishwith quality fittings — top drawer, just asking for a placeon your bench. So, could it make a difference in myhobbyist circuit board work?

Assembling the PCB Rax is straightforward and quick— just follow the excellent video instructions on the BenchWerx website. Once the system was assembled, I startedwith the Elenco SP-3B Solder Practice Kit, which is a 2-1/2” x 4” rectangular board with generous componentspacing and areas to practice solder bridge avoidance andtrace repair. Placing the board in the PCB Rax horizontally,I adjusted the extension backers to hold the board cornersand tightened the tension knobs on the rails.

There are a lot of possible adjustments (important tothe flexibility of the system) and it took me a few minutesto get the hang of things. I soon had the Elenco PCB heldsecurely and was stuffing components and emulatingboard repair (Figure 3).

At first, the system seemed only marginally better thanmy tried-and-true method of placing a single component,securing it with a small heatsink clamp, tacking one lead inplace, then soldering all the leads — with all work done fromthe trace (underside) of the board. This required repeatedflipping of the PCB Rax for each component, which thesystem supported nicely, but which didn’t seem to be anyreal improvement over my old non-PCB Rax method.

So, I positioned the system to hold the boardvertically, tightening the tension knobs to make sure thePCB didn’t slip in the extension brackets. Now, I couldstuff several components at once, then swing the PCB Raxaround and solder them all in the same pass. The littleheatsink clamp was still required to secure components,but now I was starting to see some benefits of the PCBRax (Figure 4).

Next, I tackled the Parallax S-2 Robot Badge kit, whichis a roughly circular PCB 1-1/2” in diameter with onlythree components. By now, I was getting comfortable withPCB Rax adjustments, but I was still surprised how easy itwas to secure the small round board (Figure 5). This boardwas through-plated with nice lands on either side, and Ilearned that I could tack some components from thecomponent side (using gravity to hold them in placeinstead of my heatsink clamp), then set the PCB Rax

By Dane WestonPost comments on this article and find any associated files and/or downloads at

www.nutsvolts.com/magazine/article/January2017_Bench-Werx-PCB-Rax.

FIGURE 3. The Elenco Solder Practice Kit, withthe PCB Rax in the horizontal position. Thisposition was good for trace repair and (flippedover) component insertion.

FIGURE 4. The Solder Practice Kit in thevertical position. This allows soldering

multiple components in one pass and offersaccess to both sides of the board at once.

FIGURE 5. Assembly of the S-2 Robot Badge.Note the heatsink clamp holding a component

in place for soldering.

January 2017 37

Weston - PCB Rax review - Jan 17_Blank Rough NV.qxd 12/5/2016 11:12 PM Page 37

Page 38: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

vertically and solder the whole lot. I was beginning to geta feel for this new system (Figure 6).

Having made short work of the Robot Badge kit, Idecided to attempt an old Pocket Mini Computer (PMC)kit which consisted of a 2” x 3” “shield” for the ParallaxQuickStart Board, with a 1” x 1” daughterboard on top.These boards were mostly through-hole with somesurface-mount components, and component density washigh with a number of headers and connectors at theboard edges. These characteristics embody much of the

PCB work I do, and I thought this kit would provide a“real” test of the PCB Rax. In addition, I had built severalof these kits before using my tried-and-true method, whichI thought should provide a good baseline for a “beforeand after” comparison of the system.

I started with the 2” x 3” shield board in the verticalposition, and had no trouble soldering the discretecomponents and IC sockets. Some components neededmy little heatsink clamp to steady them while soldering,but most didn’t, and things went smoothly.

This kit had several connectors on the board edges,and I had to jockey the extension brackets a few times tomake room for the connectors being installed. Again,things went pretty smoothly, except for my over-confidence-driven haste (hey, I’m starting to get the hangof this!) that left a VGA connector slightly raised off theboard on one side (Figure 7).

The 1” x 1” daughterboard required some surface-mount work, which meant the PCB Rax had to be in thehorizontal position. To my mild surprise, the system heldthis tiny board securely, using only two of the extensionbrackets. It took some shifting around to get my ironpositioned comfortably above the PCB Rax in thehorizontal position (the feet stick up a couple of inches oneach corner), but with my heatsink clamp holding thingsdown, I was able to complete the necessary joints. I didhave to remove the board, rotate it 90 degrees in theextension brackets, and re-tighten to get clear access tosome of the joints. All in all, construction of this PocketMini Computer kit using the PCB Rax seemed easier andquicker than the several I had built previously using myold method (Figure 8).

My final PCB assembly test was a homebrew projectbuilt on a 1-1/2” x 2-1/4” Parallax EDU circuit overlayboard which is a protoboard that can be used to create“shields” for the Amigo computer kit sold in the Nuts &Volts webstore. Unlike the three previous “kit” boards —where component x goes in position y — effective layoutof the components on the protoboard is a big part of thebuild process.

I found that my new skills with the PCB Rax allowedme to quickly solder the male shield headers in place withthe system set vertically. Then, I switched to the horizontalorientation with the component side of the board up, anddropped the various components into the protoboard,moving them around until I found a layout that I liked.Gravity held everything in place, and the PCB Raxelevation above my workspace allowed long componentleads to stick out below the board with no ill effects.

With the board still horizontal, I tacked down thecomponents I could, working easily from above and usinggravity as my helper. I then turned the system verticallyand soldered all the connections on the trace side of theboard, using my little heatsink clamp to hold componentsI couldn’t tack from above. For me, the whole process wassurprisingly intuitive — I now had a good “feel” for thisnew tool — and again my build seemed quicker and easier

FIGURE 8. My sloppy installation of a VGAconnector. I should have adjusted theextension brackets on the PCB Rax to give memore room.

FIGURE 7. The completed PMC shield anddaughterboard. The size, component density,and component proximity to the board edgesare typical of many kits available today.

FIGURE 6. The PCB Rax extension brackets offergood positioning flexibility and easily held thesmall irregular-shaped Robot Badge PCB.

38 January 2017

Weston - PCB Rax review - Jan 17_Blank Rough NV.qxd 12/5/2016 11:12 PM Page 38

Page 39: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

than it would have been using my old process (Figure 9).To complete my evaluation of the PCB Rax, I also

simulated some board repair and rework by stuffing somecomponents into an old prototype PCB (4” x 4”, from oneof my projects), then removing and replacing them usingthe PCB Rax. The vertical positioning capability of thePCB Rax allows easy access to both sides of a board atthe same time, which is very helpful for componentremoval — much easier than trying to hold your iron,needlenose pliers, and the board with just your two hands,no matter how skilled you are. If you do any amount ofPCB repair, this feature alone should make PCB Rax avaluable addition to your workbench.

I also tried out a few interesting add-on componentsthat will soon be available from Bench Werx for thesystem, including a center rail, alligator clips for theextension brackets, and some neat “third hand” articulatedarms that fasten to the side rails. Depending on yourneeds, you may find that these significantly extend thecapabilities of the system, and you should check them outif you’re considering PCB Rax.

Bottom line: The PCB Rax system from Bench Werxcan securely hold almost any shape circuit board in eitherthe horizontal or vertical position for project assembly orboard repair. It is a high quality tool that should last foryears, and I found it easy to learn and intuitive to use. For

me, circuit board work seems noticeably easier andquicker using PCB Rax, enough so that I’m going to addone to my current “minimalist” tool suite.

If you do much circuit board assembly or protoboardwork or if you just enjoy having the right quality tool forthe job at hand, I suggest you take a close look at the PCBRax. NV

FIGURE 9. Arranging components on the EDUcircuit overlay board. Once I had a layout I

liked, I tacked things down as shown, thenshifted the PCB Rax to the vertical position and

soldered everything on the trace side of theboard.

parts-express.com1-800-338-0531

Save $10 on $100 order at parts-express.com!

Promo code: NVJ7T *Offer expires 3/31/17

Components Tools and Tech Aids

Speakers Project Accessories

Cost effective prototypes and productionruns with no setup chargesPowder-coated and anodized finishes invarious colors

Select from aluminum, acrylic or provideyour own material

Standard lead time in 5 days or expressmanufacturing in 3 or 1 days

You design it to your specifications using

our FREE CAD software, Front Panel Designer

We machine itand ship to you a

professionally finished product,no minimum quantity required

The Easiest Way to Design CustomFront Panels & Enclosures

FrontPanelExpress.com

slenaPntorFy at Wsiesahe ET

ot

January 2017 39

Weston - PCB Rax review - Jan 17_Blank Rough NV.qxd 12/5/2016 11:12 PM Page 39

Page 40: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

NIrefers to VIs thatare “embedded”

into the MyRIO as “realtime” VIs. Each time theMyRIO unit is poweredup or reset, the VI willautomatically run. Thesecond task covered bythis article will be to usean Apple iPad tointeract with andcontrol that simple VIthrough a Wi-Fi wirelessconnection on an iPadusing NI’s DataDashboard.

To make a real timeor embedded VI, youwill need to open upthe project that wasdemonstrated in the first article. Next, you will need toopen up the Project View window. Left-click on the BuildSpecifications, then right-click and from the pull-downmenus, select New > Real-Time Application as shown in

Figure 1. From the window shown in Figure 2, in thecategory column, select Source Files. Next, in theProject Files column, click on your VI (which wascalled demo_1.vi), then click on the blue right-facingarrow to send that VI name into the Start-up VIscolumn on the right. Click on the Build button at thebottom of the window. You will now see the window

shown in Figure 3.Click on the Done button. You will now be back to

the Project View window. All of the other windows andchoices in Figure 2 should work fine in their default

In the first article in this series last month, thereader learned how to build, compile, and deploya very simple LabVIEW VI (virtual instrument) andrun it on the National Instruments’ (NI) MyRIOunit, controlling it through a USB cable connectedto a host PC running LabVIEW 2015. In thissecond article, we will take that first simple VI andbuild and deploy it as an embedded programwhich will not require a host PC to be connectedto the MyRIO after it has been deployed.

By David Ward

40 January 2017

FIGURE 1.

FIGURE 2.FIGURE 3.

Computer Controland Interfacing withthe NI MyRIO

Ward - MyRIO - Part 2 - Jan 17_Blank Rough NV.qxd 12/5/2016 11:24 PM Page 40

Page 41: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

settings and shouldnot need to bechanged.

Left-click on MyReal-Time Application,right-click, and fromthe pull-down menuselect Run as Startupas in Figure 4. Youshould now see theDeployment Progresswindow shown inFigure 5; click on theClose button. Youshould now see thewindow in Figure 6asking you if it is OK to rebootthe MyRIO unit. Click on Yes.

If you set up a password onthe MyRIO unit, you will beprompted for the username andpassword; refer to Figure 7. Thedefault username is “admin” andduring the original setupprocedure it will require you toenter a password. The passwordthat was set up in this particularunit is “nimyrio.” The MyRIO unit should now reboot andyour VI will start running. Each time the unit is poweredup, that VI will run since it is stored in non-volatile memory in the MyRIO unit. You willalso see the window in Figure 8; click on DoNothing. It’s probably a good idea to buildyour real time VIs so that pressing theBUTTON0 on the bottom of the MyRIO unitwill stop the real time program execution. Thismakes it easier to communicate with the unitwhen you want to change programs or wish tostop a VI’s execution for any other reason.Since BUTTON0 is being used for somethingelse in this VI, it can’t be done at this time.

When you look at the Project Viewwindow, you should see that you can still runyour original VI (demo_1.vi) by double-clickingon it to open up the front panel and block diagram, andthen clicking on the Run arrow icon as was done beforethe real time demonstration. As it deploys, you will see awindow telling you there is already a VI running on theMyRIO unit; see Figure 9. Click on OK. Running youroriginal VI this way does not erase or stop the real timeversion of the VI from running every time the unit ispowered up or reset.

To stop the real time version from running on power-up, click on Build Specifications, right-click, and from the

pull-down menu select Unset as Startup as shown inFigure 10. Click again and select Deploy as shown inFigure 11. You will be prompted to make sure it is okay todo this in another window.

Next, we will demonstrate how to control this VIwirelessly using an iPad. Three things need to occurbefore this can be done. First, the MyRIO unit will need tohave the Wi-Fi set up as a router. Second, the project willneed to be set up to “publish” or send/receive twovariables through the Wi-Fi connection. These variables

Part 2: Building and Deploying anEmbedded VI, and Controlling the NIMyRIO Wirelessly with an Apple iPad.

Post comments on this article and find any associatedfiles and/or downloads at

www.nutsvolts.com/magazine/article/January2017_Computer-Control-with-NI-MyRIO-Wireless-VI.

January 2017 41

FIGURE 5.

FIGURE 7.

FIGURE 6.

FIGURE 8.

FIGURE 9.

FIGURE 10.FIGURE 11.

FIGURE 4.

Ward - MyRIO - Part 2 - Jan 17_Blank Rough NV.qxd 12/5/2016 11:24 PM Page 41

Page 42: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

will then need to be added to the blockdiagram.

The LED variable status or data (true orfalse) will be sent out from the MyRIO Wi-Fi tothe iPad and turn an LED indicator on the iPadon and off. A control on the iPad (acting as aswitch) will send its data (true or false) fromthe iPad back to the MyRIO to control LED0. Third, NIData Dashboard will need to be installed and a DataDashboard built to interact with the VI through theMyRIO wireless router.

If you have not set up the MyRIO Wi-Fi yet, it will bedemonstrated here. Setting up this Wi-Fi can be doneseveral ways, but the way shown here will be through theUSB cable connected to the host PC. On the PC, openWindows Explorer and type in address 172.22.11.2; this isthe default address the MyRIO unit uses for the USBconnection. You should see the System Configurationwindow shown in Figure 12. Select the fourth icon down:Network Configuration. Figure 13 shows how thisparticular MyRIO Wi-Fi was configured: Wireless Mode >Create wireless network; Country > United States; SSID >NIMYRIO; Security > WPA2 Personal; WPA Passphrase >nimyrio; and finally Configure IPv4 Address > DHCP Only.

There aretwo usernamesand twopasswordsconfigured onthe MyRIOused in thesearticles. Theusername andpassword toaccess the

MyRIO itself to view files, reboot,etc., is “admin” and “nimyrio.” Theusername and password to accessthe Wi-Fi connection is “NIMYRIO”and “nilabview.” The address thatshould appear on the iPad needs tobe 172.16.0.1 and be namedNIMYRIO. Be sure to click on theSave button before exiting. Whenthe MyRIO Wi-Fi is working, there is

an orange or red LED located just above LED0 that will beon. There is also a Wi-Fi button on the bottom of theMyRIO unit next to BUTTON0 that can be pressed to turnthe Wi-Fi off and on. However, if the Wi-Fi LED is not on,the Wi-Fi connection will not work.

To set up your project so that it can transmit andreceive wireless data, open up the Project View window.Click on NI-myRIO..., right-click, and from the pull-downmenus select New > Web Service as shown in Figures 14and 15. Now, click on NI-myRIO..., right-click, and fromthe pull-down menu select New > Variable as shown inFigure 16. For the next step, refer to Figure 17.

From the Shared Variable Properties window, you canrename the variable (renamed as LED), then click onVariable Type > Network-Published, Data Type > Boolean,then click on OK. In the Project View tree, you will nowsee an untitled library with your LED variable under it;

42 January 2017

FIGURE 15.

FIGURE 14.

FIGURE 13.

FIGURE 16.

FIGURE 12.

Ward - MyRIO - Part 2 - Jan 17_Blank Rough NV.qxd 12/5/2016 11:24 PM Page 42

Page 43: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

refer to Figure 18. To add more variables to yourproject, click on Untitled Library, right-click, andfrom the pull-down menu, select New > Variableand name another variable as before; in thiscase, button and Data Type > Boolean; seeFigure 19. Now with both the Project Viewwindow and the Block Diagram window placednext to each other, drag the two variables (LEDand button) one at a time from the Project Viewtree over into the while loop of the blockdiagram as shown in Figure 20. The green dataarrow on the button variable is on its right side;this will work as it will be a control coming fromthe Wi-Fi. However, the arrow on the LEDvariable needs to be on itsleft side so that it cantransmit its status throughthe Wi-Fi.

To make this change,select the LED icon, right-click, and from the pull-downmenu, select Properties.From its Properties window,change the Access Typefrom Read to Write. Refer toFigure 21. Now, wire thesetwo variables into the blockdiagram as shown in Figure22, adding another “Or” gate as shown. This means thateither the pushbutton on the front panel of the VI, theBUTTON0 on the MyRIO unit, or the control on the iPadcan control LED0, and that the LED indicator will be onthe Data Dashboard of the iPad.

Be sure to click on File > Save All on either the frontpanel or the blockdiagram after you makeall of these changes soyou don’t lose them. Itis also wise to click onthe File > Save All (thisproject) from theProject View windowfrom time to time.Now, the VI can be runon the MyRIO unit. Itshould start publishing

data through its Wi-Fi. The last step in this process is to getthe iPad ready to interact with the MyRIO Wi-Fi. First,download and install NI Data Dashboard onto your iPadfrom the Apple ITunes store; it should be free. When it isinstalled, you should see the Dashboard icon as shown inFigure 23. Open Settings as in Figure 24. You should be

January 2017 43

FIGURE 18.

FIGURE 19.

FIGURE 20.

FIGURE 17.

FIGURE 21.

FIGURE24.

FIGURE 23.

FIGURE 22.

Ward - MyRIO - Part 2 - Jan 17_Blank Rough NV.qxd 12/5/2016 11:24 PM Page 43

Page 44: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

able to see your MyRIO as one of the possible Wi-FiNetworks. Make sure the MyRIO is on and running yourVI with the newly configured variables; see Figure 25.

If your MyRIO has a password, you will need to enter

it (Figure 26). If your iPad Wi-Fi status shows you areconnected to the MyRIO, you can close the Settings

window. Open the Data Dashboard; you should seeseveral tutorials available as in Figure 27. To start a newdashboard, touch the “+” in the upper right corner (Figure28). You should now have a blank dashboard.

44 January 2017

FIGURE 30.

FIGURE 29.

FIGURE 25.

FIGURE 26.

FIGURE 27.

FIGURE 28.

Ward - MyRIO - Part 2 - Jan 17_Blank Rough NV.qxd 12/5/2016 11:25 PM Page 44

Page 45: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

Select Palette > Indicators, and drag an LED downonto your dashboard as in Figure 29. Select Palette >Controls, and drag a switch down onto your dashboard asshown in Figure 30. Now, click on the little box locatedbelow the LED and it will open up the window shown inFigure 31. This shows that there are shared variables aswell as demo variables.

The demo variables can be used to make dashboardsif you are not connected to a suitable NI wirelessconnection. The shared variables are the ones we need.After selecting shared variables, you will see the window

in Figure 32. Select the correct address for theNImyRIO; in this case, 172.16.0.1. If the connectionis successful, you should see your library name fromyour Project View window displayed; select it(Figure 33). Sometimes the libraries may not appearunless you touch the Refresh icon on the lower rightof the window (the blue circle/arrow).

After selecting the appropriate library, you should seeyour two variables displayed as in Figure 34. If they arenot showing, touch the Refresh icon. Select the LEDvariable; the block below the LED should change fromgray to green if all of this was successful; see Figure 35.Repeat the same steps for the switch to assign it to thebutton variable. Now you can touch the “RUN” icon —the arrow at the top of the dashboard to run thedashboard; see Figure 36. You will probably see yellowwarning triangles or spinning star shaped images until theconnections actually take place (Figure 37). They can also

January 2017 45

FIGURE 32.

FIGURE 31.

FIGURE 34.

FIGURE 35.

FIGURE 36.

FIGURE 33.

FIGURE 37.

Ward - MyRIO - Part 2 - Jan 17_Blank Rough NV.qxd 12/5/2016 11:25 PM Page 45

Page 46: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

appear if the MyRIO is not running or if the iPad changesnetwork connections for some reason.

Now as you run your VI, you should see yourdashboard LED light up whenever: BUTTON0 on theMyRIO is pressed; the pushbutton on the front panel isclicked on; or when the switch from your dashboard istouched. You should notice that the Wi-Fi LED on the

MyRIO unit will be blinking if things are working correctly.To stop your dashboard, touch the “STOP SIGN” icon inthe upper right corner.

Hopefully, you were able to get everything to worktogether. Running the MyRIO with a real time VI andusing Wi-Fi published variables makes it so you can runand control your MyRIO wirelessly from your iPad withouta host PC present. The Data Dashboard is also availablefor Android devices, however, I have only used an iPadand am not aware of any differences between the twoplatforms (there are sure to be a few).

If you spend some time exploring your DataDashboard tutorials, you can learn how to change thebackground colors, etc., to make your dashboard lookmore interesting than the very simple one demonstratedhere. Once successful Wi-Fi connections exist betweenthe MyRIO and the iPad, time can be spent improving thelook of the dashboard. Figure 38 shows the DataDashboard for the final temperature control system thatwill be covered in the final article in this series.

Next time, I will demonstrate how to translate the lowvoltage/low current digital I/O signals from the MyRIOports into higher voltage and higher current real world ACand DC loads. NV

46 January 2017

FIGURE 38.

Ward - MyRIO - Part 2 - Jan 17_Blank Rough NV.qxd 12/5/2016 11:25 PM Page 46

Page 47: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

A L L

E L E C T R O N I C Swww.allelectronics.com Order Toll Free 1-800-826-5432

1.2" X 2.6" EL BACKLIGHTSTRIP30 x 67mm (1.2" x 2.6").

Glows green when

energized. Ivory off-state. Solderable pin.

Operates on 80-120Vac. Will operate

from 120v "house" electricity or inverter.

For control panels, LCD and special effects.

CAT# EL-2625 for 80¢ each

125 for 60¢ each$100

each

175 ASSORTED PIECESCRIMP CONNECTOR KIT175 commonly

used butt

connectors,

ring terminals,

spade terminals,

and male and

female quick-

connectors.

Includes crimp tool

with wire stripper / cutter. Re-usable plastic

organizer case.

CAT# CK-175

$1795each

5MM RED-GREEN FLASHING LED5mm (T-1 3/4) LED alternately flashes red

and green, approximately 180 flashes per

minute. Milky-white in off-state.

CAT# LED-6F

45¢each

100 for 40¢ each

1000 for 30¢ each

2.1A USB WALL CHARGERUSB port provides 2.1 Amps to

power and charge most USB

devices including most smart

phones and tablet computers.

Folding two prong AC plug.

2.82" x 1.45" x 1.20" body. cULus.

CAT# MT-321 $395each

SELF-FUSING RUBBER TAPEStretch and wrap for a

moisture-tight, insulating

seal on electrical

connections. 1" x 16.4' roll.

CAT# SFT-5 $450each

STEP-DOWN DC REGULATORW/ DIGITAL METERLM2596S (buck driver).

Input: 4-40V.

Output: 1.25-37V

adjustable, 1.5A contin-

uous current. 3A max.

2.6" x 1.4" x 0.5". Mounting holes.

CAT# DCC-3M $1250each

12 VDC 5A POWER SUPPLY5' cord with ferrite split

bead and 2.5mm coax

power plug.

Center+.

cULus.

CAT# PS-1262 $1875

ea.

12VDC SPDT 40A AUTOMOTIVE RELAY12 Vdc, 88 ohm coil. Contacts

rated 40A. Plastic enclosed relay,

1.1" x 1.2" x 1" high. Plastic flange

for bulkhead mounting. Mounts in

standard automotive relay socket.

CAT# RLY-351 $255each10 for $2.25 each

- USB- Ethernet- Web server- Modbus- CNC (Mach3/4)- IO

- up to 256 microsteps- 50 V / 6 A

- Isolated

- up to 50MS/s- resolution up to 12bit- Lowest power consumption

- 7 in 1: Oscilloscope, FFT, X/Y, Recorder,

- up to 32 microsteps- 30 V / 2.5 A

- Encoders- LCD

www.poscope.com

January 2017 47

Page 47 - Jan 17_Dev Perspectives - ReadFeed Feb15.qxd 12/5/2016 11:28 PM Page 47

Page 48: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

Just over 20 years ago, I created the concept for anirrigation controller that would be developed into theToro ECx. The requirements for the product were a

challenge: It had to be price competitive, and it had to beavailable for sale all over the world. As a product designer,user interface is always something that I put a lot ofenergy into; that paid off this week with the laser tagcontroller, just as it did 20 years ago at Toro. I am veryhappy that the ECx (with tech upgrades, of course) is stillavailable for sale in my local hardware store. I put a lot ofeffort into that product, and it helped me realize a life-longgoal of earning a United States patent (in fact, I earnedtwo from it). It also allowed me to contribute to anemployer that treated me very well. When I hand a newdesign to a customer, I am intensely focused on theirinitial reaction. A vice president at Toro was first to try theECx; he looked at me and said, “It’s too good!” (Not whatI was expecting.). On the show floor a few days ago, anice lady who runs a lot of laser tag facilities in Canadakissed me on the cheek for how I had cleaned up themenus and operations versus the previous product. Again:User interface matters, so it behooves us to do it well.

This month, I’m going to explore some of the code Iused in my customer’s laser tag product, though we’re notgoing to build a working laser tag weapon, nor a sprinklertimer for that matter — but we are going to enter data forwhat would be useful in a small irrigation controlapplication. Just as my client limited me to a 2x8 LCD withthree buttons (well, two buttons and a trigger; see Figure1), we’re going to stick with that to see if we can make itwork. It would be easier to work with four buttons, oreven six as I have on another project (a road signcontroller), but the real world doesn’t always bend to ourdesires and wishes. Another singer/song writer that I quiteenjoy once said, “You can’t always get what you want, butif you try, sometimes you get what you need.”

I like to start with a map before coding any menubased projects; this is particularly helpful when workingwith a client. On the laser tag project, for example, myclient made a fairly serious structural change when he wasable to see the entire system laid out on a page, and thischange was greatly appreciated by his customers. Figure 2shows the layout of our bare-bones sprinkler timer dataentry menus. Note the color coding; the colors indicate

Making MenusToday, I have Willie Nelson stuck in my head — well, one of his songs, anyway, because Iam, in fact, on the road again. As I bask in the solitude of a quiet condominium, mycolleagues and their families are enjoying the day at Disney World. We're in a bit of acelebratory mood because we've just come off a very big trade show and it was asuccess. My client introduced a new product that uses a custom board designed by EFX-TEK, and coded by yours truly. What my client's customers enjoyed about the newcontroller is the simplified menus. They're easier to navigate, more consistent, and justmake better sense (FTR, I did not design nor code the previous product!). Menus areimportant — in restaurants and in consumer devices — and we should never take themfor granted.

■ BY JON MCPHALENTHE SPIN ZONEADVENTURES IN PROPELLER PROGRAMMING

■ FIGURE 1. Laser tag HMI.

48 January 2017

■ FIGURE 2. Menu map.

McPhalen - Spin Zone - Jan 17_Spin Zone - Aug 15.qxd 12/5/2016 11:31 PM Page 48

Page 49: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

entry elements that will use the same code or an identicalcoding strategy (i.e., copy, paste, modify as needed). Theoverall map also serves as a check-list for the methods thathave to be developed.

Author’s Note: I found a freeware font that matchesstandard character LCDs so I used it in my maps. Thisallowed my customer to see exactly what his menus wouldlook like before I ever started coding. Small details like thiscan make a big difference in a project.

The next step in my process was to code some helperroutines that would work with my standard LCD object.For example, the top row of the map is the top level ofthe menu. The arrows indicate buttons on the tagger:black for up and forward, red for down and reverse; green(the trigger) is to enter or accept.

The top level menu is a simple list of screens. I lay outthe screens in a DAT section like this:

dats_MainMenu byte “SET W-Days “, 0

byte “SET W-Starts”, 0byte “SET Sta Run “, 0byte “SET Clock “, 0byte “EXIT Setup “, 0

For each 2x8 display, I define a single 16-characterstring. Those strings are displayed with this method:

pub display_2x8(p_str)lcd.homelcd.substr(p_str, 8)lcd.line(1)lcd.substr(p_str+8, 8)

This routine expects a pointer to a string, and thisstring should be 16 characters long to cover both lines ofthe 2x8 display. Since we’re going to be overwriting thedisplay, we don’t need to clear it — clearing the LCD takesmore time than simply moving the cursor to the homeposition, anyway. The substr() method puts the first eightcharacters of the string on the first line of the display.Next, we move to the bottom line and print the secondeight characters from the string:

pub edit_settings | idx idx := 0repeat

if (pgmstate <> PS_EDIT)return

idx := select_from_list2(idx, 0, 4, @s_MainMenu)case idx

0 : set_watering_days1 : set_irrigation_starts2 : set_station_run_times3 : set_clock4 : pgmstate := PS_RUN

In the sprinkler timer demo, the edit_settings()method is called when the green button is pressed. Thischanges pgmstate to edit mode and gets us to the toplevel menu. The program will stay in this menu until EXITSetup is selected and the green button is pressed. The realwork takes place in the select_from_list2() method:

pub select_from_list2(idx, lo, hi, p_list) {} | last

idx := 0 #> idx <# hirepeat

last := -1repeat

if (idx <> last) display_2x8(p_list + (idx * 17))last := idx

if (get_input(@idx, lo, hi))clear_buttons(BTN_CLR)return idx

elsetime.pause(BTN_SPD)

At the top, we start by fixing idx (current index intolist) to the range defined by lo and hi. Defining the rangeallows us to use a small portion of a longer list. On firstentry or any time the red or black buttons are pressed, thescreen is updated. Buttons are handled by the get_input()method:

pub get_input(p_value, lo, hi) | btnsrepeat

btns := scan_buttons(BTN_MS)until (btns <> %000)case btns

M_FWD :if (++long[p_value] > hi)

long[p_value] := loreturn 0

M_REV :if (—long[p_value] < lo)

long[p_value] := hireturn 0

M_SET :return

This method uses scan_button() to wait for user input.Note that it requires a pointer to a [long] value to bemodified, as well as the low and high limits for that value.If the black button is pressed, the value is incremented,rolling over to the low limit if the high limit is exceeded.Likewise, if the red button is pressed, the value isdecremented, rolling under to the high limit if we dropbelow the low limit. If black or red is pressed, zero isreturned to indicate that we’re not done editing. If thegreen Set/Enter button is pressed, one is returned as a flagto terminate editing this value.

The scan_button() method handles basic debouncingand manipulates the button pins so that we can share the

Post comments on this article and find any associated files and/or downloads atwww.nutsvolts.com/magazine/article/January2017_SpinZone_Making-Menus-User-Interface.

January 2017 49

McPhalen - Spin Zone - Jan 17_Spin Zone - Aug 15.qxd 12/5/2016 11:31 PM Page 49

Page 50: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

50 January 2017

LCD buss. This is not a new or original concept; my friend,Scott Edwards showed us how to do it many years ago inNuts & Volts. Almost every one of my LCD projects usesthe buss pins for buttons. Figure 3 shows the schematicfor the laser tag HMI which I am using in the sprinklertimer demo; you can easily modify this for your ownprojects, and even add a fourth button to DB7 if you needit. The LCD is configured as write-only (W/R line is tied toground), so we don’t have to put series resistors in thebuss. The 10K voltage dividers attached to the buttonsand LCD buss ensure that the button input voltage to thePropeller is at a safe level:

pub scan_buttons(ms) | btns, tdira[BTN_F..BTN_S] := %000btns := ina[BTN_F..BTN_S]if (btns)

t := cntrepeat ms

waitcnt(t += MS_001)btns &= ina[BTN_F..BTN_S]

return btns

This method is simplified by using the LCD buss pinswhich are connected to the Propeller in a contiguousgroup (a requirement of the LCD object). The pins aremade inputs and then checked to see if any are pressed. Ifone or more inputs are active, the method drops into aloop for the debounce period (ms), and then re-scans thepins before returning a clean input.

On the other side of this, the output routine for theLCD object must ensure that the buss pins are set tooutputs before any write. That is already in place.

I know what you’re thinking: “That’s a lot of layers fora simple menu!” You’re right, it is, but you’ll also noticethat each of the routines is atomic which will allow us toemploy them elsewhere. In the laser tag project and in oursimple sprinkler timer demo, we have more than screenselections. For example, when we select Edit Clock, the

first option is to set the day-of-week. This is very simplewith a couple more support methods:

pub set_day(now)display_screen(true, @s_Today, false)now.byte[3] := select_from_list1 {} (now.byte[3], 0, 6, 1,

@s_Sun, 4)return now

At the top, we use display_screen() to set up the LCD:

pub display_screen(clr, p_str0, p_str1)if (clr)

clear_display(true)if (p_str0 > 0)

line_out(0, p_str0)if (p_str1 > 0)

line_out(1, p_str1)

This method gets the most use in my menu systems.The first parameter determines whether the LCD will becleared or not. Again, if we’re using two strings and bothare eight characters, there is no need to clear the LCD.The next two parameters are pointers to the strings to bedisplayed: the first on the top line; the second on thebottom line. If we want to display a string on a particularline, we pass the address of that string. If a line is to be leftblank (i.e., after clearing) or unmodified, then we pass 0(false). In set_day(), the call to display_screen() changesthe top line to “Today is” and clears the bottom line. Thissets up the screen for the work which is handled byselect_from_list().

This behaves like select_from_list2(), but onlymodifies one line of the display. In this case, it will be thebottom line which will display the abbreviated name ofthe week. Those names come from a list which beginswith the DAT element called s_Sun. Note that we’re using@ to pass the address of s_Sun.

Author’s Note: I have made a small style change in myown programs, vis-à-vis strings. When they’re pre-defined ina DAT section, I preface them with “s_” and use mixed-case naming. This is consistent with my use of the “p_”prefix for pointer (address) variables, as we always have topass the address of a string to a method. The laser tagproject has dozens of strings, and this style change madethem far more manageable.

The parameter passed to set_day() is actually a longthat contains all four RTC elements: day, hours, minutes,and seconds. As you can see, we’re only modifying byte 3of this value as that’s what holds the current day (0..6).

Since we’ve jumped into setting/editing the clock,let’s back up one level. In the menu map, you see fourelements under SET Clock, and routines for thoseelements are called with this method:

■ FIGURE 3.Laser tag HMIschematic.

McPhalen - Spin Zone - Jan 17_Spin Zone - Aug 15.qxd 12/5/2016 11:31 PM Page 50

Page 51: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

pub set_clock rtc := set_day(rtc) rtc := set_hours(rtc)rtc := set_minutes(rtc)rtc := set_seconds(rtc)

This is one of those simple bits of code that is easy totake for granted — but we shouldn’t. Stating the obvious,this method allows us to control the flow of data into thesystem. Here’s a similar method from the laser tag program:

pub edit_weapon_menuedit_ir_poweredit_ir_rangeedit_soundsif (edit_mag_size > 0)

edit_magazinesedit_reloadif (edit_fire_select == BURST)

edit_burstedit_damageedit_cyclicedit_muzzle_flash

As you can see, there are if structures embedded intothe list; these allow me to control what the user seesbased on other selections. For example, if the magazinesize is not set to “Unlimited” (a special feature for playerswith physical limitations who may not be able to handlethe reload function), then the next element to be set is thenumber of magazines. If the magazine is set to unlimitedrounds, there is no need to set the number of magazinesin the tagger.

In another case, if the Fire Select mode is set toBURST, then the operator can edit the maximum numberof rounds that can be fired in a burst. For full- or semi-automatic modes, the number of burst rounds is not used;hence, we don’t have to bother with it while editing. Iknow these things are elementary, but I will continue tomaintain that they can make a very big difference in howa customer perceives a product.

The color coding of the menu map suggests thatsetting the time elements will use similar code, so let’shave a look at just one of those elements:

pub set_hours(now)display_screen(true, @s_Hours, false)lcd.line(1)show_clock(now)now.byte[2] := edit_value{} (now.byte[2], 0, 23, 0, 1,

2)

return nowThis is starting to look familiar, right? It should. After

setting up the initial display, we display now as a clockusing the show_clock() method:

pub show_clock(tregs)lcd_dec2(tregs.byte[2])lcd.out(“:”)lcd_dec2(tregs.byte[1])lcd.out(“:”)lcd_dec2(tregs.byte[0])

There’s nothing to this. We pull the hours, minutes,and seconds bytes from tregs and display them as two-digit (with leading zero) values. We will use this methodlater to display the current time of day.

The edit_value() method gets a lot of use in my menusystems, and by now should be very easy to understand:

pub edit_value(value, lo, hi, col, line, width) | last

value := lo #> value <# hilast := !valuerepeat

if (value <> last)lcd.crsr_xy(col, line)lcd_dec(value, width)last := value

if (get_input(@value, lo, hi) > 0)clear_buttons(BTN_CLR)return value

elsetime.pause(BTN_SPD)

This method lets us modify a value between lo and hi,and we’re able to control placement and field width aswell. This allows us to neatly set an individual timeelement while the others are displayed.

As we get further into the menus, things get easier.Watering days are defined as off or on, and we can setthe entire week with just one method:

pub set_watering_days | d, checkrepeat d from 0 to 6

clear_display(true)lcd.str(@s_Run)lcd.str(@@DayName[d])check := (Water_Days >> d) & 1check := select_from_list1{} (check, 0, 1, 1, @s_No, 4)if (check == 1)

Water_Days |= 1 << delse

Water_Days &= !(1 << d)

ee.wr_byte(@Water_Days, Water_Days)

The active watering days for the program are stored asa byte called Water_Days that is embedded in a DATsection. Each bit is identified by day name using an arrayof strings and an array of string addresses which is whywe’re using the @@ operator to display a day name. Eachbit is extracted into check which is then edited usingselect_from_list1(). In this case, the choices are “No” (0)

January 2017 51

McPhalen - Spin Zone - Jan 17_Spin Zone - Aug 15.qxd 12/5/2016 11:31 PM Page 51

Page 52: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

52 January 2017

and “Yes” (1). The edited choice is put back intoWater_Days. After all the days have been set, the value ofWater_Days is written to the EEPROM so that it’s availableafter a program reset or power-up.

Finally, we get to those special cases where we needto do more than edit a value or pick something from a list.A moment ago, I spoke about the magazine size in thelaser tag weapon having an “Unlimited” setting. In thiscase, zero is used to define unlimited, but putting “0” inthe display would be quite confusing. Likewise, in thesprinkler timer demo, we may not want to use all of theavailable start time slots for a given watering day; insteadof showing a time, a disabled start slot would show “OFF.”

What this means is that in advanced menu systems,we will have specialty methods. Still, they’re not hard tocode given the other support methods that we’ve created.Let’s have a look at the code that edits the start times foran active watering day:

pub set_irrigation_starts | n, idx, stimerepeat n from 0 to 3

clear_display(true)lcd.str(@s_Start)lcd_dec1(n+1)

idx := Start_Times[n]repeat

lcd.line(1)if (idx => NO_START)

lcd.str(@s_Off)lcd.out(“ “)lcd.out(“ “)

elsestime := idx * 15lcd_dec2(stime / 60)lcd.out(“:”)lcd_dec2(stime // 60)

if (get_input(@idx, 0, 96))clear_buttons(BTN_CLR)quit

elsetime.pause(BTN_SPD)

Start_Times[n] := idxee.wr_byte(@Start_Times[n], idx)

The program supports up to four irrigation starts onthe active watering days; these are stored in a table calledStart_Times that is in a DAT section. As with the otherelements, using a DAT section lets us pre-define values likeconstants, except that they can be modified at run time.

A repeat loop controls which start time (0..3) is beingedited, and updates the LCD accordingly. Inside that loop,

eddedARM.c.embwww omeddedARM.c

er-omputC

oarSingle B

duleoon-Mer-

angeemp RTTe-40°C /+85°C ageortlash S4GB eMMC F

ooth Enabledi & BluetiFWz ARM CPU454 MH

ial SBCndustrer Iwow PoL

eromputd Coar-7680ST

(480) 837-5200

er-omputC

(480) 837-5200

duleoon-M-4900ST

e Optionoruad CQooth Enabledi & BluetiFW

eescale i.MX6 ARM CPUrFemancorffoerigh PH

McPhalen - Spin Zone - Jan 17_Spin Zone - Aug 15.qxd 12/5/2016 11:32 PM Page 52

Page 53: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

we will display the starting time. For the purposes of thisprogram, all values are stored as bytes. These means thatwe have to use a bit of compression because we cannotstore 1440 (minutes in a day) into a byte. For stand-alonesprinkler timers, watering start times do not require a lotof resolution, so the time is expressed in 15 minuteincrements (we could use 10, but I decided 15 was fine).

Here’s where we get special: At the top of the loop —where the LCD is updated — we check to see if the starttime index is 96; when this is the case, we will display“OFF.” Otherwise, we will calculate and show the startingtime formatted as HH:MM. The bottom of the loop issimilar to other editors, using get_input() to modify thestart time index value in the allowable range.

When the green Set/Enter button is pressed, the indexfor the start time is saved to the Start_Times element andcopied to the EEPROM. As you scan through the examplecode, you’ll see that the sprinkler run times are handled ina similar fashion.

Okay. That was a bit of work, wasn’t it? Yes, in fact itwas — and some will continue to wonder why I use somany layers in a simple program. When it comes to

programs, I like to apply George Lucas’ thought onmovies: They’re never done, they’re simply abandoned.This example is small, but within it we’ve built the tools tocreate a much more complex system. The laser tagproject, for example, has nearly 60 elements (x4 user-selected weapon types) that can be set by the fieldoperator; this requires about 2000 lines of Spin code toaccomplish — and that’s with the common code elementsto handle the variety of menus in that system, and notcounting attached child objects.

Big project or small, take your time when it comes tothe user interface, and design a system that is sensible andeasy to use. Apple built its entire brand on user interface.

Final story: About five years ago, I designed a camerapan/tilt controller that uses an LCD and six-buttoninterface. One of the testers was on location in a cavewhen rocks fell and damaged the LCD. Because my clientand I had spent a lot of time designing the flow of theinterface, the person using the controller was able toremember the sequence of button presses and finish theshoot! To me, that was a big success.

Happy New Year, friends! Until next time, keepSpinning and winning with the Propeller! NV

January 2017 53

Jon "JonnyMac" [email protected]

Parallax, Inc.www.parallax.com

CHASSIS

ENCLOSURES

TRANSFORMERS

(716) 630-7030(716) 630-7030

McPhalen - Spin Zone - Jan 17_Spin Zone - Aug 15.qxd 12/6/2016 12:30 AM Page 53

Page 54: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

GREAT FOR DIYers!

Programming PICs in Basicby Chuck Hellebuyck

If you wanted to learnhow to program microcontrollers, thenyou've found the rightbook! Microchip PICmicrocontrollers arebeing designed into electronics throughoutthe world and none ismore popular than the eight-pin version. Nowthe home hobbyist can create projects with these little microcontrollers using a low cost development tool called the CHIPAXE system and the Basic softwarelanguage.Chuck Hellebuyck introduceshow to use this development setup tobuild useful projects with an eight-pinPIC12F683 microcontroller. $14.95

Programming ArduinoNext Steps: Going Further

with Sketchesby Simon Monk

In this practical guide,electronics guru SimonMonk takes you underthe hood of Arduinoand reveals professionalprogramming secrets.Also shows you howto use interrupts, manage memory, program for theInternet, maximizeserial communications, perform digital signalprocessing, and much more. All of the 75+example sketches featured in the book areavailable for download. $20.00

Beginner's Guide to ReadingSchematics, 3E

by Stan Gibilisco

Navigate the roadmapsof simple electroniccircuits and complexsystems with help froman experienced engineer. With all-newart and demo circuitsyou can build, thishands-on, illustratedguide explains how tounderstand and createhigh-precision electronics diagrams.Find out how toidentify parts and connections, decipherelement ratings, and apply diagram-basedinformation in your own projects.

$25.00

Python for MicrocontrollersGetting Started with MicroPython

Program your own MicroPythonprojects with ease

— no priorprogramming

experiencenecessary!

This DIY guide providesa practical introductionto microcontrollerprogramming withMicroPython. Writtenby an experiencedelectronics hobbyist,Python for Microcontrollers: Getting Startedwith MicroPython features eight start-to-finish projects that clearly demonstrateeach technique.

$20.00

Electronics WorkshopCompanion for Hobbyists

by Stan GibiliscoIn this practicalguide, electronicsexpert StanGibilisco shows you,step by step, how toset up a homeworkshop so youcan invent, design,build, test, andrepair electronic circuits and gadgets.Electronics WorkshopCompanion for Hobbyistsprovides tips for constructing your workbench and stocking it with the tools,components, and test equipment you’llneed. Clear illustrations and interesting do-it-yourself experiments are includedthroughout this hands-on resource.$25.00

Make Your OwnPCBs with EAGLE

by Eric KleinertFeaturing detailedillustrations andstep-by-step instructions, MakeYour Own PCBs withEAGLE leads youthrough the processof designing aschematic and transforming it intoa PCB layout. You’llthen move on tofabrication via the generation of standardGerber files for submission to a PCB manufacturing service. This practical guideoffers an accessible, logical way to learnEAGLE and start producing PCBs as quickly as possible.

$30.00

How to Diagnose and FixEverything Electronicby Michael Jay Geier

A Fully RevisedGuide toElectronics Repair all kinds ofelectrical products,from modern digitalgadgets to analogantiques, with helpfrom this updatedbook. The SecondEdition offers expertinsights, case studies, and step-by-stepinstruction from a lifelong electronics guru.Discover how to assemble your workbench,use the latest test equipment, zero in on andreplace dead components, and handlereassembly. $24.95

54 January 2017

The Nuts & Volts WEBSTOREFor comple te pr oduct de t ai ls , v is i t us onl ine!!

Raspberry Pi Electronics Projectsfor the Evil Geniusby Donald Norris

This fully illustratedTAB guide showshow to constructand program allkinds of fun andinnovative gadgetswith yourRaspberry Pi.Raspberry PiElectronics Projectsfor the Evil Geniusfeatures 10 complete projects that showcase coolRasPi applications in computing, communications, robotics, photography, andvideo. Each inexpensive project includes adetailed list of materials, sources for parts,schematics, and clear step-by-step assemblyand programming instructions.$25.00

Arduino: A Beginner's Guide ToProgramming Electronics

byChuck Hellebuyck

Arduino is one of themost popular microcontroller development boardsavailable. It's more thanjust a module though, asthe heart of Arduino isthe software you runon your computer anduse to create sketches(or programs) in the Cprogramming language, with many pre-builtfunctions. Chuck explains all this in verysimple terms to help you get started programming your own electronic applications. His down-to-earth style ofexplaining technology makes it a greatplace to get started with programmingelectronics. $15.00

NV Webstore - Jan 17 working_NV Webstore June 2016 working.qxd 12/5/2016 11:36 PM Page 54

Page 55: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

CD-ROM SPECIALEDUCATIONAL

January 2017 55

Or CALL 1-800-783-4624 today!Order online @ store.nutsvolts.com

NV Webstore - Jan 17 working_NV Webstore June 2016 working.qxd 12/5/2016 11:36 PM Page 55

Page 56: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

56 January 2017

THE DESIGN CYCLE n BY FRED EADY

The nRF52832 Serial Peripheral Interface

Commonly known as SPI, the nRF52832’s Serial Peripheral Interface is capable of operating in Master or Slave mode. SPI was developed by Motorola in the 1980s and is still used widely today. Most every microcontroller out there has an SPI portal.

SPI is a clocked synchronous protocol that utilizes Master/Slave relationships. Basically, the Master controls everything. The Master selects a Slave device by dropping the SS (Slave Select) signal to a logically low level. The Slave device becomes active and waits for a clock signal, which is provided by the Master device. With each clock edge transition, the Master sends a bit of data to the Slave device on the MOSI (Master Out Slave In) line. The Slave uses the other clock edge to pass a bit of data back to the Master on the MISO (Master In Slave Out) line. The data transfer ends when the Master forces the SS signal logically high.

The nRF52832 allows us to assign any peripheral function to any pin. So, let’s start assigning SPI signals at the fi rst available GPIO pin. As you can see in Photo 1, we have chosen to include a 32.768 kHz crystal to drive the low power clock. In that we have installed the 32.768 kHz external crystal, our fi rst available GPIO pin is P0.02. We will use a Saleae Logic to capture the SPI data exchange. The Saleae defaults the signal order to MOSI, MISO, SCK (Clock), and SS (Enable). With that, here is how we defi ne the SPI GPIO to the nRF52832:

#defi ne SPI_MOSI_PIN 2#defi ne SPI_MISO_PIN 3#defi ne SPI_SCK_PIN 4#defi ne SPI_SS_PIN 5

The SPI GPIO pin defi nitions are located in the sdk_confi g.h fi le. The resultant defi nitions were actually a result of the selection of the SPI GPIO pins in the Confi guration Wizard. You can see this in Screenshot 1.

Now that we have decided where to put the SPI portal, we must spawn an instance of the portal. This is done within the confi nes of the main function:

//SPI Instance Index = 0#defi ne SPI_INSTANCE 0//SPI Instance = spi0static const nrf_drv_spi_t spi0 = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE);//SPI Instance Complete fl agstatic volatile bool spi0_xfer_done;

Recall that we have the ability to right-click on types and be directed to their original defi nitions. Here is what the nrf_drv_spi_t structure looks like:

typedef struct{ void * p_registers; ///< Pointer to the structure with SPI/SPIM ///< peripheral instance registers. IRQn_Type irq; ///< SPI/SPIM peripheral instance IRQ number. uint8_t drv_inst_idx; ///< Driver instance index. bool use_easy_dma; ///< True if the peripheral with EasyDMA (SPIM) ///< shall be used.} nrf_drv_spi_t;

Note that we used the nrf_drv_spi_t type to create the spi0 structure. We populated the new structure using the macro NRF_DRV_SPI_INSTANCE(SPI_INSTANCE). Using the magic of right-clicking again, we can reveal the macro’s contents:

/** * @brief Macro for creating an SPI master driver * instance. */#defi ne NRF_DRV_SPI_INSTANCE(id) \{ \ .p_registers = NRF_DRV_SPI_PERIPHERAL(id), \ .irq = CONCAT_3(SPI, id, _IRQ), \ .drv_inst_idx = CONCAT_3(SPI, id, _INSTANCE_ \ INDEX), \

orking with the nRF52832 makes me want to throw away my stock of mundane microcontrollers. The ARM based nRF52832 blinks LEDs, speaks SPI, UART, and I2C just like any other microcontroller. It even does things without its CPU that some microcontrollers can’t do with

the assistance of their CPU. So, in this installment of the Design Cycle, we will continue our exploration of the nRF52832’s peripherals.

ADVANCED TECHNIQUES FOR DESIGN ENGINEERS

W

Post comments on this article and fi nd any associated fi les and/or downloads atwww.nutsvolts.com/magazine/article/January2017_DesignCycle.

A Look at the nRF52832’s SPI Peripheral

n PHOTO 1. Every GPIO pin pulled out to a header is ready to do our bidding. We have the ability to assign any peripheral function to any of the nRF52832’s available GPIO pins.

Eady - Design Cycle - Jan 17.indd 56 12/5/2016 8:16:49 PM

Page 57: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

January 2017 57

The SPI GPIO pin definitions are located in the sdk_config.h file. The resultant definitions were actually a result of the selection of the SPI GPIO pins in the Configuration Wizard. You can see this in Screenshot 1.

Now that we have decided where to put the SPI portal, we must spawn an instance of the portal. This is done within the confines of the main function:

//SPI Instance Index = 0#define SPI_INSTANCE 0//SPI Instance = spi0static const nrf_drv_spi_t spi0 = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE);//SPI Instance Complete flagstatic volatile bool spi0_xfer_done;

Recall that we have the ability to right-click on types and be directed to their original definitions. Here is what the nrf_drv_spi_t structure looks like:

typedef struct{ void * p_registers; ///< Pointer to the structure with SPI/SPIM ///< peripheral instance registers. IRQn_Type irq; ///< SPI/SPIM peripheral instance IRQ number. uint8_t drv_inst_idx; ///< Driver instance index. bool use_easy_dma; ///< True if the peripheral with EasyDMA (SPIM) ///< shall be used.} nrf_drv_spi_t;

Note that we used the nrf_drv_spi_t type to create the spi0 structure. We populated the new structure using the macro NRF_DRV_SPI_INSTANCE(SPI_INSTANCE). Using the magic of right-clicking again, we can reveal the macro’s contents:

/** * @brief Macro for creating an SPI master driver * instance. */#define NRF_DRV_SPI_INSTANCE(id) \{ \ .p_registers = NRF_DRV_SPI_PERIPHERAL(id), \ .irq = CONCAT_3(SPI, id, _IRQ), \ .drv_inst_idx = CONCAT_3(SPI, id, _INSTANCE_ \ INDEX), \

.use_easy_dma = CONCAT_3(SPI, id, _USE_EASY_ \ DMA) \}

The .p_registers statement is pretty straightforward. The other definitions within the macro are just as easy to understand if you do the concatenation:

.irq = SPI0_IRQ

.drv_inst_idx = SPI0_INSTANCE_INDEX

.use_easy_dma = SPI0_USE_EASY_DMA

If we keep right-clicking, we will find within the nrf52.h file that SPI0_IRQ = 3. There is a definition to be found for SPI0_INSTANCE_INDEX within the nrf_drv_spi.h file:

#define SPI0_INSTANCE_INDEX 0

The state of SPI0_USE_EASY_DMA is determined by a setting within the Configuration Wizard. I’ve captured the negative point of definition for DMA operation in Screenshot 2.

At this point, we have defined the SPI portal GPIO pins and the spi0 instance. The SPI portal is being built to transfer data. So, we will need to allocate some storage to house the data that will be exchanged over our new SPI portal. For this, we need not conjure up any nRF52832-specific code. Just plain old C will work here:

#define txdata “NutsVolts”static uint8_t m_tx_buf[] = txdata; //extra byte in rx_buf for NULL characterstatic uint8_t m_rx_buf[sizeof(txdata) + 1];//number of bytes to transfer = m_length

orking with the nRF52832 makes me want to throw away my stock of mundane microcontrollers. The ARM based nRF52832 blinks LEDs, speaks SPI, UART, and I2C just like any other microcontroller. It even does things without its CPU that some microcontrollers can’t do with

the assistance of their CPU. So, in this installment of the Design Cycle, we will continue our exploration of the nRF52832’s peripherals.

ADVANCED TECHNIQUES FOR DESIGN ENGINEERSPost comments on this article and find any associated files and/or downloads at

www.nutsvolts.com/magazine/article/January2017_DesignCycle.

A Look at the nRF52832’s SPI Peripheral

n SCREENSHOT 1. The Configuration Wizard allows us to easily change the nRF52832 peripheral configuration. A scripting language allows us to create our own custom sdk_config.h entries, which can be accessed via the Configuration Wizard.

n SCREENSHOT 2. As you can see, the contents of the sdk_config.h file can be altered by our selections within the Configuration Wizard.

n PHOTO 1. Every GPIO pin pulled out to a header is ready to do our bidding. We have the ability to assign any peripheral function to any of the nRF52832’s available GPIO pins.

Eady - Design Cycle - Jan 17.indd 57 12/5/2016 8:16:53 PM

Page 58: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

58 January 2017

static const uint8_t m_length = sizeof(m_tx_buf); Okay. Everything is in place ... almost. If you’ve been

following along, you realize that we have been working with tasks and events. Our SPI instance will generate an event when the SPI exchange has completed. So, we’ll need an SPI event handler. Our SPI event handler is very simple. Its only purpose in life is to change the state of the Boolean variable spi0_xfer_done:

void spi0_event_handler(nrf_drv_spi_evt_t const * p_event){ spi0_xfer_done = true;}

Now everything is in place. The next steps involve initializing the SPI portal. To do this, we will pass the structure information we have created to yet another structure called spi0_config:

nrf_drv_spi_config_t spi0_config = NRF_DRV_SPI_ DEFAULT_CONFIG;

Our spi0_config structure is based on the nrf_drv_spi_config_t type:

/** * @brief SPI master driver instance configuration * structure. */typedef struct{ uint8_t sck_pin; ///< SCK pin number. uint8_t mosi_pin; ///< MOSI pin number

///< (optional). /**< Set to @ref NRF_DRV_SPI_PIN_NOT_USED * if this signal is not needed. */ uint8_t miso_pin; ///< MISO pin number ///< (optional). /**< Set to @ref NRF_DRV_SPI_PIN_NOT_USED * if this signal is not needed. */ uint8_t ss_pin; ///< Slave Select pin ///< number (optional). /**< Set to @ref NRF_DRV_SPI_PIN_NOT_USED * if this signal is not needed. The * driver supports only active low for * this signal. * If the signal should be active high, * it must be controlled externally. */ uint8_t irq_priority; ///< Interrupt priority. uint8_t orc; ///< Over-run character. /**< This character is used when all bytes from the TX buffer are sent, but the transfer continues due to RX. */ nrf_drv_spi_frequency_t frequency; ///< SPI ///< frequency. nrf_drv_spi_mode_t mode; ///< SPI mode. nrf_drv_spi_bit_order_t bit_order; ///< SPI bit ///< order.} nrf_drv_spi_config_t;

We have previously used macros to populate structures. One would expect we can continue that tradition here. You are correct. We can:

/** * @brief SPI master instance default * configuration. */#define NRF_DRV_SPI_DEFAULT_CONFIG \{\ .sck_pin = NRF_DRV_SPI_PIN_NOT_USED, \ .mosi_pin = NRF_DRV_SPI_PIN_NOT_USED, \ .miso_pin = NRF_DRV_SPI_PIN_NOT_USED, \ .ss_pin = NRF_DRV_SPI_PIN_NOT_USED, \ .irq_priority = SPI_DEFAULT_CONFIG_IRQ_ \ PRIORITY, \ .orc = 0xFF, \ .frequency = NRF_DRV_SPI_FREQ_4M, \ .mode = NRF_DRV_SPI_MODE_0, \ .bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_ \ FIRST, \}

Unfortunately, we can’t use most of the default

settings found within the macro. After all, we have defined an SPI portal and the GPIO pins that go with it. We have the power to override the default configuration values that the macro defines:

nrf_drv_spi_config_t spi0_config = NRF_DRV_SPI_ DEFAULT_CONFIG; spi0_config.ss_pin = SPI_SS_PIN; spi0_config.miso_pin = SPI_MISO_PIN; spi0_config.mosi_pin = SPI_MOSI_PIN; spi0_config.sck_pin = SPI_SCK_PIN; spi0_config.frequency = NRF_DRV_SPI_FREQ_125K; APP_ERROR_CHECK(nrf_drv_spi_init(&spi0, &spi0_ config, spi0_event_handler));

The SPI configuration overrides are obvious to the most casual observer. At this point, we have a complete set of SPI structures. We have the instance structure (spi0) and the configuration structure (spi0_config). The SPI initialization function also requires a reference to the spi0 event handler, which we also have.

The SPI data storage spaces are allocated and the data to transfer (NutsVolts) has been previously defined. Since we are not expecting any particular response from an SPI Slave device, we can pull the trigger on an SPI exchange at will:

//Clear rx buffer and reset transfer done //flag memset(m_rx_buf, 0, m_length); spi0_xfer_done = false;

APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi0, m_ tx_buf, m_length, m_rx_buf, m_length));

while (!spi0_xfer_done) { __WFE(); }

Now for Something Totally DifferentNot really. However, we are going to change the

positon of our SPI Master portal. Moving the SPI Master portal to pins P0.25 (MOSI), P0.26 (MISO), P0.27 (SCK), and P0.28 (SS) makes it a bit easier to monitor the SPI signal activity. This becomes obvious when you look at Photo 2. We can now plug our Saleae Logic into the SPI signal path between the nRF52832 and Curiosity development board.

We are going to let the MPLAB Code Configurator write our SPI Slave code, which we will run on the

n PHOTO 2. The relocation of the SPI portal is purely logistical. The double row of pins allows us to insert our Saleae Logic into the SPI signal path.

ADVANCED TECHNIQUES FOR DESIGN ENGINEERS

Eady - Design Cycle - Jan 17.indd 58 12/5/2016 8:17:07 PM

Page 59: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

January 2017 59

///< (optional). /**< Set to @ref NRF_DRV_SPI_PIN_NOT_USED * if this signal is not needed. */ uint8_t miso_pin; ///< MISO pin number ///< (optional). /**< Set to @ref NRF_DRV_SPI_PIN_NOT_USED * if this signal is not needed. */ uint8_t ss_pin; ///< Slave Select pin ///< number (optional). /**< Set to @ref NRF_DRV_SPI_PIN_NOT_USED * if this signal is not needed. The * driver supports only active low for * this signal. * If the signal should be active high, * it must be controlled externally. */ uint8_t irq_priority; ///< Interrupt priority. uint8_t orc; ///< Over-run character. /**< This character is used when all bytes from the TX buffer are sent, but the transfer continues due to RX. */ nrf_drv_spi_frequency_t frequency; ///< SPI ///< frequency. nrf_drv_spi_mode_t mode; ///< SPI mode. nrf_drv_spi_bit_order_t bit_order; ///< SPI bit ///< order.} nrf_drv_spi_config_t;

We have previously used macros to populate structures. One would expect we can continue that tradition here. You are correct. We can:

/** * @brief SPI master instance default * configuration. */#define NRF_DRV_SPI_DEFAULT_CONFIG \{\ .sck_pin = NRF_DRV_SPI_PIN_NOT_USED, \ .mosi_pin = NRF_DRV_SPI_PIN_NOT_USED, \ .miso_pin = NRF_DRV_SPI_PIN_NOT_USED, \ .ss_pin = NRF_DRV_SPI_PIN_NOT_USED, \ .irq_priority = SPI_DEFAULT_CONFIG_IRQ_ \ PRIORITY, \ .orc = 0xFF, \ .frequency = NRF_DRV_SPI_FREQ_4M, \ .mode = NRF_DRV_SPI_MODE_0, \ .bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_ \ FIRST, \}

Unfortunately, we can’t use most of the default

settings found within the macro. After all, we have defined an SPI portal and the GPIO pins that go with it. We have the power to override the default configuration values that the macro defines:

nrf_drv_spi_config_t spi0_config = NRF_DRV_SPI_ DEFAULT_CONFIG; spi0_config.ss_pin = SPI_SS_PIN; spi0_config.miso_pin = SPI_MISO_PIN; spi0_config.mosi_pin = SPI_MOSI_PIN; spi0_config.sck_pin = SPI_SCK_PIN; spi0_config.frequency = NRF_DRV_SPI_FREQ_125K; APP_ERROR_CHECK(nrf_drv_spi_init(&spi0, &spi0_ config, spi0_event_handler));

The SPI configuration overrides are obvious to the most casual observer. At this point, we have a complete set of SPI structures. We have the instance structure (spi0) and the configuration structure (spi0_config). The SPI initialization function also requires a reference to the spi0 event handler, which we also have.

The SPI data storage spaces are allocated and the data to transfer (NutsVolts) has been previously defined. Since we are not expecting any particular response from an SPI Slave device, we can pull the trigger on an SPI exchange at will:

//Clear rx buffer and reset transfer done //flag memset(m_rx_buf, 0, m_length); spi0_xfer_done = false;

APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi0, m_ tx_buf, m_length, m_rx_buf, m_length));

while (!spi0_xfer_done) { __WFE(); }

Now for Something Totally DifferentNot really. However, we are going to change the

positon of our SPI Master portal. Moving the SPI Master portal to pins P0.25 (MOSI), P0.26 (MISO), P0.27 (SCK), and P0.28 (SS) makes it a bit easier to monitor the SPI signal activity. This becomes obvious when you look at Photo 2. We can now plug our Saleae Logic into the SPI signal path between the nRF52832 and Curiosity development board.

We are going to let the MPLAB Code Configurator write our SPI Slave code, which we will run on the

Curiosity board you see in Photo 2. The Curiosity development board’s PIC layout is detailed in Figure 1. Our goal is to transfer a byte of data from the SPI Slave to the SPI Master. The transfer will be triggered by a signal from the SPI Slave on the dataRdy pin. An SPI Slave device normally supplies stored data (EEPROM) and sensor data on demand to the SPI Master.

The SPI Slave transfers data just like the SPI Master. However, the SPI Slave relies on the SPI Master’s clock signal to spin the bits out of its buffer. Within the perspective of a PIC microcontroller, that bit buffer is SSPBUF. In our application design, the SPI Slave drives the dataRdy signal logically low when it has placed valid data in its SSPBUF. The nRF52832 SPI Master sees the dataRdy line go logically low and begins a data exchange. The data that was loaded into the SPI Slave’s SSPBUF is clocked out to the SPI Master.

At the same time, whatever is in the SPI Master’s SSPBUF is clocked over to the SPI Slave. In our case, we don’t care about the SPI Slave’s clocked in data from the SPI Master. However, if we did care, we could retrieve the incoming SPI Master byte and use it. Here’s what our MPLAB Code Configurator-generated Curiosity SPI Slave driver code looks like:

uint8_t SPI_Exchange8bit(uint8_t data){ uint8_t dummyRead = SSPBUF; //Clears buffer full flag // Clear the Write Collision flag, to allow // writing SSP1CON1bits.WCOL = 0;

n FIGURE 1. With our help, the MPLAB Code Configurator assigned these SPI Slave portal pins. There is also a dataRdy pin which we will use to signal the SPI Master.

ADVANCED TECHNIQUES FOR DESIGN ENGINEERS

Eady - Design Cycle - Jan 17.indd 59 12/5/2016 8:17:07 PM

Page 60: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

60 January 2017

SSPBUF = data; while(SSP1STATbits.BF == SPI_RX_IN_PROGRESS) { } return (SSPBUF);}

The SPI Master driver code is very similar. The SPI Master starts to clock when data is loaded into SSPBUF. The completion of the SPI exchange is signaled by a full SSPBUF. The same SSPBUF full logic is valid on the SPI Master side of the connection.

This is a snippet of our SPI Slave application code which resides within the main function:

uint8_t rxBuf[4];uint8_t txBuf[4] = {0x41,0x42,0x43,0x44};uint8_t pktLen = 4;uint8_t dataFromMaster;

dataRdy_SetHigh(); i=0; while (1) { dataRdy_SetLow(); dataFromMaster = SPI_Exchange8bit(txBuf[i]); if(++i == 4) { i = 0; } dataRdy_SetHigh(); }

The SPI Slave drives the dataRdy signal logically just before it places data from txBuf into the SSPBUF. The Curiosity development board’s PIC then waits until the SPI exchange is complete before returning the dataRdy signal to a logical high state.

The dataRdy line (P0.29) on the nRF52832 SPI Master is configured as an input. We are not doing anything fancy and simply poll the incoming dataRdy signal looking for a logical low:

static uint8_t m_tx_buf[4] = {0x31,0x32,0x33,0x34}; //extra byte in rx_buf for NULL characterstatic uint8_t m_rx_buf[4];//number of bytes to transfer = m_lengthstatic const uint8_t m_length = 1; nrf_gpio_cfg_input(29,NRF_GPIO_PIN_NOPULL);while (1){ //Clear rx buffer and reset transfer done flag memset(m_rx_buf, 0, m_length); spi0_xfer_done = false; if(nrf_gpio_pin_read(29) == 0) { nrf_delay_ms(100); APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi0, m_tx_buf, m_length, m_rx_buf, m_length)); while (!spi0_xfer_done) { __WFE(); } while(nrf_gpio_pin_read(29) == 0); LEDS_INVERT(BSP_LED_0_MASK); nrf_delay_ms(200); }}

When a logical low is sensed on the dataRdy pin, the SPI Master begins the exchange. When the SPI exchange is complete, the SPI Master polls the dataRdy line looking for the SPI Slave to drive it logically high. Just for fun, we flip the blue LED which

n SCREENSHOT 3. Our nRF52832 Master device is at work. Every SPI signal you see in this capture was generated by the nRF52832. Since there is no Slave device attached, the MISO line is seen as a logical high for the duration of the data exchange. 1 (800) 972-2225 | http://www.elexp.com | [email protected]

Your Single Source of Electronic Equipment, Tools, and Components

01DM820BDigital Multimeter Super EconomyDMM - Volts, current, Resistance, Transistor and Diode Test.Includes Leads $7.50

01DMMY64Digital Multimeter 32 RangesIncluding temperature, capacitance, frequency and diode/transistor testing $29.95

01DMM9803RBench DMM True RMSAuto and manual range, RS232C standard interface. Runs on DC or AC $139.95

01DS1102E100MHz Rigol OscilloscopeFeatures: 1 million points of deep memory, FFT, record and replay, roll mode, alternate trigger mode, and adjustable trigger sensitivity $399 $279

Siglent 50MHz DSO500MSa/s Sampling32K Memory6 Digit Frequency CounterUSB Interface7” Color TFT-LCD Screen

01SDS1052DL

USB version with Stamp and USB Cable.Parallax Board of Education Full Kit $98.90

$8.95BOE Full KitParallax 7.5V Power Supply

Sweep Function Generator3MHz, 6 Waveform Functions, Int/Ext Counter, lin/log sweep

$135Model FG-30(no display)

Model FG-32(5 digit display) $195

DC Power Supplies

$95Model HY3003Variable Output, 0-30VDC, 0-3Amp. Model HY3003-3Two 0-30VDC, 0-3Amp Variable Outputs plus 5V 3A fixed. $195

0603ZD9848W Soldering StationTemp. Controlled310oF~840oF $15.25

is attached to the nRF52832, to visually signal a completed data exchange.

The SPI operations can be seen in Screenshot 4. Note the SPI Master always clocks out an ASCII 1. It doesn’t matter in this case what the SPI Master sends as we’re only interested in the SPI Master supplying a clock to retrieve the SPI Slave data. As you can see in Screenshot 4, the SPI Slave sends one byte of its txBuf with each data exchange cycle.

We Ain’t Done YetThere is much more we can glean from

the Raytac BLE module that houses a Nordic

n SCREENSHOT 4. Each cycle of data exchange transfers two bytes: one from the SPI Master (ASCII 1) and one from the SPI Slave (txBuf[i]).

ADVANCED TECHNIQUES FOR DESIGN ENGINEERS

Eady - Design Cycle - Jan 17.indd 60 12/5/2016 8:17:09 PM

Page 61: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

January 2017 61

The dataRdy line (P0.29) on the nRF52832 SPI Master is confi gured as an input. We are not doing anything fancy and simply poll the incoming dataRdy signal looking for a logical low:

static uint8_t m_tx_buf[4] = {0x31,0x32,0x33,0x34}; //extra byte in rx_buf for NULL characterstatic uint8_t m_rx_buf[4];//number of bytes to transfer = m_lengthstatic const uint8_t m_length = 1; nrf_gpio_cfg_input(29,NRF_GPIO_PIN_NOPULL);while (1){ //Clear rx buffer and reset transfer done fl ag memset(m_rx_buf, 0, m_length); spi0_xfer_done = false; if(nrf_gpio_pin_read(29) == 0) { nrf_delay_ms(100); APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi0, m_tx_buf, m_length, m_rx_buf, m_length)); while (!spi0_xfer_done) { __WFE(); } while(nrf_gpio_pin_read(29) == 0); LEDS_INVERT(BSP_LED_0_MASK); nrf_delay_ms(200); }}

When a logical low is sensed on the dataRdy pin, the SPI Master begins the exchange. When the SPI exchange is complete, the SPI Master polls the dataRdy line looking for the SPI Slave to drive it logically high. Just for fun, we fl ip the blue LED which

1 (800) 972-2225 | http://www.elexp.com | [email protected]

Your Single Source of Electronic Equipment, Tools, and Components

01DM820BDigital Multimeter Super EconomyDMM - Volts, current, Resistance, Transistor and Diode Test.Includes Leads $7.50

01DMMY64Digital Multimeter 32 RangesIncluding temperature, capacitance, frequency and diode/transistor testing $29.95

01DMM9803RBench DMM True RMSAuto and manual range, RS232C standard interface. Runs on DC or AC $139.95

01DS1102E100MHz Rigol OscilloscopeFeatures: 1 million points of deep memory, FFT, record and replay, roll mode, alternate trigger mode, and adjustable trigger sensitivity $399 $279

Siglent 50MHz DSO500MSa/s Sampling32K Memory6 Digit Frequency CounterUSB Interface7” Color TFT-LCD Screen

01SDS1052DL

USB version with Stamp and USB Cable.Parallax Board of Education Full Kit $98.90

$8.95BOE Full KitParallax 7.5V Power Supply

Sweep Function Generator3MHz, 6 Waveform Functions, Int/Ext Counter, lin/log sweep

$135Model FG-30(no display)

Model FG-32(5 digit display) $195

DC Power Supplies

$95Model HY3003Variable Output, 0-30VDC, 0-3Amp. Model HY3003-3Two 0-30VDC, 0-3Amp Variable Outputs plus 5V 3A fixed. $195

0603ZD9848W Soldering StationTemp. Controlled310oF~840oF $15.25

is attached to the nRF52832, to visually signal a completed data exchange.

The SPI operations can be seen in Screenshot 4. Note the SPI Master always clocks out an ASCII 1. It doesn’t matter in this case what the SPI Master sends as we’re only interested in the SPI Master supplying a clock to retrieve the SPI Slave data. As you can see in Screenshot 4, the SPI Slave sends one byte of its txBuf with each data exchange cycle.

We Ain’t Done YetThere is much more we can glean from

the Raytac BLE module that houses a Nordic

nRF52832. In the meantime, check out the Nordic Semiconductor website, build up an nRF52832 jig, and write some Bluetooth Low Energy code of your own. NV

Raytac MDBT40 BLE ModuleRaytac

www.raytac.com

nRF52832Nordic Semiconductor www.nordicsemi.com

n SCREENSHOT 4. Each cycle of data exchange transfers two bytes: one from the SPI Master (ASCII 1) and one from the SPI Slave (txBuf[i]).

ADVANCED TECHNIQUES FOR DESIGN ENGINEERS

Eady - Design Cycle - Jan 17.indd 61 12/5/2016 8:17:10 PM

Page 62: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

62 January 2017

process while doing other work on the other screen.

John DrakeAnn Arbor, MI

#2 Quite easy to do. You need to get a cable to go from the RCA jacks on your cassette deck to a stereo mini plug to go into your PC. Very common, but if you can’t find one, then Amazon has them. Dynex A20420 and many others. For your purposes, practically anything will do.

Then, download Audacity, which (in my humble opinion) is the best audio editing program out there — especially since it is free. Go to www.audacityteam.org for the details. For MP3 export, you’ll also need something called LAME, available on the Audacity site. Play your tapes into Audacity, then export them either as single songs per file or entire sides. For that matter, you can capture both sides of the tape and use Audacity to remove the dead areas that occur while changing sides. Or, if you only like a couple of the songs, just copy and paste what you want.

Jerry McCartyvia email

[#10161 - October 2016]Fan Conversion

My desk fan has a three-position switch: HI/OFF/LOW. I would like to convert the fan to variable speed. Will a simple lamp dimmer work for this purpose?

#1 Please do not even think of using a simple lamp dimmer for this!

Lamp dimmers are for incandescent (filament) bulbs only — not inductive motor (AC or DC) loads — and will likely cause a fire! A lamp dimmer connected to a ceiling fan caused such a fire, nearly burning my neighbor’s house down! Don’t do it.

The easiest, cheapest, and safest

Send all questions and answers by email to [email protected] via the online form at www.nutsvolts.com/tech-forum

R E A D E R - T O - R E A D E RTECHFORUM>>> QUESTIONSUno-Known Device

I’ve used the Arduino IDE with a genuine Arduino Uno board for experiments for a few months without trouble. Recently, I wanted to permanently put an Uno in a desktop project, so I purchased some budget Arduino Uno compatible boards. The budget boards seem fine, but the Arduino IDE doesn’t recognize any of them. When connected, the boards show up as an “Unknown Device.” I am using Windows 7 32-bit. Does anyone have any pointers on how to make this board work?#1171 Michael Allison

Camden, NJ

Trainsformer NeededI found a bargain at a local thrift

store and now have a 1959 Marklin HO Scale train, cars, and track. The set didn’t come with a transformer, so I thought it would be a fun project to build from scratch. Does anyone have a schematic or suggestion for a DIY train transformer they can share?#1172 Alfred Thompson

Kingsport, TN

Turn Signal SignalI have a newly restored 1971

Honda CB350 motorcycle that I ride for fun on the weekends. One problem is forgetting to turn off the turn indicators. I have found a kit that “beeps” every time the indicator lights up, but it's very annoying as I sit at a light. I would like a circuit that would alert me only if the turn indicator stays on for more than two minutes. Schematic would be welcome!#1173 Leland Collins

Gulfport, MS

How Much Tolerance Is Enough?When designing circuits, is there

a rule of thumb for picking voltages

and tolerances of components? For example, if my power source is 12 volts, is an electrolytic capacitor with a 24V rating “better” than one with a 16V rating? What do good designers use as a margin?#1174 Enrico Gutiérrez

Panama City, FL

>>> ANSWERS[#9162 - September 2016]What’s The Deal With Ultra Caps?

I am looking to experiment with “ultra capacitors” as a replacement for AA batteries. Is this possible to do and, if so, what kind of capacitors would be a good place to start?

#1 The short answer is NO. The main function of ultra caps is for TEMPORARY backup of memory type devices (i.e., clocks in DVD players) during brief (i.e., less than a day) power outages. They are NOT suitable nor designed to replace batteries simply because, as they are electrolytic capacitors, they need recharging when their stored energy is depleted. Also, they’re not really designed for current loads greater than a couple hundred microamps. This subject has come up a few times in the past couple of years and I believe N&V had an article comparing ultra caps to batteries (primary and rechargeable).

Ken SimmonsAuburn, MI

#2 This is only practical when the current draw is very low. A coulomb is one amp-second. By definition, a one-Farad capacitor charged to five volts can deliver five coulombs. A single AA battery can deliver at least 1,350 coulombs. This is because the material of the battery is consumed when it is delivering current. The capacitor isn’t consumed; it’s just a tank for electricity. About the only

practical use of a small ultra capacitor is to maintain a CMOS memory while the set is unplugged.

Chip VeresMiami, FL

[#9163 - September 2016]Cassette to MP3

I have a box of cassette audio tapes that I want to convert to MP3 format. What’s the simplest way to do it? I have a Windows 10 PC and a Nakamichi CR-2A cassette deck.

#1 There is a very good little box made just for transferring LPs and CDs to MP3 or wave format. It’s made by DAK and costs $69.90. See the link: www.dak.com/reviews/2021story.cfm.

The box accepts stereo input from any source (including a microphone), provides for balance and loudness adjustment, digitizes it according to the resolution you want, and prepares a file for a CD. You can name the flie and see the audio as it is played. This is especially useful in that you can ensure that the signal is not being clipped. One can then run the file(s) through a hiss and click reduction program, which is especially good as it is based on an algorithm rather than just clipping spikes. Thus, it works on low amplitude as well as high amplitude signals.

The latest software also has a feature which will automatically take out the large gap one may have between sides of tapes or LPs, leaving only, say three seconds. I have found the whole process very satisfactory though time-consuming, as one must — of course — pay a certain amount of attention to whether the tape or LP is finished when doing the conversion. The ideal thing is to have two screens on your computer so you can keep your eye on the conversion

Tech Forum - Jan 17.indd 62 12/5/2016 11:51:12 PM

Page 63: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

January 2017 63

process while doing other work on the other screen.

John DrakeAnn Arbor, MI

#2 Quite easy to do. You need to get a cable to go from the RCA jacks on your cassette deck to a stereo mini plug to go into your PC. Very common, but if you can’t find one, then Amazon has them. Dynex A20420 and many others. For your purposes, practically anything will do.

Then, download Audacity, which (in my humble opinion) is the best audio editing program out there — especially since it is free. Go to www.audacityteam.org for the details. For MP3 export, you’ll also need something called LAME, available on the Audacity site. Play your tapes into Audacity, then export them either as single songs per file or entire sides. For that matter, you can capture both sides of the tape and use Audacity to remove the dead areas that occur while changing sides. Or, if you only like a couple of the songs, just copy and paste what you want.

Jerry McCartyvia email

[#10161 - October 2016]Fan Conversion

My desk fan has a three-position switch: HI/OFF/LOW. I would like to convert the fan to variable speed. Will a simple lamp dimmer work for this purpose?

#1 Please do not even think of using a simple lamp dimmer for this!

Lamp dimmers are for incandescent (filament) bulbs only — not inductive motor (AC or DC) loads — and will likely cause a fire! A lamp dimmer connected to a ceiling fan caused such a fire, nearly burning my neighbor’s house down! Don’t do it.

The easiest, cheapest, and safest

solution is readily available from Harbor Freight Tools. Item 43060 is a “Router Speed Control” and works great with inductive AC or DC motors up to 15 amps (120 VAC). I have several to vary the speed of many tools, not just my router. Costing about $15 a piece, I use this controller with my five-speed wood drill press (when drilling soft metals that require slower speeds); with Harbor Freight’s largest “hurricane” fan (which also has a HI/MED/LOW/OFF switch); and other AC powered fixed speed tools.

Equipped with a 15 amp 3AG type fuse and a three-prong receptacle, this lightweight controller is hard to beat and much safer to use.

BGoodWill KD2FZURahway, NJ

#2 Danger Danger! The typical lamp dimmer is not compatible with the typical cheap fan motor. There are good articles on the Web as to why. Look up shaded pole speed control and see why. That said, I find that box fan motors tend to be okay with better (triac based) motor speed controllers, such as sold by Harbor Freight and on eBay. On a shaded pole motor of a typical cheap fan, overheating the motor is possible.

Jim LacenskiBellevue, WA

[#9164 - September 2016]Transistor Training

I’m retired and re-learning electronics. I am confused about the differences between MOSFET and “regular” transistors. Is there a rule of thumb as to when/where/why you would use one over the other?

Traditionally, MOSFETS were used for small-signal amplifiers and mixers, particularly at high frequencies. High currents or voltages would easily burn

them out. Today, there are power MOSFETS but they aren’t very fast. So the existing MOSFETS tend to fall in two families: Fast but fragile, or strong but slow. Kind of like people.

Chip VeresMiami, FL

[#10162 - October 2016]Fish Caller Circuit

I found a partially assembled kit labeled “Fish Caller.” Does anyone have a schematic for one that I could use to finish it? Also, what’s the theory behind how it works ... or does it?

#1 Seriously, you can find all the circuits you want by Googling “Fish Caller Circuit” and looking at the images. Less than seriously, it emits Fishy Language for “Neener, neener, neener! You can’t catch me!”

Chip VeresMiami, FL

#2 I built one years ago. It was designed to produce a high frequency noise that supposedly attracted fish. Maybe my fish were hard of hearing but it never worked in my field trials. I have never seen them promoted in any fishing supply catalogs either.

M. HermanLaQuinta, CA

#3 Theory: It makes a ticking sound that sounds like a dying fish which attracts other fish.

You might try https://www.electronickits.com/electronic-fish-caller-plan. On the other hand, if all it does is tick, you now know what the circuit is supposed to do and you might be able to complete it with just that much information. The above link sells plans to build such a thing. There are others selling kits as well. I simply did a web search to find the above.

Phil KarrasMt Airy, MD

>>>YOUR ELECTRONICS QUESTIONS ANSWERED HERE BY N&V READERS

Send all questions and answers by email to [email protected] via the online form at www.nutsvolts.com/tech-forum

practical use of a small ultra capacitor is to maintain a CMOS memory while the set is unplugged.

Chip VeresMiami, FL

[#9163 - September 2016]Cassette to MP3

I have a box of cassette audio tapes that I want to convert to MP3 format. What’s the simplest way to do it? I have a Windows 10 PC and a Nakamichi CR-2A cassette deck.

#1 There is a very good little box made just for transferring LPs and CDs to MP3 or wave format. It’s made by DAK and costs $69.90. See the link: www.dak.com/reviews/2021story.cfm.

The box accepts stereo input from any source (including a microphone), provides for balance and loudness adjustment, digitizes it according to the resolution you want, and prepares a file for a CD. You can name the flie and see the audio as it is played. This is especially useful in that you can ensure that the signal is not being clipped. One can then run the file(s) through a hiss and click reduction program, which is especially good as it is based on an algorithm rather than just clipping spikes. Thus, it works on low amplitude as well as high amplitude signals.

The latest software also has a feature which will automatically take out the large gap one may have between sides of tapes or LPs, leaving only, say three seconds. I have found the whole process very satisfactory though time-consuming, as one must — of course — pay a certain amount of attention to whether the tape or LP is finished when doing the conversion. The ideal thing is to have two screens on your computer so you can keep your eye on the conversion

Tech Forum - Jan 17.indd 63 12/5/2016 11:51:55 PM

Page 64: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

meets or exceeds 60% of the investment I will have to incur,I will order from the OEM and take my chances on selling therest. I will keep you posted as to the status of this offer.

Robert Reed

Anode + Cathode = ?

I would like to point out an error on the picture of anLED. The schematic symbol polarity is reversed. The deviceshould be: cathode + and anode -. If the device is hooked upas pictured, it will destruct. You might want to print acorrection in the magazine.

Mike JobeMarion, IL

Thanks for having a look at the article. The LED drawingson page 24 of the October 2016 issue appear to be correct.Have a look at "LED" on Google Images. An LED must bebiased in the forward direction in order to emit light. Thus, +to the anode and - to the cathode. This terminology ofcathode and anode is from the days of vacuum tubes: In avacuum tube, electrons flow from cathode to anode, so thecurrent direction (defined as the flow of positive charges) isfrom anode to cathode.

That said, if you were to connect a low impedancevoltage source — say a battery — of sufficient voltage to theLED in the polarity pictured, the LED would indeed destructafter a brief flash. So, a current-limiting resistor is needed,which is the purpose of R3, R4, and R16 in the circuit.

I did notice one small glitch: the upper-right paragraph onpage 26 refers to Figure 7; the reference should be to Figure10.

Randy Keenan

Defining Electronics

Electronics: The study of the electrical properties of andthe use of electronic devices.

Electronic devices include resistors, capacitors, inductors,diodes, transistors, integrated circuits, antennas, waveguides,electronic tubes, batteries, etc.

Electronics includes laying out circuit boards — signalcrosstalk, current limit for a given width of trace, impedancematching, skew of parallel signals, etc.

A person experienced in electronics will know how toassemble a circuit and how to solder the connections.

Programming DSPs, FPGAs, CPLDs, SoCs,microcontrollers, computers, etc., is just that — programming.Programmers do not need to know which end of a solderingiron to grab. (There has been talk over the years that BSEEgraduates don’t know that either.)

I like the mix of articles and the mix within articles inNuts & Volts Magazine. This includes programming articlesabout microcontrollers that react to and affect real worlddevices. I would not change anything — not the articles northe name.

If you were to change the magazine’s name to Keyboardsand Microcontrollers, please consider that this new namewould make the magazine sound like a purely programmingmagazine and you would probably not get any new readersthat are interested in electronics.

We need Nuts & Volts!!! I know of no other magazinethat fills the bill for me. I like to read the mid-level articles inN&V and the ideas I get from N&V. I like to find out aboutthe new devices used in your articles and mentioned in yourNew Products department such as the DS1820 temperaturesensor, the S.USV Pi, and the EXasPiB.

My background?- Took the Cleveland Institute of Electronics first phone

course.- Got my first phone FCC license 48 years ago. (Yup. I’m

almost older than dirt.)- Was trained in television electronics — receivers and

broadcast equipment — in the Army (MOS 26T).- Graduated from the Univ of MN with a BA in Industrial

Education, Electronics.- Worked as a technician and logic designer.- Most of my employment has been as a computer

programmer — IBM mainframe and PC, have programmed inmore than 25 languages.

- Taught myself PIC16F, PIC18F, and PIC10Fprogramming.

- Have programmed and designed the electronics forseveral microcontroller projects using the PIC18F4685,PIC18F2455, PIC16F767, and PIC10F200.

- Since retirement, I volunteer as the studio engineer fora 50 KW AM station.

PIC programming is so fun because there are noproblems from an RTOS or other operating system — there ISNO operating system. I’m programming right down at thehardware level!

Keep up the good work at N&V and please don’t changeanything.

Mark Peterson

Thanks for the comments, definitions, and a glimpse ofyour impressive background. I don't think we have plans ofchanging the name any time soon.

Bryan Bergeron

ROBOTICS

CLASSIFIEDSLIGHTING

HARDWAREWANTED

READER FEEDBACKContinued from page 7

64 January 2017

DEC and VMEEquipment WANTED!Digital Equipment Corp

andMotorola VME Systems

and PartsBuy - Sell - Trade

CALL KEYWAYS 937-847-2300

or email [email protected]

Reader Feedback - Jan 17_Dev Perspectives - ReadFeed Feb15.qxd 12/5/2016 10:26 PM Page 64

Page 65: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

January 2017 65

Accutrace ..............................67

Actuonix Motion Devices ......11

All Electronics Corp. .............47

Anaren ...................Back Cover

AP Circuits ............................46

Chaney Electronics ...............15

Cleveland Institute of

Electronics ............................52

Command Productions .........19

EarthLCD ................................7

Electronix Express ................61

ExpressPCB ...........................7

Front Panel Express LLC .....39

Hammond Manufacturing .....53

Hitec .......................................2

Maxbotix .................................3

M.E. Labs .............................14

PanaVise ..............................46

Parts Express .......................39

Pico Technology ...................66

PoLabs .................................47

Robot Power ...........................7

Saelig Co., Inc. .......................5

Technologic Systems ............52

BATTERIES/CHARGERSHitec ...............................................2

BUYING ELECTRONICSURPLUSAll Electronics Corp. ..................47

CIRCUIT BOARDSAccutrace .....................................67AP Circuits .................................46ExpressPCB ................................7Front Panel Express LLC ..........39Saelig Co., Inc. ............................5

COMPONENTSAll Electronics Corp. ..................47Chaney Electronics ......................15Electronix Express ........................61Parts Express ...............................39Saelig Co., Inc. ............................5

DESIGN/ENGINEERING/REPAIR SERVICESAccutrace .....................................67AP Circuits .................................46Cleveland Institute of Electronics .52ExpressPCB ................................7Front Panel Express LLC ..........39

DEVELOPMENTPLATFORMS/TOOLSAnaren ........................Back CoverTechnologic Systems .................52

EDUCATIONCleveland Institute of Electronics .52Command Productions .................19M.E. Labs .....................................14PoLabs .........................................47

EMBEDDED SYSTEMSSaelig Co. Inc. .............................5Technologic Systems .................52

ENCLOSURESFront Panel Express LLC ..........39Hammond Manufacturing .............53

LCDs/DISPLAYSEarthLCD ........................................7Saelig Co., Inc. ............................5

MICROCONTROLLERS /I/O BOARDSM.E. Labs .....................................14Technologic Systems .................52

MISC./SURPLUSAll Electronics Corp. ..................47

MOTORS / MOTORCONTROLActuonix Motion Devices ..............11Hitec ...............................................2Robot Power ...................................7

ROBOTICSActuonix Motion Devices ..............11

Chaney Electronics ......................15Cleveland Institute of Electronics .52Electronix Express ........................61Hitec ...............................................2Maxbotix .........................................3Robot Power ...................................7

SENSORSMaxbotix .........................................3

TEST EQUIPMENTChaney Electronics ......................15Electronix Express ........................61Pico Technology ...........................66PoLabs .........................................47Saelig Co., Inc. ............................5

TOOLSPanaVise ...................................46Parts Express ...............................39PoLabs .........................................47

TRANSFORMERSHammond Manufacturing .............53

WIRE, CABLE AND CONNECTORSAll Electronics Corp. ..................47

WIRELESS PRODUCTSAnaren ........................Back CoverTechnologic Systems .................52

ADvertiser INDEX■ L O O K F O R ■ S E A R C H F O R ■ F I N D Find your favorite advertisers here!

ELECTRONETFor the ElectroNet

online, go to

www.nutsvolts.comclick Electro-Net

www.dlpdesign.com

Add USB to your next project--It's easier than you might think!USB

USB-FIFO USB-UART USB/Microcontroller BoardsDesign/Manufacturing Services AvailableRFID Readers

Absolutely NO driver software development required!

Wanna read even more about electronics?Check out our book selection atstore.nutsvolts.com

COMPONENT & PRE-WIRED LEDS • LED BULBS • LED LIGHT ENGINESCOMPON EDSIRED LEDNT & PRE EDCOMPONENT & PRE-WIRED LEDS MPONE LIGHT EN LI NESNNES • LED BULBS • LED LIGHT ENGINUULBS D BU ED LI

ElectroNet - Index - Jan 17_Mar15 -NV - NewProducts.qxd 12/5/2016 11:38 PM Page 65

Page 66: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

Full Page.indd 66 12/6/2016 3:28:07 AM

Page 67: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

(408)748-9600

ea ea ea

Our Full Service Capabilities:

ITAR I SO 9001:2008 UL Approved

Full Page.indd 67 12/6/2016 3:33:52 AM

Page 68: Cutting Corners, Without Compromise! - Ebook-dl RGB LED Strips and Hall ... feeds that’s constructed from the same circuit that also ... powered torch or soldering iron so

“Fetch more coffee, Rex!”

A giant, co�ee-carrying IoT dinobot at the command of your index �nger? Why not. Infact, wherever your imagination leads you, Anaren empowers you with the industry’s easiest-to-use wireless connectivity platform. Scan the code to learn more and registerfor a chance to win a free Atmosphere MSDK.* Think. Build. Connect.

* Must be 18 to participate. No purchase necessary. North America only. Void where prohibited. Other restrictions apply. www.anaren.com/air/win

Dino ad fullpage 8-16.qxp_Layout 1 9/1/16 1:38 PM Page 68

Full Page.indd 68 9/6/2016 5:28:19 AM