Tag Archives: AVR Dragon

A Pro Trinket-based movement alarm for your bag


A portable, battery-powered device that sounds an alarm when your bag is moved. 


Your pocketbook. Your backpack. Your gym bag. Each of which hold a number of expensive, personal belongings. And, as you know from walking around the mall, through campus, into the gym, or throughout an event like Maker Faire, lugging around a hefty bag can be a burden. Wouldn’t it be much easier to set it down, give your shoulders a rest and have a peace of mind that no one will take it? Well, a Maker by the name of “MakerSelf” has devised a solution that will allow us to do so: a motion sensing bag alarm.

5855231420325262516

Based on a Pro Trinket (ATmega328), the Movement Alarm is a portable, battery-powered device that sounds an alarm when your bag is moved. Once armed, it can only be turned off by your secret code.

For those who may not know, the Pro Trinket is a sort of break out board for the fan-favorite ATmega328 MCU. A “big” sister to the original, uber-mini Trinket (ATtiny85), the board offers the familiarity of an Arduino Pro Mini with more pins and a USB thrown in the mix. With the Pro, Makers have the choice of either programming with the Arduino IDE, using AVRdude with the “-c usbtiny” programmer flag, or flashing the chip directly with an AVR programmer like the AVR Dragon.

2664961419668025738

In this case, MakerSelf hooked the Trinket to a GY-521 accelerometer to enable the detection of movement. Therefore, when the Trinket senses that the device has been set into motion, such as picked up or removed from its resting place, it emits a high-pitched alarm from its built-in piezo speaker.

“It is 9V battery operated, but without an on/off switch, otherwise the potential thief could just hit the off button. As a result, I have an ‘arm’ button, and then you have 20 second to but the bag + device stationary,” MakerSelf adds.

4608791420325347274

Once armed, if the bag/device is moved for more than 5 seconds and above a certain threshold level, it sounds an annoyingly loud alarm until the correct code is entered. The secret code uses a four-button interface, but the code itself can be any length and easily modified in the Trinket software. After the passcode is entered, the status LED will turn solid indicating to the user that the device must be placed stationary. The status LED will turn off after the designated time period, advising that the alarm is now armed and listening to the accelerometer.

If the bag is moved for more than five seconds at a time, the alarm will sound. Just in case that someone needs a piece of gum, phone or some other item from their bag, entering the secret code after or during the settling time, the status LED will blink once long, followed by three short, and then the device will turn itself off without turning the alarm on.

Intrigued? Head over to the alarm device’s official Hackaday.io project page here.

The January 2014 eFlea breakfast

My friends and I still get together for breakfast even when the Silicon Valley electronic flea market is shut down for the winter. The first one of the new year was Jan 11, 2014. We go to Bobbies in Cupertino, and feel free to stop by the second Saturday of the month. We eat outside so dress warm. When the eFlea is running in the summer, we get to Bobbies about 9:30 AM. In the winter, with no Electronic Flea Market we show up at 7:00 and hang out until noon.

The big news this eFlea was that Phil Sittner and Dave Mathis are designing an antenna analyzer using Atmel chips. Phil, who I wrote about before is doing the hardware and Dave is doing the software. They plan on going to Ham shows to sell the product once they perfect it.

Dave-Mathis_Phil-Sittner_2014_eFlea_breakfast

Dave Mathis (L) and Phil Sittner are working on an antenna analyzer.

Phil_Sittner_prototype_PCB

Phil has already hacked up some prototypes to help develop the analog part of the product.

Phil-Sittner_XMEGA-A3BU_AVR-Dragon

Here is Phil after I prompted him to show off all the cool Atmel hardware he is using.

That’s an XMEGA-A3BU Xplained eval board on the left and an AVR Dragon debugger on the right. I am mad because he paid for the stuff rather than hitting me up for some samples.

Next show-and-tell was from a pal that wants to go un-named despite the statute of limitations being invoked. He found a box in a culvert 20 years ago and assumes it was someone disposing of stolen goods. I assume it was more like the PCBs I found years ago that probably just fell off a truck.

eFlea_68030

These ceramic Motorola 68030 microprocessors sure are pretty. They make a neat noise when you clank them together.

Eric-Schlaepfer_Dave-Ruigh_eFlea-PCB

Google’s Eric Schlaepfer and mechanical engineer Dave Ruigh admire one of the gold-plated beauties.

eFlea_mixer

These mixers work from 1200MHz to 1600MHz. There are two layers of them in the box.

