Tag Archives: Adafruit

Interfacing with Adafruit’s Atmel-powered Trinket



Bits & Pieces recently covered a project by a Maker named Pocketmoon who wanted to demonstrate just how many components can be hung off Adafruit’s 3.3v ATtiny85-powered Trinket.

Today, we’re going to be taking a closer look at constructing a Trinket RGB shield clock, courtesy of the Adafruit crew. 

According to Adafruit’s Mike Barela, the project was inspired by a forum member who asked if the Trinket can be interfaced with an RGB LCD shield, which was originally designed to link with more “classic” Arduino boards using a standard shield pin layout.

“Obviously the shield cannot stack onto Trinket but with four wires, the display shield can hook up to a Trinket project well. This is accomplished as both use the I2C or two-wire bus to communicate,” Barela explained in detailed tutorial.

 “As a further demonstration, the Adafruit I2C based DS1307 real-time clock module is used to display the time and date. The display shield’s buttons allow for changing the hour in case of daylight savings time and toggle the backlight.”

Before kicking off the project, Makers will need to download three code libraries (TinyWireM, TinyRTClib, TinyAdafruit_RGBLCDShield) all optimized for Atmel’s ATtiny85 microcontroller (MCU) powering the Trinket. Next up? Modifying the Arduino IDE to work with Trinket by adding the hardware definition file, the avrdude.conf file, changing the ld.exe program (or download the preset Arduino 1.05 from Adafruit).

“Since we’re using I2C for the shield and real time clock, hookup is fairly straightforward,” said Barela.

“Don’t forget, I2C allows you to use multiple devices on two shared pins, perfect for when you don’t have a lot of pins like the Trinket.”

On the code side of things, Barela uses two programs are used to save space. The first, typically runs once (initialization) and sets the battery-backed DS1307 RTC, while the main code displays the clock value and polls the buttons. Meaning, if the up or down buttons are pressed, the value offset is incremented/decremented. This is added to the RTC clock time to form the hour.

“The combination of Trinket and the RGB LCD Shield is a good combination for display and input. There is enough code space to hook a number of sensors for real-time readout,” Barela concluded. “If you believe the shield form factor is not ideal, use of the LCD with the I2C backpack is a good combination. See the tutorial for the Trinket Ultrasonic Rangefinder as an example. If you want a more precise clock, you can swap the DS1307 for a Chronodot, it is code-compatible and ultra-precise!”

Interested in learning more? You can check out Adafruit’s detailed tutorial here.

Arduino Micro powers this LED matrix clock

A Maker by the name of Martin Atkins recently built an LED matrix clock using an Atmel-based Arduino Micro (ATmega32u4), a few bicolor LED matrix displays and Chronodot. All the major components for the project were purchased from Adafruit.

According to Atkins, the primary motivation for building the LED matrix clock was to learn Eagle and give OSH Park a shot.

“I wanted to make something with only components I’d already purchased, and that’s why it has a whole Arduino Micro attached to it even though a smaller board (or even just a lone microcontroller) would’ve been sufficient,” Atkins explained in a Google+ post.

“I didn’t get the displays lined up quite right, so there’s a small gap between them that looks obvious in this photo but isn’t so bad if you’re further away and looking at it head-on. But my learning for next time is to watch out for the positioning of odd-sized components.”

Atkins also noted that he just wired the red and green LEDs together, eschewing a bi-color approach for the current project and eliminating the need for doubling up on driver chips.

The total cost of the custom PCB? Around $45.

“The combination of the large-ish LED matrices plus the Arduino Micro and Chronodot forced the board to be on the larger side… It’s 3.94 by 2.25 inches,” he added.

Interested in learning more? You can check out Martin’s Google+ post here.

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.

A cosplay cyberpunk build

Cyberpunk films and novels are often set in post-industrial dystopias characterized by extraordinary cultural ferment and the use of technology in ways never anticipated by its original creators.

As William Gibson noted in Burning Chrome, “the street finds its own uses for things.” 

Although Gibson wrote those words way back in 1981, they more than aptly describe the cyberpunk build designed by the very talented mel ell, a cos-player and graduate student at Georgia Tech in Atlanta.

According to the Adafruit crew, mel ell admires the cyberpunk and fantasy genre styles of various artists in comics and games. Indeed, she used the genre art as a basis for the design of her slick outfit.

“The process was a lot of fun and took approximately three months of on-and-off planning and building. The assembly is made from over 60 parts designed in Solidworks and sewn/cut/glued/laser-cut/heat-formed using various techniques,” mel ell explained.

“The costume includes color changing LEDs on the spine and front that are controlled by an [Atmel-based] Arduino board and onboard RGB controllers. It is powered by 16 AA batteries, 1 LiPo rechargeable battery, two 2032 coin cells and one 9-volt battery. In total there’s more than 70 LEDs on the entire costume and over 60 parts.”

Impressive!

Simulinking with an Arduino Uno



Adafruit’s Anuja Apte has penned an informative tutorial describing how to program an Atmel-based Arduino Uno board (ATmega328) using Simulink. 

