Author Archives: SparkFun Electronics

Mort and Mary Present: The Mind-Controlled Light Switch

via SparkFun: Commerce Blog

I have been wanting to get my hands on the Neurosky MinWave Mobile for a while now. The head-gear is a BLE-enabled, portable EEG device and a great introduction to brain-computer interaction. I wanted to take that a step further by experimenting with brain-computer control. Since this is my first project with the MindWave Mobile, I figured I better do an analogous “Blink Sketch” thing – turning on an LED. I chose to use the IoT Power Relay to control a light, fan or even a TV, with a Raspberry Pi to accept the commands sent by the app.

Mort and I used the Android Developer Toolkit for the MindWave Mobile and settled on “Attention” as the control mechanism. When the attention level reaches a threshold value (mine was about 60/100 and Mort’s was 100/100) a message would be sent via socket to the Raspberry Pi to make the switch on the power relay. The Raspberry Pi is running a Python script that controls the GPIO connected to the relay. It’s an overly complicated way of turning off the TV at night, but I’ve now gotten my feet wet in Android development and got to play with the MindWave Mobile.

Where to next? Mike Horde had the predictably amazing idea to turn it into a multi-player game that shocks the players who are slowest to turn on their light. So yes, this will happen.

comments | comment feed

The Beast Awakens: Following the Falcon Heavy

via SparkFun: Commerce Blog

SpaceX is nothing if not audacious.

The company was formed in 2002 by internet entrepreneur and space enthusiast Elon Musk. Although Musk’s long-term business goal was to colonize Mars, he chose an easier (!) near-term goal: disrupt the satellite-launching industry. Traditionally dominated by large aerospace firms funded by equally large government contacts, this was something many companies before his had tried and failed.

Falcon Heavy at night

Rocket science is hard, especially when you’re starting from scratch. The first three rockets SpaceX launched failed spectacularly, as rockets often do. But failure is the best teacher, and each successive launch made it a bit further downrange. Rocket science is also expensive, and having burned through almost $200M in capital, Musk notes that if the fourth launch had failed he would have thrown in the towel. Fortunately the fourth Falcon 1 reached orbit — the first privately built ground-launched vehicle to do so. Since then all SpaceX mission patches have included the four-leaf clover that someone had, perhaps in a bit of desperation, added before that launch.

SpaceX would launch only one more Falcon 1 before deciding to jump directly to a much more powerful vehicle, the Falcon 9, with the even more audacious goal of recovering spent rockets for reuse. Rockets are hand-built skyscrapers of exquisite precision, and the fact that they were traditionally discarded with each launch is what made spaceflight so expensive. Musk realized early on that it cost $50 million to build a Falcon 9, but only a few hundred thousand dollars to refuel it. If SpaceX could recover and refurbish the boosters, they would revolutionize the industry.

But turning an 18-story-tall rocket going 7500kph around and descending from 100km to a soft landing is no easy feat. SpaceX took an evolutionary approach to developing this capability, quietly performing re-entry and steering tests during commercial flights after the boosters were discarded, working on ways to manage sloshing fuel to prevent the engines from sucking air, practicing soft “landings” in the open ocean before attempting to land on a ship, etc. Every experiment and attempt, even if it were a failure, provided valuable knowledge that moved them closer to their goal. Eight years later, despite occasional setbacks, SpaceX is regularly launching, landing and reusing first stages on commercial and government flights, with a success rate that is almost boring.

All of that’s about to change.

Falcon Heavy

Even while they were perfecting the Falcon 9, SpaceX was working on their next rocket. Now their first super-heavy-lift vehicle is almost ready for its debut. The easy way to describe the Falcon Heavy is to say that it’s three Falcon 9s strapped together, but that belies the sheer complexity of this vehicle. “It actually ended up being way harder to do Falcon Heavy than we thought,” states Musk. “Really way, way more difficult than we originally thought. We were pretty naive about that.”