Eric-Schlaepfer_eFlea-breakfast-PCB

Eric Schlaepfer looks at one of the boards from the mystery culvert box of goodies. The PCB is not Mulitbus or VME, it was some custom job.

John Haggis and his son Xander showed up later in the morning but did not disappoint with an Omron wearable blood pressure health monitor. John is the pal that went all the way through med school and decided he preferred engineering.

Xander_John-Haggis_eFlea-breakfast

Xander and John Haggis made the January 2014 eFlea breakfast and brought a whole batch of goodies.

Omron-IntelliSense_eFlea-breakfast

This Omron wearable blood pressure monitor is just the thing to monitor your health.

John-Haggis_waterproof_speaker

John Haggis also brought this waterproof Bluetooth speaker to show us.

John-Haggis_fone_charger_Galaxy

John Haggis also has hacked a fone wireless charger into his Samsung Galaxy S4

ANKER-battery_fone-charger_Galaxy-S4-phone

John also had a neat ANKER battery setup to run the hacked wireless charger.

Here is a link to that ANKER battery setup.

After seeing all the smudges on that ANKER battery, I was quite the hero when I whipped out these Atmel screen cleaners. You peel off the little pad, which is a cleaner on the visible side, and then you can stick it down to the back of your phone. I convinced John to take 4 of them to form little “feet” for his gizmo.

Atmel_screen-cleaner-pad

Atmel has this swag giveaway pad. It’s the little one-inch square at the bottom right. You peel if off this card, use the top side to clean the smudges off your screen, and then the bottom side will stick to the underside of your phone or gizmo until you need it the next time.

Atmel_screen-cleaner-pad-jobs

Here is another screen cleaner pad Atmel gives away at events.

Atmel’s Director of Events Donna Castillo assures me if you come to her Tech on Tour events she will have some of these for you take home.

Lastly, my pal Martin DeLateur, the International Man of Mystery brought an older Sirius radio and dock. He snagged it at an estate sale. Problem is it got hooked up to 12V battery, and has some issues. We scratched our heads and offered some advice. We will see if he got it charged and powered up at the next eFlea breakfast, Feb 8, 2014, which is the day before the 2014 Analog Aficionados party here in Silicon Valley.

Martin-DeLateur_Sirius-radio

This old Sirius radio has some power problems we will try to fix by the next eFlea Breakfast.

Video: Debug 101 with Atmel’s Paul Rako

In the first installment of this series, analog aficionado Paul Rako offers viewers an overview of Atmel debuggers such as the $49 AVR Dragon, JTAGICE3 and AVR ONE.

“For $49, you can get a debugger that’ll let you watch the chip execute, let you single-step through your program, let you see the effect of interrupts, and can really speed up how fast you’re bringing your program or your product, and the program in it, into market,” said Rako.

“Next up is [the $100] JTAGICE3. In addition to doing all the AVR chips and the AVR 32-bit chips, this product will also do the SAM D20 ARM Cortex M0+ chip. [There is also] the JTAGICE2. We used to sell this for $400. I’m kinda proud that we reduced the price by one fourth for the subsequent product.”

Meanwhile, Atmel’s AVR One! offers trace capability.

“With trace, you let your program execute. The trace just records. It’s like a log file and it tells you what’s going on. So, it’s $600. It’s hard to do trace real-time at the kind of speeds our microcontrollers (MCUs) run.”

As you can see in the video above, Paul also gets up close and personal with Atmel’s ARM-based SAM D20 Xplained Pro.

“What’s cool about the SAM D20, it’s an eval board with the chip, but it’s also got the debugger chip. You can come off of this board – when you get along with your design, you design your own PCB you can jump off of this board,” Rako explained.“And instead of debugging the SAM D20 that’s on this board, it’ll debug the SAM D20 that’s on your printed circuit board for your system.”

Last up is Atmel’s Cortex 4 Xplained.

“This isn’t an Xplained Pro- but because it’s the 4S, it just happens to have a debugger on it as well. You can use our STK600 and one of these debuggers to program and debug the things. You can use an Xplained Pro card,” Rako added. You can use some of the Xplained boards that have a debugger on them. It’s going to be so much faster than trying to write – printf – do a little flag, and write some thing off the serial port, to try to figure out where your program’s going, why it’s not doing what you expect.”

AVR XMEGA-A3BU Xplained demo board unboxing

