Category Archives: Design Tips & Tricks

Power line comms with an ATmega168 MCU

The average residence or business likely has a number of devices that piggyback on mains line for communication. 

Recently, Haris Andrianakis decided to design his very own power line communication system for a thesis project at the Technological Education Institute of Piraeus in Greece.

As HackADay’s Eric Evenchick explains, the basic principle of the system is to inject a signal onto the power lines at a significantly higher frequency than the 50 or 60 Hz of the AC power itself.

“Using both active and passive filters, the signal can be separated from the AC power and decoded. This system uses frequency-shift keying to encode data,” he says. 

”This part is done by a ST7540 modem that’s designed for power line applications. The modem is controlled over SPI by an ATmega168 microcontroller.”

Comms between the ST7540 modem could have also been established using UART (asynchronous), although as we noted above, Andrianakis chose SPI to establish a synchronous connection.

“After a lot of hours of SPI debugging using logic analyzer and testing different combinations I found an unusual but working method. In order to enable the Slave’s (ATmega168) SS pin to indicate SPI’s start/stop I used another pin of the same MCU and not one of the ST7540 (while it wasn’t included),” Andrianakis wrote on the project’s official page.

“So by checking the CD_PD line (carrier frequency detect line) of the ST7540 the MCU knows when there are available data for reception in ST7540. If the MCU detect available data enables the SS pin and the SPI communication starts by receiving the available data. When the data reception ends thus the CD_PD pin has changed state to indicate that there are no more available data the MCU restores the SS pin to its initial state disabling the SPI and clearing the SPI bit counter used to synchronize the communication.”

Essentially, says Andrianakis, this method is like deceiving the SPI while the same (Slave) device enables its SS pin.

Interested in learning more? You can download the source code/ schematics here and check out the project’s official page here.


ARM @ Atmel’s EELive! ToT booth

ARM’s Andy Frame stopped by Atmel’s EELive! 2014 ToT booth to chat with our very own Andreas Eieland (@AndreasMCUguy), who looks after Atmel’s SAM D Cortex-M0+ based family of devices.

As you can see, Frame snapped a great picture of Andreas standing next to Atmel’s tricked-out Tech on Tour Truck which travels around the US showcasing a wide range of Atmel-powered products, including those based on ARM’s Cortex-M and Cortex-A5.

ARM’s Ronan Synnott was also at Atmel’s EELive! booth giving a presentation about ARM’s DS-5 support for Atmel SAMA5D3 devices. Ronan described how, with DS-5 Professional Edition, ARM provides a leading-edge software development tool chain for bare-metal, RTOS and Linux based projects. 

For the SAMA5D3 devices, ARM offers full debug support out of the box when used in conjunction with DSTREAM or ULINKproD JTAG debug units, the Streamline System Performance Analysis tool and the highly optimizing ARM C compiler.

We hope to hear more from Ronan over the next few weeks, so be sure to check Bits & Pieces for additional embedded news and reports.

Meanwhile, Atmel’s Tech on Tour trailer will be headed to Austin, Texas on April 8th. We’ll be talking about low-power system design using Atmel’s ARM-based SAM4L MCU, touch and wireless solutions, as well as offering an introduction to Atmel’s versatile SAM D20 microcontroller.

atmeltot

Interested in learning more? You can register here and check out future ToT stops here.

Adafruit builds a Yún-powered security camera

Adafruit’s Marc-Olivier Schwartz has designed a DIY wireless security camera built around an Atmel-based Arduino Yún (ATmega32u4), USB webcam, microSD card and a PIR motion detector.

“The first application [of the Yún-powered security camera] will be a modern version of standard tasks that you want for a security camera: taking pictures when some motion is detected. The project will store pictures taken by the USB camera on an SD card inserted into the Yún, but that’s not all,” Schwartz explained.

“Because we are in the age of the Internet of Things (IoT), we also want these pictures to be automatically uploaded on a secure location. And that’s exactly what we are going to do by uploading the pictures to Dropbox at the same time.”

As expected, the Yún-powered security camera is also capable of streaming video directly to YouTube.