Nicknamed “The Beast” by COO Gwynne Shotwell, the Falcon Heavy will be the most powerful rocket currently operating by a factor of two. Fully fueled, it weighs more than 1.4 million kilograms. It will be capable of putting 64,000 kilograms into Low-Earth Orbit (for reference, the entire ISS weighs a bit over 400,000 kilograms), 27,000 kilograms into Geosynchronous-Transfer Orbit, 17,000 kilograms into Mars-Transfer Orbit — or sending 3500 kilograms to Pluto (seven times the mass of the New Horizons spacecraft). It has a total of 27 first-stage engines generating over 5 million pounds of thrust at liftoff. It’s been designed from the ground up to be human-rated (“a mountain of paperwork,” says Musk). And amazingly, SpaceX plans on recovering all three of the Falcon Heavy’s boosters. The two outboard rockets will return to the launch site and land side-by-side on solid ground. And after burning a bit longer, the center booster will land on SpaceX’s “Autonomous Drone Ship” 200 miles out to sea; a ballet of epic and explosive proportions.

Falcon Heavy in hangar

As SpaceX learned from the Falcon 1 days, the first time you fly a new rocket, you quickly begin learning the things you didn’t know you didn’t know — or, as they’re called in the industry, “unknown unknowns.” Since this often results in the complete loss of the vehicle (not to mention everything in the vicinity), SpaceX is understandably taking things slowly. For the past month they’ve been proceeding through ground tests: rolling out and erecting the unfueled vehicle on the pad to test the ground-support equipment, and filling and draining the fuel tanks with kerosene and supercooled liquid oxygen, known as a “wet dress rehearsal.” The last big test will be the “hotfire,” where all 27 engines are briefly ignited while the rocket is (hopefully) securely bolted to the pad. (SpaceX engineers are still working out the details of staggering the ignition times to avoid breaking the hold-down hardware.) Assuming the vehicle isn’t destroyed in the process, this will (hopefully) provide the final data proving that the beast is ready for flight.

Unlike NASA, SpaceX is a commercial company without a mandate to release information to the public, so outsiders don’t know a whole lot about how these tests are progressing. However, SpaceX has said that the hotfire test is imminent (possibly even today), and that if everything goes well, launch could occur “NET” (No Earlier Than) the end of January. But this depends entirely on how difficult the problems they’re finding are to understand and fix, as well as all the normal details of rocket launching such as weather, range priorities, etc. This could take days, or months, or possibly even years. (SpaceX originally estimated that the first Falcon Heavy would launch in 2013.)

At the same time, there’s only so much testing and analysis you can do on the ground, and SpaceX has a reputation for being careful, but not too careful. Musk himself is pessimistic about the chances of a flawless first flight. “There’s a real good chance the vehicle won’t make it to orbit. I hope it makes it far enough away from the pad that it does not cause pad damage. I would consider even that a win, to be honest.”

Elon's Tesla Roadster installed in the Falcon Heavy

As if all this isn’t enough, to permanently establish Musk’s reputation for being larger than life to Bond supervillain levels, the sole payload on the first flight will be Musk’s personal cherry-red Tesla sports car. This was assumed to be one of Musks’s well-known jokes, until photos emerged of the car actually being encapsulated in the rocket’s fairing. Assuming the launch goes better than he thinks it will, the flight plan is to depart Earth and release the car into a Mars-transfer orbit. Mars won’t be in the right place at the right time for the car to actually get there (no doubt to the relief of NASA’s Planetary Protection Office, which doesn’t like anyone spreading Earth germs around the solar system). The car will circle the sun for potentially billions of years, or at least until someone, more than likely one of Musk’s descendants, recovers it and puts it in the Smithsonian Air and Space Museum.

So get your popcorn and livestreams ready. But remember that no matter what happens during this first launch, SpaceX will learn valuable lessons, try again (and again if necessary), get things working and commence normal business operations. It’s been said that the two keys to success in the space industry are money and persistence; Musk clearly has both. SpaceX already has three customers lined up for future Falcon Heavy launches (currently $90M if you’re interested), and SpaceX is working on additional launch facilities on the west coast and in Texas. And even while they’re busy getting the Falcon Heavy functional, SpaceX is working on their next rocket — one that will dwarf even the Heavy and that’s being designed specifically to support Mars colonization. This may seem wildly unrealistic now, but that’s what people said when the first Falcon 1 rolled out back in 2006.

Mars Colonial Transporter rocket enroute to Mars

comments | comment feed

SparkFun’s Sustainability: A 15-Year Footprint

via SparkFun: Commerce Blog

sf logo green flame

Although SparkFun is well-known for its red boards and red flame logo, our complementary color is green. Since the beginning we’ve been committed to keeping our business as environmentally friendly as possible.