So we cleaned out a storage area and lo and behold, there was an XMEGA Xplained demo board. So I scrounged up a USB cable and plugged it into my computer. I don’t have Studio 6 installed yet, but I thought it would be fun to just un-box it. This is what happened:

KONICA MINOLTA DIGITAL CAMERA

You can get your very own XMEGA Xplained eval board for on $29. The LCD alone is worth that.

KONICA MINOLTA DIGITAL CAMERA

What a score, the seals are still on the box. I think this was used in FAE training in May.

KONICA MINOLTA DIGITAL CAMERA

This is what is inside. There is that great LCD, a CR1225 battery for the real-time-clock (RTC), 3 tact switches and a touch switch, a temp sensor, a light sensor, all the signals on headers, and a JTAG port so you can hang a Dragon on it and see inside the chip while it executes. Sweet.

KONICA MINOLTA DIGITAL CAMERA

Here is a close-up. Oh, there is a non-volatile serial memory chip too. Needless to say, I have not read any manuals or paperwork yet, heck I am a man, like my buddy Tim who didn’t read the manual on his $60,000 Cadillac before he drove it to San Diego.

KONICA MINOLTA DIGITAL CAMERA

On the backside, you can see the 2010 date, but it turned out the board was way newer, stay tuned. You can see the flux residue where they hand-soldered the LCD. You can’t send an LCD through an IR reflow oven.

KONICA MINOLTA DIGITAL CAMERA

I stick a USB cable on it, and wow, it has a backlight on the LCD. It was obvious that the welcome screen here is telling you how to navigate the pre-installed program. That is not a touch-screen, it is telling you the tact switches and the one touch pad on bottom left are your navigation buttons.

KONICA MINOLTA DIGITAL CAMERA

Here is the screen with a flash picture—you can read the LCD either way. You can bet I am thinking how to mount this on my Harley and make a voltmeter/ammeter, temp sensor system out of it.

KONICA MINOLTA DIGITAL CAMERA

This is what you see if you press “Enter” (the top left button). It’s a sub-menu that displays the temperature, the light intensity, or the production date.

KONICA MINOLTA DIGITAL CAMERA

Here is the production date screen.

KONICA MINOLTA DIGITAL CAMERA

It took me a while to figure out that there was a touch-pad on the bottom left instead of a tact switch. This is how you go back up the menu tree.

KONICA MINOLTA DIGITAL CAMERA

Here is the temperature display. It seems pretty accurate, despite the board saying “NTC SENSOR”. I assume there is a linearization program, negative temperature coefficient sensors are notoriously non linear. This is reading hot since I put my finger on the sensor to see it work.

KONICA MINOLTA DIGITAL CAMERA

The top menu had more items and would scroll. This is the page for setting date and time. It was set to Norway time, but the date was right after 6 months.

KONICA MINOLTA DIGITAL CAMERA

This is a menu choice that shows how long the board has had its real-time clock powered.

KONICA MINOLTA DIGITAL CAMERA

When you stick in the USB the computer prompts you to add a driver. I don’t think that is a good idea. The way this is meant to be used is that you install Studio 6 or use some other IDE or the Atmel Software Framework (ASF) and that has the driver the card needs. So I cancelled. We have all been burned installing things on Windows.

Well this got me pretty fired up. It never occurred to me one of our demo boards would have such a nice program on it pre-loaded. I guess it’s time to install Studio 6. I have been avoiding it, since I am an assembly language dinosaur, and I am sure all this code is in C. After all that is one of the coolest things about AVRs, they were designed to run C and run it well.

In addition to installing our free Studio 6, I will hang a Dragon debugger/emulator onto the card. Thata is another cheap purchase from Atmel, about 50 bucks. There were a couple of those in the storage room too. With a Dragon I can see inside the chip as it runs, single step programs, and read the registers and memory locations.

ECO 1 (engineering change order). Let’s make that navigation screen show more representative symbols for the tact switches, and the touch pad. And let’s move the symbols to the outside corner of the screen, like they are on the PCB (printed circuit board).

ECO 2. Lets add a menu pick to read analog voltages—hang on—holy cow, this thing not only has two 12-bit ADCs, it has 4 comparators. I can see there is a lot to love. And get this—6, count ‘em, 6 USARTs. That will satisfy my buddy Dave who insists on one dedicated UART just for software debug. Sure you can use the debugger when it is hooked to Studio 6 or your IDE, but it is also nice to have a port you can query or that spits out status when the system is deployed in production.