Schwartz recommends kicking off the project by inserting the SD card into the Yún, connecting the camera to the USB port and linking the motion sensor (VCC pin to the Yun 5V pin, GND to GND, SIG pin to the Yun pin number 8).

After connecting to a PC via the microUSB port, Makers should configure their Temboo and Dropbox accounts. Subsequently, additional software needs to be install on the Atmel-based Yún, including UVC drivers, python-openssl package, fswebcam utility and the mjpg streaming library.

In terms of streaming videos to YouTube, Schwartz first creates a local stream which is then transmitted to a PC via Wirecast and finally, to a YouTube live event.

“Of course, there are several ways to build other cool applications using this project. You can drop the motion detection part and build a camera that take snapshots at regular intervals and upload these on Dropbox,” Schwartz added.

“You can [also] easily create time-lapse videos with this kind of project: just collect the pictures from your Dropbox account, paste them into a time-lapse software. You can also extend this project by adding more Yún + camera modules, to have a complete video monitoring system in your home.”

Interested in learning more? Schwartz’s detailed tutorial is available on Adafruit’s learning system here.

Readers may also want to check out other Yún-based Maker projects including an electricity monitor, mesh extender platform, Foursquare soap bubble machine, a Gmail (alert) lamp, water heater regulator and the high-five camera.

Designing an Arduino-based Dahlander switch

Jean-Noel was fixing a broken Lurem woodworking machine equipped with a three-phase Dahlander motor. The trio of operation modes originally included: stop, half speed and full speed.

As HackADay’s Eric Evenchick notes, the motor uses a special mechanical switch to select the operating mode. However, the mechanical components inside the switch were broken, preventing the motor from being activated.

How to solve the problem without sourcing a new switch?

 Well, Jean-Noel decided to build his own Atmel-based, Arduino Pro Mini (ATmega328 MCU) powered Dahlander switch consisting of three relays tasked with selecting the wiring configuration for each speed mode.

Jean-Noel also added a button to toggle settings, along with two lamps to indicate what mode the motor is currently operating in.

“The Arduino runs a finite-state machine (FSM), ensuring that the device transitions through the modes in the correct order,” Evenchick explained.

“This is quite important, since the motor could be damaged if certain restrictions aren’t followed.”

Meanwhile, the state machine graph was generated using Fizzim, with the final product housed in a DIN rail case, allowing it to be securely mounted along with the rest of the wiring.

Interested in learning more about the Arduino-based Dahlander switch? You can check out the project’s official HackADay page here.

Report: Wearables to drive significant battery revenue

Analysts at IHS say the global market for batteries used in wearable electronics will increase more than tenfold in just four short years, propelled by new devices suitable for active sports and fitness lifestyles. 

Indeed, worldwide revenue for wearable electronics batteries is projected to reach $77 million by 2018, up considerably from a mere $6 million by year-end in 2014.

In addition, industry revenue will have grown nearly 120 percent from 2014 levels.

“Wearable electronics will be the key to sustaining the current very-high-growth levels of battery revenue in consumer electronics,” explained Thomas McAlpine, power supply and storage component analyst for IHS.

“The tremendous expansion in store will come thanks to an increase in the shipments of smartwatch products, wearable health monitoring devices and smart glasses—products geared toward an active lifestyle combining advanced technological trends in miniature computing with newly smart consumer imperatives in fitness and fashion.”

In addition, annual shipments for wearable electronic devices will reach an estimated 56 million units by 2018, fueling continued demand for the batteries that power these products.

“Of the total number of batteries expected to be installed in wearable electronics by 2018, lithium polymer batteries will take the predominant share, accounting for 73 percent of total wearable electronics battery revenue,” said McAlpine. 

”Lithium polymer batteries are typically the preferred choice as they are lighter in weight and can be manufactured into a wider range of shapes and sizes, compared to traditional lithium-ion batteries.”

Smartphone and tablet PC demand will continue to drive the majority of revenue growth in the lithium battery market for portable electronics over the next couple of years, with the combined shipments of these devices projected to grow 46 percent from 2013 to 2015. 