This month SparkFun is celebrating our 15th anniversary. Over a decade and a half, the company has moved from founder Nathan Seidle’s college bedroom to the basement of a rental house…and finally to our current headquarters. Our 80,000-square-foot HQ was the first building in Boulder County built to the International Green Construction Code (IgCC), and we broke ground on May 1, 2013 — just three days before Nate got married!

SparkFun HQ

The building is equipped with a 220kW rooftop solar array consisting of 672 Sunpower 327W high-efficiency modules. The array covers about a third of the roof and generates, on average, about a third of the power we use. In the summer months that amount can increase to 45 percent. Thanks to a REC (Renewable Energy Certificate) credit from Xcel, we get paid for generating the energy and then we get to consume it for free — this is called “net metering.” Solar is ideal in Colorado, where we get about 300 days of sunshine per year. You can use the PVWatts Calculator created by the National Renewable Energy Laboratory (NREL) and read this past post to find out if it makes sense for you.

In addition to solar panels on the roof, the building was built with timed lights and optimal use of natural lighting from skylights, solar tubes and large windows. “Gray-to-go-green” outlets are also found throughout our HQ. These outlets are on an automated timer relay and shut off at night, cutting the “vampire” draw from electronics when no one is in the building.

Anyone can monitor SparkFun’s use of power at any given moment via an online Lucid building dashboard, which also displays green tips like this one:

alt text

Part of adhering to the IgCC building guidelines was having recycling centers around the building. This, in addition to composting, worked for employees’ lunch remnants, but there were some things from manufacturing that couldn’t go in the compost or single-stream recycling. For instance, as SparkFun started to really grow, the amount of packing materials we accumulated was astounding. We went from this (Nate’s college bedroom in 2003):

Pile of packages on bed

To this in 2007:

Moving into new space upstairs

To this in 2016:


It was necessary for us to look into other options for disposing of all of these boxes, packing materials and industrial scraps from our manufacturing. We are fortunate to have in our community Eco-Cycle, a nonprofit company offering a variety of alternative recycling solutions through their Center for Hard-to-Recycle Materials (CHaRM) facility. We have been a Green Star Business since 2014 and now have alumni status so we can mentor other businesses.

The hard-to-recycle materials we’re able to recycle through CHaRM include packaging materials like film plastic, reels, trays and Styrofoam™ (as well as generic types of polystyrene foam). But as the saying goes, one man’s trash is another man’s treasure. As the STEM/maker education movement took off, we discovered that some of the materials we would normally divert through Eco-Cycle were in high demand with teachers. In 2012, the Resource Area for Teachers (RAFT) in Denver asked us to teach soldering at its interactive summer symposium. It was the beginning of a beautiful partnership that allows us to get hard-to-recycle materials into the hands of teachers and students who can reuse them.

SparkFun donates approximately 200 pounds of materials a month to RAFT. Materials are either used in activity kits, which are available online, or placed in large bins that educators can rummage through to find supplies for hands-on projects or to stock a makerspace. The Roller Racer, Solar Jitterbug, Puff Rocket and Flashlight Fun kits all contain upcycled materials from SparkFun.

solar kit

Materials for RAFT and Eco-Cycle are sorted weekly by a team of environmentally-minded employees led by SparkFun Facilities Manager Nick Beni. In 2017 Beni was named Recycler of the Year by the Colorado Association for Recycling.

recycler award

“It’s important to have a champion within the planning committee to drive sustainability,” Beni advises. “From there the team can develop their mission and plan of attack for the changes they are trying to make. The plan should have some low-hanging, easily attainable fruit and some high-hanging fruit that will take time to develop.”

Last year was the first full year SparkFun tracked its waste diversion efforts. In 2017 we diverted a total of 5,469 pounds, or 2¾ tons, from the landfill via Eco-Cycle and RAFT.

recycle bins

alt text

alt text

These numbers do not include compostable material, which, according to Eco-Cycle, totaled 5,106 pounds in 2017. It likewise does not include scrap metal recycled via Eco-Cycle or e-waste employees bring in from the office and from home to safely dispose of via Rocky Mountain E-Waste. SparkFun has recycled more than 1,000 batteries through our e-waste bin.