Stay tuned, I will be hooking up one of those Dragons and installing Studio 6 next. Just remember the first rule, never keep a handgun in the same desk you have a computer on. I do expect to be frustrated, it’s been 12 years since I programmed in assembly, and never have used C, but let’s take this little adventure together and see what happens.

Designing industrial sensors with Atmel AVR: Part 2

Yesterday, Bits & Pieces took a closer look at how Atmel’s versatile AVR portfolio can be used to power industrial sensors which are typically tasked with detecting, positioning or identifying an object or rotating axis in a factory-automated system.

And today we will discuss an Atmel-powered sensor reference design, or more specifically, the HMT7442 IO-link transceiver and optimized IO-Link device MESCO software stack – courtesy of Atmel, HMT and MESCO Engineering.

“IO-Link is the emerging industrial communication standard to connect the control unit to sensors and actuators. The standard is backwards compatible with the commonly used binary switch signaling and introduces a bi-directional digital communication. These capabilities bring several benefits to the end user, including easier cabling, remote diagnostics and configuration,” an Atmel engineering rep told Bits & Pieces.

atmelindustrialsensor

“For many sensor designers, the physical size constraint is the key factor for integrating the IO-Link capability. And that is why Atmel, HMT and MESCO Engineering have placed a strong focus on saving board space in our offering of the TM96.0 GENIE Explorer Variant A reference design.”

More specifically, the TM96.0-A reference design demonstrates the high integration of the Atmel, HMT and MESCO solution. It acts as an IO-Link device and is equipped with a push button, two LEDs and a potentiometer to allow developers to add stimuli to the system.

“The reference design runs the MESCO IO-Link stack on an Atmel tinyAVR88 microcontroller and communicates on the IO-Link cable using HMT’s HMT7742 PHY IC,” the engineering rep continued.

“The implementation used in the reference design does not require external protection to sustain reverse polarity or to comply to the EMC surge protection defined in the IEC 60255-5 standard. This makes the TM96.0 an ideal tool to evaluate the Atmel-HMT-Mesco solution.”

Meanwhile, the TM96.0-B Evaluation Kit enables hardware and software designers to develop, test and debug the IO-link sensor application. Basically, the TM96.0B features the IO-link transceiver HMT7742 and the Atmel ATmega328P. It is equipped with all necessary connectors for in-system programming, while supporting debug sessions using Atmel’s free AVR StudioIDE, Atmel AVR Dragon or Atmel JTAGICE-mkII. Plus, an evaluation kit is provided with pre-compiled MESCO library software, which can be linked to the main application using the WinAVR GCC compiler.

Interested in learning more about how Atmel AVR MCUs can power your industrial sensors? Be sure to check out our detailed device breakdown here.

Kenneth Finnegan on the AVR Dragon eval board

I met a great engineer at the eFlea electronic flea market here in Silicon Valley. Kenneth already had an ME degree. Now he wants to get an MSEE with an emphasis in networking embedded systems. He is at Cal Poly. So he asked me if I could get him an AVR Dragon, a debugger board Atmel sells. A debugger is a gizmo that lets you see “inside” a chip. You can read its internal registers and see memory values. It makes it way easy to troubleshoot what is going wrong with your program. The Dragon works with most AVR microcontrollers. I got him a deal through our University program and asked if he would write a review when he got the board. He did a great job, and posted it on his website, with the understanding I would just cut-and-paste it to Bits and Pieces.

Kenneth_Finnegan_AVR_Dragon

One of my good friends at Atmel, Paul Rako, recently sent me a sample of the AVR Dragon (Atmel store page), which is a in-circuit serial programmer (ISP) and On-Chip Debugger (OCD). The ISP functionality is familiar to most hobbyists in the AVR embedded programming scene; through the standard 2×3 pin header, you can erase the flash memory on an AVR and download new program code onto the chip. A typical example of an ISP programmer, and what I’ve been using exclusively up until now, is the wonderful, if sometimes a bit flaky, AdaFruit USBtinyISP.

As you look back through my blog, you can probably tell that only having ISP capabilities will get you pretty far, but where the Dragon really shines is in its ability to perform on-chip debugging. Most of the third-party programmers only implement the basic SPI-based erase-and-burn cycle you use when programming an AVR, but OCD allows you to set break-points in your program on the actual chip, and then step through your program code, read variable values, etc. All those glorious interactive debugging features that computer programmers have been spoiled with for decades. This makes embedded development MUCH easier, and an ability I’ve been suffering without while my projects have grown progressively more sophisticated.