For the uninitiated, Simulink can best be described as a block diagram environment for multi-domain simulation and model-based design. It supports automatic code generation, along with continuous test and verification of embedded systems.

In terms of Arduino, Simulink is used to develop and verify algorithms for control system and robotics applications. The algorithms are then implemented on the Arduino board as standalone applications.

To kick off Adafruit’s tutorial, Makers will need to purchase MATLAB (R2013a or later version). Aside from the Arduino Uno, required hardware components include a small breadboard, 220 Ohm resistor, LED, connecting wires and USB connector. 

Using the USB connector, connect the Uno to a computer loaded with MATLAB and Simulink. Install a compiler, configure in MATLAB and set up the Simulink support package for Arduino.

Ready?

Follow the image above to build a simple circuit that connects an LED to pin 9 of Arduino Uno.

Done?

“Enter arduinouno_gettingstarted at the MATLAB command prompt to open a model that uses a Pulse Generator block to create a signal that varies between zero and one every second. Double-click the Pulse Generator block to explore its pre-configured parameters,” Apte explained.

“The Digital Output block is set up to send the output of the Pulse Generator to pin 9 of the Arduino Uno. Double-click the block to explore its pre-configured parameters. You are now ready to program your Arduino Uno!”

After preparing the model to run on the Uno, make sure the board is connected to a PC via USB cable. Select tools > run on target hardware > and run.

Done?

The LED attached to pin 9 should blink one time every second.

Interested in learning more about Simulinking with an Atmel-based Arduino Uno? You can check out Adafruit’s in-depth tutorial here, which offers 
a detailed step-by-step guide to setting up compiler support, configuring Simulink support packages (for Arduino) and creating your own models.

Open source camera has Atmel under the hood

Kevin Kadooka has designed an open source camera with Adafruit’s Atmel-based Trinket platform (ATtiny85) under the hood.

Dubbed “Lux,” the 6×6 box camera (120 roll film) was originally prototyped using an Arduino Uno (ATmega328). 

Key project components include include Adafruit’s quarter-size protoboard, transistors (TIP120), diode (1N4001), 5V solenoid, rotary switch (10 position BCD DIP), rocker switch (SPST), resistors, 7.4 battery, connectors (JST PH, JST BEC), and a momentary button (SPST w/LED).

Additional specs? PCX lens, positive meniscus lens, mirror, and an electromechanical single-leaf shutter.

“Until now, all of my camera- building efforts utilized parts repurposed from old, obsolete cameras, and for good reason,” Kadooka explained on the project’s official page. 

”Each constituent part of the modern camera, from the shutter, lens, aperture diaphragm, and film transport, are much too complex and delicate for the average hobbyist to reproduce. Borrowing parts from old cameras is usually the go-to solution for most DIY’ers (myself included), however I don’t think this is a sustainable technique.”

As such, Kadooka’s primary goal is to design and produce a fully-fledged using easily purchased off-the-shelf components – without having to rely on anything pulled from a potentially valuable piece of equipment.

“A secondary goal is also to make this camera completely open source through rapid-prototyping techniques such as laser cutting and 3D printing, and the Arduino physical computing platform,” he added.

Interested in learning more about the open source camera? You can check out Kadooka’s detailed instructions and spec sheets here.

Arduino data visualization with Plot.ly

Like many Makers, Instructables member Plotlygraphs has used versatile Atmel-based Arduino boards over the years to build everything from MIDI controllers to simple LED flashers.

Recently, Plotlygraphs wrote up a succinct Instructables post that explains how to use plot.ly, a collaborative data analysis and graphing tool, to visualize data from Arduino pins. 



More specifically, Plotlygraphs pairs an Atmel-powered Arduino Uno (ATmega328) with a DHT22 Temperature + Humidity Sensor to create detailed environmental graphs.

Aside from the Uno and DHT, key project specs include an Ethernet shield, hookup wires, angled pin headers, 9v wall adapter, two pieces of (2 1/2″ x 3 1/2″ ) wood (1/4″ thick), four (10-32x2in) machine screws, 12 hex nuts (10-32 diameter).

In terms of software, Makers can download the latest Arduino software (1.0.5), Plot.ly Arduino library and Adafruit’s DHT Arduino Library.

The first step? Connect the Arduino Uno to an Ethernet shield, then the DHT sensor. Next, upload the sketch to the Arduino board and build a basic enclosure.

“This design is so simple and wonderful, we’ll leave it up to you! Its just drilling 8 holes, and assembling,” writes Plotlygraphs. “Remember to be accurate with your holes, as they have to match up. Measure twice, drill once!”

Interested in learning more about Arduino data visualization with plot.ly? You can check out the Instructable here and plot.ly’s website here.

Programming Arduino with Android and Windows tablets

Adafruit’s Mike Barela has put together a detailed tutorial on programming the Atmel-powered Arduino Uno board (ATmega328) with Android and Windows tablets. As Barela notes, creating on the go for both hobbyists and engineers gets easier every year.