According to the U.S. Environmental Protection Agency (EPA), approximately 40 percent of heavy metals in landfills — including lead, cadmium and mercury — comes from discarded electronic equipment. In the past, SparkFun has held a community e-waste drop-off event, inviting people from around the region to come safely dispose of their unwanted electronic equipment. We plan to revive that event this year in an effort to keep toxic materials out of the landfill and give nontoxic materials a new life.


In 2016 Eco-Cycle and SparkFun worked together to make the annual Autonomous Vehicle Competition (AVC) a Zero Waste event. With about 1,500 people attending AVC the year prior, we used about 1,000 water bottles. In 2016 we encouraged people to bring their own reusable water bottles, sold SparkFun bottles and set up water stations with 5-gallon jugs and compostable cups, eliminating the plastic bottle waste. Eco-Cycle also provided separate bins for trash, single-stream recycling and compostable waste, including compostable containers and utensils from the food trucks on site.

What Your Business Can Do

Whether or not solar energy is in your future, there are many things your business can do to be more sustainable in 2018 and beyond. At minimum, ensure that your recyclable and compostable waste is staying out of the landfill. Clear, detailed signage throughout the office goes a long way toward getting employees to put their waste in the correct bins. If you generate waste that is unusual or hard-to-recycle, seek out a hauler like CHaRM or find out if there is anyone in the community who could make good use of it.

“One important aspect of business sustainability is developing strategic partnerships with other businesses,” Beni says. “Talk to your local trash-hauling service and see what other haul options they might have.”

Check with your local energy provider about rebates for solar, HE appliances and energy-saving systems. Never stop thinking about ways you can make your building more energy-efficient. This year SparkFun is upgrading our outdoor lighting, replacing the 100W metal halide lights in 28 lampposts with 29W LEDs. Beni estimates the upgrade will pay for itself in about two years — not to mention it’s better for the environment.

alt text

“Working on sustainability is a processes,” Beni emphasizes. “Our process at SparkFun is constantly evolving. Saving money here allows us to spend elsewhere to maximize our efforts.”

Last year the sustainability team organized SparkFun’s first-ever neighborhood cleanup event. Employees volunteered to spend an hour picking up trash across about a mile of area surrounding the building. We ended up with 104 pounds of trash and 22 pounds of recycling and plan to do it again this year, possibly as an Earth Day event involving volunteers from neighboring businesses. Why not talk to your neighbors?

alt text

If your company hosts events, consider asking your recycling provider for help making those events Zero Waste. As a Green Star Business, SparkFun uses a document that Eco-Cycle created to get food vendors to agree to use compostable serving plates and utensils instead of Styrofoam and plastic.


If you decide to offer compostable cups at your event, Beni suggests asking attendees to write their names on them in order to limit waste to one per person. And encourage people to bring their own reusable bottles!

Fostering a sustainability mindset is one of the most important things you can do. In addition to reducing, reusing and recycling, SparkFun encourages employees to bike to work, providing community bicycles, locker rooms and even a repair/tune-up truck that comes to the building.

bike repair truck

In the summer employees organize “Chain Gang” lunch and happy hour rides, and SparkFun participates in the Love to Ride June Bike Month challenge. Last year we took second place among similar-sized companies in Boulder, motivating 34 new riders and reaching 39 percent employee participation.

alt text

SparkFun also offers employees a free bus pass and RTD-guaranteed ride home, in addition to partnering with Lyft.

Part of being in business is making an environmental footprint, and there’s always more we could be doing for the environment. But with sustainability as a top priority, SparkFun can feel good about celebrating 15 years on this planet! Thank you for being part of our story.

comments | comment feed

6 Things We Learned from our Community Partnership Program in 2017

via SparkFun: Commerce Blog

SparkFun’s Community Partnership Program facilitates hardware donations to applicants who are using maker technology to improve their communities. Here are some quick stats from 2017:

  • Total applications: 665
  • Total awarded Community Partners: 174
  • Top five states represented: Colorado, California, Florida, New York and New Jersey

When we launched the program in January 2017, we had no idea what kind of interest we’d receive or what kinds of requests would come through. We had an overwhelming number of school and youth organizations apply, citing causes like maker education, supporting girls in STEM fields and increasing opportunities for students to prep for real-world careers. Here are some of our observations from reviewing over 600 applications.

Young makers put social issues front and center

