Tag Archives: ATtiny85

How much you can hang off a Trinket (ATtiny85)?

Adafruit’s Trinket platform – based on Atmel’s versatile ATtiny85 microcontroller (MCU) – has been used to power a number of diverse projects in recent months, including an audio playerflickering candle in a jar, a knock drawer lock, a sound-reactive LED color organ and even a rover.

Today, we’re going to take a closer look at an Adafruit forum post by Pocketmoon who wanted to demonstrate just how many components can be hung off the 3.3v ATtiny85-powered Trinket.

Over I2C

  • DS1307 Real Time Clock (includes 24C32 32K Bit I2C EEPROM memory which is also visible on the I2C bus)
  • HMC5883L 3 Axis Compass Magnetometer
  • PCF8574 – Remote 8-Bit I/O Expander for I2C-Bus

Over SPI

  • OLED 128×64 SSD1306
  • 23K256 SRAM Chip – 32K of lovely SPI accessible memory.

“The SRAM provides a screenbuffer for the OLED module, which has no built in RAM. To draw the buffer to the display I read a ‘page’ worth of data (128 Bytes) at a time from the framebuffer and push these to the OLED, both over SPI. So a local 128 byte buffer is needed in the Trinket. All the Trinket pins are in use so I use a small switch to disconnect #3 and #4 during programming,” Pocketmoon explained.