“Tablets with modern versions of the Android operating system can be found below $200. In addition, there is a new crop of modern tablets powered by the Intel Bay Trail CPU [that] run full versions of Windows 8.1,” writes Barela. 

“With a full Windows system, you have the gamut of developer tools at your fingertips. The Arduino IDE runs well and you can access code from the web, from the cloud, or locally. With Android, you cannot directly install code from the Arduino project as Android is not a supported operating system. [Nevertheless], there are programmers porting the Linux versions to Android.”

The most common method of communication between a micro controller and tablet (or PC) is via a USB port and OTG (on the go) cable. The cable – which is available in Adafruit’s shop – allows the tablet to communicate with external device. Click here to learn about linking with Bluetooth.

“For an Arduino Uno, you can then use the regular (or 6 inch) A to B cable. Other boards may require mini or micro USB cables,” Barela continues. “The OTG cable provides a standard size A socket, making mating cables straightforward.”

Windows



Drivers for nearly any Arduino are available for Windows, although some work may be necessary to install unsigned drivers for the Uno. A number of tablets may provide provision to enter recovery and allow unsigned drivers, a procedure documented here. 

Arduino software can be downloaded from the official Arduino site, while version 1.05 is available from Adafruit with integrated support for the Atmel-powered Flora, Gemma and Trinket.

“Once the IDE is installed, click the desktop icon to get to the Windows desktop. Double-click the Arduino icon and you will be in the development environment. Load the included Blink sketch by clicking File then Examples then 01. Basics then Blink. A new window opens with the Blink software sketch,” Barela explains.

“Ensure your OTG to Uno cable from the previous section is connected from the tablet to the Uno. The Uno should have the power LED on, powered from the tablet. Use an external power supply for the Uno to save tablet battery life. Set the environment for download by clicking Tools, then Board, then select ‘Arduino Uno’ from the list. Go back to the Tools Menu, then Serial Port, then you usually select the last port.”

To upload the above-mentioned Blink sketch to the Uno, select the right arrow icon. The yellow LED neat the Uno’s Pin 13 should begin blinking. In terms of Adafruit’s Trinket and Gemma, Barela confirms a Windows tablet will recognize the Atmel-powered platforms, although the USBtinyISP driver must be installed.

Android

The Arduino team does not officially publish native Android versions of the Arduino IDE, although Anton Smirnov has coded ArduinoDroid which is available from the Google Play app store (free ad-supported, ad-free is $2.99).

“You will need a microUSB male OTG to A female cable available from Adafruit and mobile shops at a reasonable price. This will provide you a full A male connection to plug in a cable to fit your microcontroller. For our Uno example, a standard USB A to B cable (Adafruit sells long and easy to pack short versions),” says Barela.

“You may want to power the Uno from a separate power supply – if you use USB power, it will shorten your tablet battery life depending on the current draw and could exceed the power that can be drawn if you connect shields or other devices.”

In terms of loading a program, users can download their own code via USB (like a flash drive), from Google Drive to a local folder or by cutting and pasting from a browser. Simply select Sketch, then Open and select a recent sketch from the device or from Dropbox.

“The text is color-coded and is edited like any text file.You can upload your sketch to the Uno by getting the menu using the … icon, then Actions then you can Verify/Compile. Once it compiles cleanly use the same menu to select upload,” Barela concludes.

Interested in learning more about programming Atmel-based Arduino boards with Android and Windows tablets? You can check out Adafruit’s official tutorial here.

Building a Trinket-based (ATtiny 85) rover

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 player, flickering candle in a jar, a knock drawer lock and a sound-reactive LED color organ.

 Today, we’re going to take a closer look at a Trinket-powered rover designed by Rick Winscot for the Adafruit crew.

“Science, Technology, Engineering, (Art) and Math (STEM / STEAM) curriculum is gaining momentum in K-12 education,” Winscot explained in a recent Adafruit tutorial. “It’s exciting to see so many new makers and engineers learning how fun it is to make! I wanted to design a low cost robot that anyone could build if they have access to a 3D printer.”

Aside from the Atmel-powered Trinket, key project components include 7 plastic parts, a tiny breadboard, one 34xAA battery holder, 2X continuous rotation micro servos, 3X female/male jumpers, 3X M3 10mm screws, 1X M3 hex nut and double-sided foam tape. 

For distance measurement, Makers can use a Parallax Ping))) Sensor, Grove Ultrasonic Ranger, or Maxbotix Ultrasonic Rangefinder.

In addition, Winscot uses chain bracelets for the build, instead of 3D printing tracks/treads.

“I had some success 3D printing ones with flexible filament but the total cost was too high. That’s when I stumbled into these… ‘chain bracelets’ from Oriental Trading. You can buy a dozen for less than ten dollars; which will make six rovers,” he said.

On the source code side, Winscot created a Parallax Ping))) Distance Sensor sketch which he describes as an ultra-bare bones starting point.

Interested in learning more about the Trinket-powered rover? The relevant .stl files are available here, while Winscot’s detailed tutorial can be read 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.