For many of us, the maker movement is still a cause in and of itself to get behind, but through our Community Partnership Program we saw projects from makers of all ages aimed at solving other social issues. We saw students at DSST Cole High School in Denver that will be monitoring pollution during construction on a local freeway, and a group of students from Ohio State University’s Toy Adaptation Program at the College of Engineering hack popular toys to become assistive tech devices.

alt text

Support for girls and women in STEM comes mostly from extracurricular programs

In addition to the diverse range of social issues represented in the applications, a vast number of them sought support for initiatives designed to support girls and women in STEM fields. We’ve seen some incredible programs across the country that leverage e-textile tools like LilyPad to bring together sewing and circuitry, including the Society of Lady Makers in Atlanta and the Marston Science Library at the University of Florida. Some of our 4-H partners have used conductive paint to create interactive art, including one wall mural that played recordings of students' musical performances.

We’ve also seen partners introducing women and artists to electronics through hackathons like the all-female Break to Make at the University of Southern California, and Hack Music LA at the LA Philharmonic.

The global maker movement is alive and well

We had no idea we’d receive so many applications from around the world, most notably from students in India, South Africa and Nigeria. We heard from a nonprofit in Lagos, Nigeria, that provides free prosthetic devices to folks with upper-limb discrepancies; an amateur radio operator running an aerospace program in Port Elizabeth, South Africa; and a college student in the Netherlands using the LilyPad Vibe Board and other SparkFun hardware to create wearable devices that detect and reduce tremors for individuals with Parkinson’s Disease.

All over the world, teachers and students shared with us their commitment to use maker technology to teach 21st century skills and solve problems in their communities.

alt text

Robotics is your first priority.

Everyone is building robots! Well, not everyone, but the term “robotics” was mentioned 803 times in Community Partnership applications this year, while “coding” was a close second at 774 mentions. We saw a handful of swarm robot projects, autonomous vehicle projects and robots that can perform specific tasks, like picking up certain objects.

Many teachers expressed the challenge of introducing robotics to students when they themselves have very little experience, and shared how valuable simple tools like the SparkFun Inventor’s Kit for RedBot or the micro:bot expansion kit for micro:bit are to beginning robotics. We saw a lot of robotics activity at the high school and university levels, as well as a lot of early interest at elementary and middle schools. Lesson learned: More resources for teaching robotics are in high demand! If you haven’t already, check out the new version of our flagship SparkFun Inventor’s Kit, where building an autonomous robot is the culminating project.

STEM thrives in the summertime

Holy STEM summer camps, Batman! Big shout-out to all the schools and libraries spearheading STEM summer camps for kids — you are all heroes! From soldering and soft circuits, to conductive paint and programming, during the summertime it’s likely you’ll find students leveling up their skills. Campers at The Refuge in Sunbury, PA, learned to solder by making badges to play an electronic game of Rock, Paper, Scissors. Students at a Mariachi music camp at Oregon State University shared their recordings via an interactive mural created with a Bare Conductive Touch Board, conductive paint and copper tape.

Students are getting access to real projects at real companies more than ever before

Well, one thing’s for certain: SparkFun hardware was well-represented at SpaceX’s first collegiate-level, hyperloop design competition. Over the course of last year, we saw an uptick in the number of student applications for corporate- or government-backed projects and competitions, from NASA to SpaceX and, of course, FIRST Robotics.

Increasingly, we’re seeing closer ties between schools' STEM-related departments and local businesses or government agencies for purposes of professional training, helping students gain relevant job experience and leveraging students’ ingenuity to solve innovation challenges. One example was a team from the Engineering and Science University Magnet School (ESUMS) in Wallingford, CT, that won the International Paradigm Challenge for their Wasteless Urban Composter design.

alt text

Do you have a cool project you’ve been looking to get funded? Do you want send us some photos of your build in exchange for free hardware? Take a minute to apply to our Community Partnership Program here.

comments | comment feed

Friday Product Post: Jack be Nimble, Jack be Qwiic

via SparkFun: Commerce Blog

Hello everyone, and welcome back to another fantastic Friday Product Post here at SparkFun! We are getting back into the swing of things after last week’s huge Crystal Anniversary Sale with four new products to get your brilliant minds ticking. This Friday we start off with two new Qwiic boards — one that incorporates a handy, blue-on-black OLED screen and one that’s a smart human presence sensor. Closing out the week we have an updated version of the SIK for micro:bit and another handy micro:bit Lab Pack for all of our educator friends. Without further ado let’s jump in and take a closer look at all of this week’s new products!