AVR_Dragon_box

 When I first opened the shipment from Atmel, I was very happy to see a piece of dev kit finally come in a reasonably sized, and attractive, box. I’ll actually be able to store this thing in its box instead of having to shuck it and store the PCB floating around in gallon ziplocks like most of my other dev kits.

AVR_Dragon_box_inside

 Look at that minimally wasted space! ESD foam on top and bottom, so over all, I’m happy with the packaging, which is surprisingly important when you literally have an entire closet dedicated to development kits collected over the years.

AVR_Dragon_PCB_backside

 Nice touch on the backside silk screen logo. I’d like to have seen the pin-out references on the top, particularly since they’re oriented for “top view,” but it’s still a handier reference than the printout I have floating around in one of my electronics binders.

AVR_Dragon_PCB_frontside

Looking at the headers from the top of the board:

  • The first row has 3x Vcc and 3x GND, which seems a little strange for a programmer, but might be handy for some projects?
  • The second row has your 10 pin JTAG and 6 pin ISP headers, which are your two work-horse programming interfaces for AVRs big and small, and finally an unpopulated high voltage programming interface. The HV_PROG interface allows you to burn AVRs like old-school EEPROMs, and allows you to get around having to use the SPI ISP bus for programming. This is most useful when you want to use the reset pin as an IO pin (did you ever wonder why Atmel bothers assigning an IO port number to the reset pin?).
  • And below the three programming interfaces… six rows of unpopulated, unlabeled, headers? Uhhh…

So the bottom third of the board’s real estate dedicated to empty headers threw me for a loop until I noticed the sentence in the description, “A development area lets designers build their own circuitry or add sockets for the desired device footprint.”

Fair enough; I can load the bottom of my Dragon with a socket and make it an AVR target board. I’ll just pull up the manual and figure out what the on-PCB pinout looks like…

AVR_Dragon_screenshot

Uhhh…

So apparently, Atmel didn’t feel the need to put the Dragon’s users manual on its product page? After finally resorting to searching through Google, I managed to find the users manual in Atmel’s online help system, which quickly lead me to what I was looking for. I’m not entirely impressed with the rats-nest of jumper wires they have in the tutorial, and the three pairs of Vcc/GND make a lot more sense now, but I’m not convinced I’ll not just stick to my standard practice of building separate target boards for each AVR model I use and keeping them in a ziplock in my drawer. I’d have expected a target area like that to use a bilateral switch array to allow for automatic retargetting to a specific AVR model, but that’s asking a bit much of a $50 dev tool.

So overall, I’m happy with the packaging and feature set, but am a little disappointed that they made the board 50% larger for what seems like a half-thought-out target area. I look forward to being able to use a less kludgy programmer than the USBtinyISP, and finally being able to set break points in my code. As Paul says, “friends don’t let friends go without on-chip debugging.”

Hey, I told Kenneth to give an honest review, and I am not going to edit out his criticism. And as you folks realize, it’s not like “Atmel didn’t feel the need” to put the docs in the product page. My buddy Gil over in the next cube just told me we have over 2000 English-language product pages. And those come in four languages. So I showed our web team the blog, and they point out it is not that simple. See the doc Kenneth found was a help page for the Atmel Software Framework (ASF). So it should not go in the documentation tab, since it is not technically product documentation. But Michael in the web team feels Kenneth’s pain. So he is adding that link Kenneth found to the product page description, which will keep the CMS (content management systems) happy. Like I joke “the other guy’s job is always easy.” That is the nice thing about coming to work here, where you can see how hard everybody is working to make the website do what you folks want it to. Kudos to the whole team—they really “get it”.

Now, the really cool thing is that we cleaned out a storage room and I found a Dragon I can play with too. As I mess with it, I will keep you posted on my trials and tribulations. Bear in mind my Atmel programming has all been in assembly language, so this might be exciting if I have to learn C.

Although I joke about “Friends don’t let friends go without a debugger,” it’s also true that “simple is good”. Kenneth was the guy I asked what was so cool about Arduino. He said: “Two big buttons. Compile, and Program, and that is all.” So if you can debug with printf statements out the serial port, go right ahead. When you want a real debugger we have the Dragon, and our Xplained boards not only have a debugger built in, but some of them have a header, so that after you get your board laid out and built, you can connect the header on the Xplained board to your target hardware, and it will be a debugger for the AVR in your production board too. Nice.