However, shipments will decrease from 2015 onward, and coupled with projected erosion in the average selling prices of lithium battery cells, growth will decelerate for the overall lithium battery market for portable consumer electronics.

“This means the emergence of new applications in the market is critical. Lithium batteries will remain an integral component for innovation in consumer electronics,” McAlpine added. “To achieve sustained market growth, new wearable electronics and other devices need to be introduced and adopted by the mass market, similar to what is occurring now in recently emerging product categories.”

As we’ve previously discussed on Bits & Pieces, Atmel is right in the middle of the wearable tech revolution, with the the soft electronics DIY Maker community adapting various Atmel-powered platforms specifically for wearables, including the Arduino Lilypad (ATmega328V) (developed by MIT Media Lab professor Leah Buechley), along with Adafruit’s very own Gemma (Atmel ATtiny85) and Flora (ATmega32u4), the latter of which can be easily daisy chained with various sensors for GPS, motion and light.

In addition, Atmel’s microcotrollers are found in a number of smartwatches and wearable medical devices.

Interested in learning more about wearables? You can check out our extensive article archive on the subject here.

Atmel’s commitment to students and Makers

MCU Applications Manager Bob Martin reiterated Atmel’s long-standing commitment to the international Maker Movement during an EELive! 2014 Tech Talk.

bobmartineelive

“The DIY Maker Movement is dynamic and particularly active on sites like Kickstarter and spaces such as 3D printing,” Martin explained. “We recognize that coming up with the next major innovation is no longer limited to industry heavyweights, but rather, is likely to be prototyped and developed in garages and Makerspaces.”

Martin also noted that Atmel was at the heart of most Arduino boards on the market today and highlighted Atmel’s new SAMA5D3 Xplained board – a low-cost, fast prototyping and evaluation platform for microprocessor-based design.

According to Martin, the board is targeted at both veteran developers and Makers. Indeed, the $79 SAMA5D3 Xplained – built around Atmel’s SAMA5D3 ARM Cortex-A5 processor-based MPU – is packed with a rich set of ready-to-use connectivity and storage peripherals, along with Arduino shield-compatible expansion headers for easy customization.

The platform is also perfect for headless Android projects, with a Linux distribution and software package helping to facilitate rapid software development.

On the software side, Martin briefly discussed the Arduino plug-in for Visual Studio (via Visual Micro), which offers a more detailed and complex environment for developers and Makers looking to supercharge their sketches.

Last, but certainly not least, Martin talked about Atmel’s popular University Program which helps familiarize both students and instructors with the embedded space, while facilitating migration from 8-bit to 32-bit development.

“Atmel offers a full day course for universities, split in two primary sessions. Both are free of charge. The morning session focuses on basic robotics using an Atmel AVR XMegaA3BU Xplained board,” said Martin.

“Course participants are taught pulse and width modulation techniques, as well as how to configure a collision avoidance program with basic algorithms. Attendees of the morning session get to take home their XMegaA3BU Xplained Board and a JTAGICE 3 hardware debugger.”

Meanwhile, afternoon session attendees can keep their SAM D20 Xplained Pro, which are used to implement a simple light and temperature meter along with two additional wing boards.

Interested in learning more about Atmel’s commitment to Makers and students? You can check out Atmel’s University Program here and coverage of Atmel-based Maker projects here.

Video: Robotic arm measures magnetic fields



Stanley Lio has created a magnetometer-equipped robotic arm with three degrees of freedom to accurately measure magnetic fields.

According to HackADay’s Nick Con, the arm itself was built with standard servos and aluminum mounting hardware purchased from eBay.

“He then hooked an HMC5883L magnetometer to the robotic arm, using [Atmel’s] ATmega32U4 microcontroller (MCU) and the LUFA USB library to interface with this sensor since it has a high data rate,” Con explained.

“The results were plotted in MATLAB, a very powerful mathematical based scripting language. The plots almost perfectly match the field patterns learned in introductory classes on magnetism.”