Jack jump over the candlestick!

SparkFun Micro OLED Breakout (Qwiic)


The SparkFun Qwiic Micro OLED Breakout is a Qwiic-enabled version of our popular Micro OLED display! The small monochrome, blue-on-black OLED screen presents incredibly clear images for your viewing pleasure. It’s “micro,” but it still packs a punch — the OLED display is crisp, and you can fit a deceivingly large amount of graphics on there. This breakout is perfect for adding graphics to your next project and displaying diagnostic information without resorting to a serial output, all with the ease of use of our own Qwiic Connect System!

This version of the Micro OLED Breakout is exactly the size of its non-Qwiic sibling, featuring a screen that is 64 pixels wide and 48 pixels tall and measuring 0.66" across.

SparkFun Human Presence Sensor Breakout - AK9753 (Qwiic)


This is not your normal PIR! The SparkFun AK9753 Human Presence Sensor Breakout is a Qwiic-enabled, 4-channel Nondispersive Infrared (NDIR) sensor. Each channel has a different field of view, so not only can the AK9753 detect a human, but it can also tell which direction the person is moving. To make it even easier to use this breakout, all communication is enacted exclusively via I2C, utilizing our handy Qwiic system. However, we still have broken out 0.1" spaced pins in case you prefer to use a breadboard.

SparkFun Inventor's Kit for micro:bit


The SparkFun Inventor’s Kit (SIK) for micro:bit is a great way to get creative, connected and coding with the micro:bit. The SIK for micro:bit provides not only the micro:bit board but everything you need to hook up and experiment with multiple electronic circuits! With the SIK for micro:bit you will be able to complete circuits that will teach you how to read sensors, move motors, build Bluetooth® devices and more.

SparkFun Inventor's Kit for micro:bit Lab Pack


The SparkFun Inventor’s Kit for micro:bit Lab Pack includes 10 complete micro:bit Inventor’s Kits, an SIK Refill Pack and 25 AA-sized batteries to get your students started in the world of electronics. The SIKs inside the Lab Pack have everything you need, including micro:bits, connector breakouts, breadboards and all the cables and accessories to hook up all the projects listed in our online Experiment Guide.

And that’s it for this week, everyone! We hope you get a lot of great use out of all the new products this week. As always, we can’t wait to see what you make with these products! Shoot us a tweet @sparkfun, or let us know on Instagram or Facebook. We’d love to see what projects you’ve made!

Thanks for stopping by. We’ll see you next week with even more fantastic new products!

comments | comment feed

Enginursday: Gesture-Reactive Wearable Fiber Optic

via SparkFun: Commerce Blog

As I wrap up this big old wearable light suit, I’ve decided to add in some extra controls to my audio reactive control system. I’ve always enjoyed the idea of being able to control the colors very specifically myself, as opposed to being at the whim of the aural environment.


I looked over several different sensor solutions in order to find some effective form of gesture or motion control for my lights. The first one I checked out was a Qwiic Accelerometer, which I got to create some pretty neat colors. But I found that I wasn’t able to control them all that well without my hands being forced into certain positions and orientations. In other words, I was unable to simultaneously dance and control colors. I also checked out a TOF Distance Sensor, which worked fantastic. But with one distance sensor in each hand, I was only able to control two colors at once, and when either sensor was facing the sky, these colors would max out. So again, I was unable to move how I wanted and be the color I wanted to be.


To enable myself to move and change colors independently, I created a small Qwiic-enabled breakout for a few flex sensors that go into each glove. (Maybe you’ll even see it on SparkFun’s storefront someday…hint hint, wink wink:-) The board has an ADC-to-I2C that takes the readings and converts them into nice, easy I2C data so we don’t have to use any of the analog pins on our microcontroller. This approach was used to save wiring going from the gloves to the microcontroller, as pulling an analog read off of each finger would take quite a bit more cabling.


Now to translate readings from our hands into colors on the suit. This part is relatively simple and involves using Arduino’s handy dandy Map function to map the values attainable by the flex sensors (400–800) to values that make sense to an LED (0–255). However, this function “loops” our numbers back around if they get too low or too high. This makes it extraordinarily difficult to completely maximize or minimize a color value, as you’d need to hold your finger perfectly at 0 or 255. To mitigate this, we first pass our value through Arduino’s handy dandy Constrain function to keep our values from falling into a range that will cause them to loop around. Then we simply write these values into our LEDs, and we’re good to go! A snippet of the example code is shown below, and the library and breakout board used in these gloves will be available soon for all of your gesture-control needs.