“With SPI you need a separate Slave Select line for each device. These are provided by the PCF8574 which is an I2C IO Expander. I write to this first (over I2C) to select one of the output pins which act as Slave Selects for each SPI device. The outputs (I’m using 2) are then AND’ed with a single Master SS (on #3). This allows the individual SS’s to be driven low by the master SS. Code eequires a bit of jumping between I2C mode and SPI mode and both are using the serial hardware on the ATtiny.”

The display in the photo above shows the time, a compass reading and a time per frame in milliseconds. Pocketmoon says the display is running at about 13fps, with additional room for optimization.

Interested in learning more? You can check out the original forum post here and pick up a Trinket from Adafruit’s official store here for $7.95.

Astrophotography tracking

 with Atmel’s ATtiny85

Astrophotography describes the imaging of astronomical objects along with large areas of the night sky. According to Wikipedia, the first photograph of an astronomical object (the Moon) was taken in 1840, although it was not until the late 19th century that advances in technology allowed for detailed stellar photography.

Image Credit: Wikipedia

In addition to recording the details of objects such as the Moon, Sun, and planets, astrophotography is also capable of imaging objects invisible to the human eye such as dim stars, nebulae and galaxies. This accomplished by long time exposure, as both film and digital cameras can accumulate and sum light photons over extended periods of time.

As HackADay’s John Marsh notes, the basic idea is to capture images otherwise undetectable by the human eye through longer exposures.

“Unfortunately, the big ball of rock we all inhabit has a tendency to rotate, which means you need to move the camera to keep the night sky framed up,” he explains.

Unsurprisingly, the vast majority of professional astrophotography trackers require precision parts and fabrication. However, a Maker by the name of ZigZagJoe found an alternative with Chris L. Peterson’s stalwart Cloudbait Observatory model. 

Dubbed the “Barn Door Tracker,” the platform is powered by Atmel’s ATtiny85 microcontroller (MCU) and runs a pre-configured table that determines step rate against time.

Interested in learning more about ZigZagJoe’s ATtiny85-powered astrophotography tracker? You can check out the project’s official page, along with additional pictures here.


sdlocker goes ATtiny85



Karl Lunt’s original sdlocker was built around Atmel’s ATmega328 microcontroller (MCU). Recently, a new variant (or fork) of the project was launched by Nephiel, who decided to power the latest iteration of the locker with Atmel’s ATtiny85 MCU.

“I routinely use USB drives loaded with software tools and benchmarks to diagnose and fix computers. I wanted a way to protect those drives from viruses, malware, filesystem corruption and accidental erase,” Nephiel wrote in a blog post describing the project.

“USB drives with a write-protect switch do exist, but are hard to find and expensive. Full-sized SD cards have a slider tab to write-protect them, but it actually does nothing – it’s up to the card reader to report it to the OS and it’s up to the OS to decide whether to comply and mount the card read-only or not. Most of them simply ignore it, so SD cards may be overwritten regardless of the write-protect tab.”

However, sdlocker allows users to truly write-protect any SD card by toggling the TMP_WRITE_PROTECT bit on the flash memory controller of the card itself.

“Together with a USB card reader, this write-protected card can then be used as a read-only USB drive,” Nephiel continued. “This is my own fork of the original sdlocker, tailored to suit my needs – smaller, simpler and USB-powered.”

Aside from swapping the ATmega328 for the ATtiny85, Nephiel removed all the UART code and unused functions, while rewriting the user interface (1 button, 1 LED). 

The write protection of an inserted card is toggled by holding the button down over half a second. Meanwhile, the LED is tasked with displaying the state of the inserted card at all times, including steady off (card is unlocked, writable), steady on (card is locked, write protected), blinking fast (device is reading the card) and blinking slow (card is faulty, or not inserted properly).

Interested in learning more about Nephiel’s ATtiny85-powered sdlocker? You can check out the project’s official page here.

Wearable tech redefines traditional retail

Forrester analyst Tim Sheedy confirms that smart, wearable technology is fast becoming mainstream.

“In the past week alone, I’ve heard about devices that can improve your tennis swing, improve your posture, sense your presence, and generate energy from walking — not to mention the new smart watches, handheld 3D printers that can draw bones, smart breathalyzers, and, of course (!) smart wigs,” Sheedy wrote in a recent blog post.

“These devices are starting to find their way into the hands of consumers, but much of the retail channel has yet to catch up. Smart locks, smart wearables, and smart fitness devices are all generally being sold through the traditional online and offline channels for electronics and devices; sports stores, clothing retailers, and home hardware stores have been slow on the uptake.”

According to Sheedy, the US has already seen some electronics retailers (such as Best Buy) significantly expand their “smart wearables” section from a small pod to an entire aisle or even a dedicated corner or section of the store. However, many sports stores have not even started carrying the latest fitness tracking devices — something that should be in their sweet spot.

“So what is the future for traditional retailers around smarter wearables? My guess is that they will continue to be pushed to the sidelines over the next two to three years; electronics retailers will prosper at their expense and innovation in wearables will continue to happen elsewhere,” he continued.

“But eventually the traditional clothing retailers will begin to consolidate and innovate. Some large brands will buy the smaller device startups; others will launch their own lines of smart wearable clothing or devices. A large proportion of today’s standalone wearables will be integrated into traditional products.”

Sheedy also emphasized that traditional retailers who to fail to embrace the shift to smart wearables will continue to see their value and market share erode. As such, CIOs in retail should attempt to leverage the data ecosystem of wearable technologies.

“How can the data collected at the device or wearable level perhaps be integrated into the loyalty systems, or help to guide the customer experience strategy? What other internal or external data sources which might, if integrated with your own data, actually create a better outcome for the customer? [Retailers] need to determine a way to make the wearable technology experience better if purchased from [their] stores,” the analyst concluded.

Wearable computing @ CES 2014

Angela McIntyre, research director at Gartner, has confirmed that digital health and fitness will be one of the hottest segments at CES 2014 – with 40 percent of exhibitor floor space expanded for the lucrative segment.

“We expect to see some updates and innovation in wearable cameras, smart glasses, smart watches and headsets. We will see a range of styles and functionality for smart watches as companies experiment with designs that appeal to different potential market segments,” McIntyre explained.

“[Meanwhile], headsets can determine where we are looking, a feature that will be utilized by apps for personal navigation, and by virtual personal assistants to help with in-store shopping. Headsets that read brain waves (EEG) will be used to help improve concentration, serve as controllers for toys, and adjust music according to our moods.”

McIntyre emphasized that despite some of the inevitable hype surrounding wearables, the segments for fitness and personal health devices have been among the first to gain traction.

“Wearable electronics has its strongest consumer base among fitness enthusiasts and wider consumer interest in these devices is leading to broader adoption. The worldwide revenue from wearable electronic devices, apps and services for fitness and personal health is anticipated to be $1.6 billion this year, increasing to $5 billion by 2016,” said McIntyre.

“Wearables support the ‘quantified self’ trend of people tracking their vital signs, activities, and capturing images of what they experience during the day. The fun of wearing and using gadgets to track fitness and health is appealing, and so is using their apps and services. Gamification enables wearers to compete against themselves or others and rewards wearers. Online communities provide camaraderie with those having similar goals. Wearable electronics provide new motivation to consumers for improving fitness and health.”

The analyst also noted that fitness and health devices are mostly composed of activity monitors, pedometers and consumer heart-rate monitors. They may take the form of a fob or wristband, or embedded in a wrist watch, in clothing or in wearable accessories, such as shoes, hats and chest straps.

“At CES, we will see athletic shirts with sensors woven in to track heart rate and respiration during training and competitions. Smart undershirts for infants will monitor their heart rate, breathing and sleep,” she continued.

“Wearable devices for home health monitoring of the elderly will include clothing and accessories, such as wristbands that can track heart rate, monitor activity level during the day, detect falls, provide location information and send alerts to caregivers. With wearable technology, the elderly may to continue to live independently with reduced risk to their health and personal safety.”

Last, but certainly not least, McIntyre points out that consumers will want to know how easily their wearable devices communicate with each other, peripheral computing devices and multiple screens.

“Data will be integrated from more than one wearable device to provide useful information and insights about fitness and health to the wearer. Personal identification, biometric information and payment systems can be linked through wearable devices. Wearers can be admitted to events, access health records, and make purchases, through their wearable devices,” the analyst concluded.

Building an Atmel based wireless MIDI floor piano

Jianan Li and a team of Makers recently designed a wireless MIDI floor piano for Duke University’s Hackathon. According to the Hackaday crew, a DIY Pressure Plate for a haunted Halloween house featured on the popular website served as the initial inspiration for the wireless MIDI floor piano.

“Having only 24 hours to compete in the Hackathon, they had to choose something that was fairly easy to build out of cheap materials, and quick to assemble. This was just the ticket,” explained Hackaday’s James Hobson.

“The piano features 25 of the aluminum foil pressure plates, whose state are read by the [Atmel-based] Arduino Mega. This is then transmitted by an XBee radio to an Arduino Uno (ATmega328), which acts as the receiver for the laptop that processes the signals. They even added a remote control using Atmel’s ATtiny85 to allow for octave and instrument changes – it uses an XBee to communicate back to the Uno.”

Unsurprisingly, the above-mentioned pressure-sensitive wireless floor project isn’t the first that we’ve seen powered by Atmel microcontrollers (MCUs). Indeed, earlier this year, Sean Voisen and his team at Adobe were asked to build “something new” for the Children’s Creativity Museum in San Francisco.

By August, a digital-physical environment for kids called “Sense It” was up and running. With a 14′x8′ touch-enabled LED wall and a 14′x12′ pressure-sensitive floor, the platform can best be described as a place for kids to run, jump, play and create in a world of ‘extra large’ digital experiences. Sense It is built around a system of pressure-sensitive resistors placed under MDF panels, comprising a total of twenty-one 2′x4′ tiles, each one including 8 pressure-sensitive resistors and an ATtiny84 based platform.

Interested in learning more? Additional information about SenseIt can be found here, while the wireless MIDI floor piano project page is available here.

Peel-and-stick electronics with Circuit Stickers

Circuit Stickers are peel-and-stick electronics for crafting circuits. Makers can easily build glowing, sensing and interactive projects with Circuit Stickers, adding electronics to any sticker-friendly surface including paper, fabric and plastic.

“Building circuits with them is fun and easy – just stick them onto a surface like you would with a normal sticker, and build up a circuit by sticking several stickers together,” the Circuit Sticker crew wrote in a recent Crowd Supply post.

“They’re an approachable way to craft with electronics, whether you’re just starting out with circuits or creating complex interactive artworks.”

Currently, there are four primary categories of Circuit Stickers:

  • LED Stickers – Simple LED lights available in white, red, yellow and blue.
  • Effects Stickers – Generate an effect to control your LEDs with blink, fade, twinkle and heartbeat.
  • Sensors Stickers – Includes a light sensor, a microphone sensor for detecting sound and a trigger circuit.
  • Touch sensor/Microcontroller Sticker – Initially configured to to work as a touch sensor, although advanced users can program and customize the on-board ATTiny85 (Atmel) microcontroller (MCU).

“We’ve designed Circuit Stickers to be as easy-to-use as possible, so you don’t need a background in electronics to get started–our interactive sketchbook will teach you the basics,” the Circuit Stickers crew added. “Technically advanced users can program Circuit Stickers and even integrate traditional electronics to create more complex works. Circuit Stickers are also made the work well with a wide range of materials, so you can use whatever art and craft techniques that are most fun and familiar to you.”

Interested in learning more? You can check out the official Circuit Stickers project page on Crowd Supply here.

A tinyAVR USB volume knob

A Maker by the name of Rupert has designed a tinyAVR-powered USB volume knob based on Adafruit’s popular Trinket (Atmel ATtiny85) platform.

“After purchasing a Trinket to experiment with and Adafruit having a great mentality for Open Source Hardware, I decided to modify my own ATtiny85 volume control PCB to make it compatible with the Trinket’s 5Volt firmware (flash_me_hv_5volt.hex)! (which is Arduino compatible),” Rupert explained in a recent blog post. “This gives access to direct programming without the need for a separate programmer from the Arduino IDE. Its also nice to support the hard work done at Adafruit by purchasing one of their Trinkets.”

As the HackADay crew notes, an awesome looking RGB LED ring powered by Adafruit’s Neopixel was ultimately added to the design, albeit at the expense of a “mute” control.

“The PCB Rupert fabbed is pretty well suited for being manufactured one-sided,” wrote HackADay’s Brian Benchoff. “If you’ve ever wanted an awesome volume knob for your computer, all the files are available from Rupert‘s blog here.”

In addition to creating the above-mentioned tinyAVR USB volume knob, Rupert is reportedly working to load Adafruit’s Trinket bootloader on Atmel’s ATtiny84, an MCU with a total of 8 analog pins.

As we’ve previously discussed on Bits & Pieces, Adafruit’s popular Trinket can best be described as a tiny microcontroller board built around Atmel’s versatile ATtiny85.

“We wanted to design a microcontroller board that was small enough to fit into any project – and low cost enough to use without hesitation,” Adafruit’s Limor Fried (aka LadyAda) explained.

“[It is] perfect for when you don’t want to give up your expensive dev-board and you aren’t willing to take apart the project you worked so hard to design.”

Fried describes the Attiny85 as a “fun processor,” because despite being so small, it boasts 8K of flash and 5 I/O pins – including analog inputs and PWM ‘analog’ outputs.

“We designed a USB bootloader so you can plug it into any computer and reprogram it over a USB port just like an Arduino,” Fried continued. “In fact we even made some simple modifications to the Arduino IDE so that it works like a mini-Arduino board. You can’t stack a big shield on it but for many small and simple projects the Trinket will be your go-to platform.”

There are currently two versions of the Trinket: 3V and 5V. According to LadyAda, both work the same but have different operating logic voltages.

“Use the 3V one to interface with sensors and devices that need 3V logic, or when you want to power it off of a LiPo battery. The 3V version should only run at 8 MHz. Use the 5V one for sensors and components that can use or require 5V logic, [as] the 5V can run at 8 MHz or at 16MHz by setting the software-set clock frequency,” she added.

Building a knock drawer lock with Adafruit and Atmel

Adafruit’s Secret Knock Activated Drawer Lock is designed to conceal traditional lock mechanisms – unlocking only when a secret pattern of knocks is detected. Essentially, a solenoid locks secures the drawer while a piezo buzzer “listens” for knocks.

Meanwhile, an Atmel-powered Trinket (ATtiny85) compares the knock pattern to the stored secret knock. If they match, the solenoid latch neatly retracts and the drawer can be opened. As Adafruit’s Steve Hoefer notes, setting your own custom knock is as simple as holding down a button and tapping the new rhythm. On the software side, the project uses straight-forward Arduino code and the standard Arduino EEPROM library.

In terms of wiring, Hoefer recommends (initially) building the circuit on a solderless breadboard to make sure everything works before soldering it into place.

“Solder the piezo buzzer to the back of the PCB so it can be installed flush against the desk/drawer/etc and hear knocks more clearly. [The] length of wire between the lock and the knock sensor depends on where you plan to mount it,” Hoefer writes in a recently published Adafruit tutorial.

“Measure your distances and be sure to allow some extra for movement of drawers and doors. You should be able to put the lock several feet from the detector without any problems. If you’re installing them close to each other then simply cut the connector off the solenoid lock.”

According to Hoefer, the circuit uses the Trinket’s pin #3, so in some cases, Makers may need to disconnect the 2.2KΩ resistor from pin #3 to program the circuit.

“Note that my sample programs just fine with pin 3 connected, but your mileage may vary. If you want to be extra sure of being able to program it after it’s soldered in place consider using female headers to mount the Trinket, or put a jumper between pin #3 and the 2.2KΩ resistor,” Hoefer added.

Interested in learning more about building a knock drawer lock with Adafruit and Atmel? You can check out Steve Hoefer’s detailed tutorial here.

 

Building some spook-tacular blink eyes with Adafruit and Atmel

Typical festive Halloween activities include trick-or-treating, attending costume parties, decorating home exteriors, carving pumpkins into jack-o’-lanterns, lighting bonfires, apple bobbing, visiting haunted attractions, playing pranks, telling scary stories and of course, watching horror films. We at Atmel would like to add one more item to the Wikipedia list above: building Halloween-themed Maker projects like Bill Blumenthal’s Spooky Blinky Eyes.

trinket_sippy-cups

According to Mike Barela, the original version of the project is built around an ATtiny45 MCU; however, Adafruit’s iteration employs the ATtiny85 based Trinket or GEMMA. Tasked with fading a pair of LED eyes that randomly blink, the Atmel powered platforms offer a more realistic effect than standard “always on” LED eyes.

“The effect is due to come clever programming of the timers available on the ATTiny processors featured on the Adafruit Trinket and GEMMA microcontrollers,” Barela explained in a recent Adafruit tutorial.

“Pins 0 and 1 are capable of pulse width modulation. The timers are set to fade the pins in and out by changing the pulse width back and forth. The blink effect is using an algorithm called a linear feedback shift register (LFSR) to pseudo-randomly turn the eyes off and on quickly.”

As Barela notes, Adafruit’s version of the Halloween Blinky Eyes project adapts the original code for use on the faster ATTiny85 processor and Arduino integrated development environment (IDE). It also adds a Cadmium Sulfide (CdS) photocell to allow the eyes to activate only below a certain light level, helping to save battery power.

Other key project components include:

  • 3V Trinket (may be substituted by a GEMMA)
  • Cadmium Sulfide Photocell
  • Two LEDs 2 56 or 68 ohm resistors (100 ohm will work also but eyes will be a tad dimmer)
  • 1-1000 (1k) ohm resistor
  • Tiny Breadboard (or other suitable wiring surface)
  • 6V coin cell battery pack
  • Two CR2032 Batteries
  • A prop to put your circuit in

“The circuit is fairly straightforward and can be assembled well within an hour. Headers (included with Trinket) may be soldered to facilitate attachment to a breadboard or proto board. Other parts may be pressed into the breadboard. Ready-made hookup wire or cut to fit wires make the connections,” Barela continued.

trinket_IMG_2334

“The same circuit with GEMMA. The LEDs go to D0 and D1 with a 56 or 68 ohm resistor (100 ohms is fine also but they will be a bit dimmer). D1/A1 is hooked to the junction of the photocell and a 100 ohm (1K) resistor. If you wish to just rely on the power pack on/off switch, you can eliminate the photocell and 1K resistor. The battery pack works well with wearables, as it has a JST connector to plug directly into GEMMA, [along with] an on/off switch to save power when the circuit is not being used.”

Interested in learning more about the Halloween Blinky Eyes project above? Be sure to read Adafruit’s detailed tutorial here.