So, what’s up for version two of the magnetometer-equipped robotic arm? Well, Stanley says he has a few tweaks in mind, including:

  • Adding extra redundant DOF
  • Having fun with math
  • Measuring positioning accuracy, precision and repeatability
  • Auto calibration using the IMU (when new servos are installed)
  • Light painting
  • Controlling the arm by real-time input devices with a camera and/or 
mouse
  • Parallel robots
  • Improving positioning accuracy

Interested in learning more? You can check out the project’s official page here.

Time-lapse photography trigger on an Arduino Shield

A Shield is a plug-in mezzanine board that fits into Arduinos. I was looking for a remote trigger for my great Panasonic GH3 camera I use for some shots in my Atmel Edge web show. So I was delighted to run across this little time lapse trigger Arduino Shield that visual effects artist Dan Thompson is working on.

Dan-Thompson_time-lapse-Shield

This is the circuit board layout for Dan Thompson’s time-lapse Arduino Shield.

That lucky happenstance led me to other Arduino-based time-lapse controllers like this one from “hacker3455”.

Arduino-time-lapse-shutter

This is another Arduino-based time-lapse shutter controller.

 

And here is a yet another time-lapse Arduino on Hack-a-Day.

Arduino_Hack-a-day_time-lapse

 

And if you want to get that “Bullet time” look like in the Matrix
movies, there is even an Arduino-based time-lapse dolly controller.

Arduino-time-lapse-dolly

 

There are several controllers, like this one you can to pans and tilts with. Here is a little test video of the prototype:

Of course, the path software is critical and the community does not disappoint, with code like this, developed by Airic Lenz, the fellow that did the above video.

This is the kind of tech that South Dakota farmer Randy Halverson stunned the world with back in 2013. Here is a vid with the man himself:

Here is a video of an Arduino-based dolly in action:

And here is one more time-lapse controller from the wonderful folks at Practical Arduino.

Arduino in a cardboard box

If you went to Maker Faire New York, you saw Atmel’s tables had flashing LEDs on the edge.

LED-tables-Atmel_Maker_Faire

The tables Atmel had at NY Maker Faire had LED strips built into them.

Those strips were powered by these custom “Arduinos in a box.” The cardboard box was perfectly in keeping with cardboard tables, made by chairigami.

Arduino-in-a-box

We created a battery-powered Arduino to run the LED lights on the cardboard tables.

Arduino-guts-in-a-box

Inside the box is an Atmel-powered Arduino, as well as the battery pack used to run the board and LED strip.

Arduino-power-in-a-box

This side has the D-sub connector used to connect to the LED strips. There is also a power connector if you don’t want to run on the internal batteries.

Arduino-USB-in-a-box

The boxes have a cut-out for the USB connector, should you need to do some emergency programming on the show floor.

Arduino-battery-in-a-box

A nice touch is the Velcro strip on the back of the battery pack that holds it to the side of the box. You can see the “ECO” (engineering change order) where the USB hole was on the same side, but that got changed in the prototyping stage. Every product tells a story.

Be sure to check out the Atmel booth at Maker Faire Bay Area (Silicon Valley), World Maker New York (in Queens), and in just a few weeks (April 6-7, 2014) we will be at Maker Faire @ Shenzhen (China).

Video: Drawing schematics with Paul Rako

In this episode of Atmel Edge, Analog Aficionado Paul Rako describes the importance of drawing schematics with inputs on the left and top, as well as outputs on the right and bottom.

“The most fundamental thing about a system-level schematic is that there is a flow to it – and that flow is from left to right and from top to bottom,” Rako explains.

“Anyone can pick it up and they know they can look at the left edge and tend to see inputs, or look at the top and tend to see inputs. Then they can look to the right edge or the bottom and tend to find outputs.”

Well, perhaps it isn’t that simple, says Rako, because what about a bus?

“How do you represent something that has bidirectional flow? Do you put things on the top or the left edge? That’s kind of a style, but if you just stick to these basics, you’ll be a lot better off,” he adds.

Watch as Paul provides a little bit higher level tip than just grounds, capacitors and resistors, plus topics we’re going to discuss in the 101 series. Stay tuned!