#include "FastLED.h"
#include <Wire.h>
#include <SparkFun_ADS1015_Arduino_Library.h>

#define DATA_LEFT_ARM 11
#define CLOCK_LEFT_ARM 13
#define DATA_RIGHT_ARM 0
#define CLOCK_RIGHT_ARM 32
#define DATA_LEFT_LEG 7
#define CLOCK_LEFT_LEG 14
#define DATA_RIGHT_LEG 21
#define CLOCK_RIGHT_LEG 20
#define DATA_BELT 28
#define CLOCK_BELT 27

CRGB rightArm[NUM_LEDS];
CRGB rightLeg[NUM_LEDS];

ADS1015 glove;
ADS1015 glove1;

uint16_t red;
uint16_t green;
uint16_t blue;
uint16_t waveFrequency;
uint8_t redMap;
uint8_t greenMap;
uint8_t blueMap;
uint8_t waveFrequencyMap;

void setup() {
    FastLED.addLeds<APA102, DATA_LEFT_ARM, CLOCK_LEFT_ARM, RBG, DATA_RATE_MHZ(8)>(leftArm, 48);
    FastLED.addLeds<APA102, DATA_LEFT_ARM, CLOCK_LEFT_ARM, BGR, DATA_RATE_MHZ(8)>(leftArm, 16);

    FastLED.addLeds<APA102, DATA_RIGHT_ARM, CLOCK_RIGHT_ARM, RBG, DATA_RATE_MHZ(2)>(rightArm, 48);
    FastLED.addLeds<APA102, DATA_RIGHT_ARM, CLOCK_RIGHT_ARM, BGR, DATA_RATE_MHZ(2)>(rightArm, 32, 16);

    FastLED.addLeds<APA102, DATA_LEFT_LEG, CLOCK_LEFT_LEG, RBG, DATA_RATE_MHZ(2)>(leftLeg, 40);

    FastLED.addLeds<APA102, DATA_RIGHT_LEG, CLOCK_RIGHT_LEG, BGR, DATA_RATE_MHZ(2)>(rightLeg, 40);
    FastLED.addLeds<APA102, DATA_RIGHT_LEG, CLOCK_RIGHT_LEG, RBG, DATA_RATE_MHZ(2)>(rightLeg, 8);


    if (glove.begin() == false) {
        Serial.println("Device not found. Check wiring.");
        while (1);
    if (glove1.begin(Wire, 100000, 0x4A, 9600) == false) {
        Serial.println("Device not found. Check wiring.");
        while (1);

void loop() { 

void gloveRead () {
    red = constrain(glove.getAnalogData(0), 500, 800);
    green = constrain(glove.getAnalogData(1), 470, 780);
    blue = constrain(glove1.getAnalogData(0), 500, 815);
    waveFrequency = constrain(glove1.getAnalogData(1), 550, 850);

    redMap = map(red, 500, 800, 0, 255);
    greenMap = map(green, 470, 780, 0, 255);
    blueMap = map(blue, 500, 815, 0, 255);
    waveFrequencyMap = map(waveFrequency, 550, 850, 0, 255);

void basicGlove() {
    for (int LED = 0; LED < 16; LED++) {
        rightArm[LED] = CRGB(redMap, redMap, redMap);
        leftArm[LED] = CRGB(redMap, greenMap, blueMap);
        rightLeg[LED] = CRGB(redMap, greenMap, blueMap);
        leftLeg[LED] = CRGB(redMap, greenMap, blueMap);
        belt[LED] = CRGB(redMap, greenMap, blueMap);
    for (int LED = 16; LED < 48; LED++) {
        rightArm[LED] = CRGB(redMap, greenMap, blueMap);
        leftArm[LED] = CRGB(redMap, greenMap, blueMap);
        rightLeg[LED] = CRGB(redMap, greenMap, blueMap);
        leftLeg[LED] = CRGB(redMap, greenMap, blueMap);
        belt[LED] = CRGB(redMap, greenMap, blueMap);

The finished product, with me in control of the colors, is shown below.

alt text

comments | comment feed