Have a garden? Show it off! Share your pics here.

Ian Lesnet

Cadsoft Eagle 5 test drive


The other day, Make:blog mentioned the new 5.0 release of Eagle. Cadsoft Eagle is the most popular circuit design and layout software among DIY'ers, and the program I use in all my projects. Today I designed a project with Eagle 5 and journaled my favorite updates. I also tested compatibility with the current and beta versions of Eagle3D, a 3D circuit board rendering program.
next page

Gallery: Eagle 5 and Eagle3D

Eagle 5 PCB color schemeCadsoft Eagle 5 context menusCadsoft Eagle 5 properties dialogEagle3D 1.05 and 1.10 comparison

Cadsoft Eagle 5 test drive, part 2


Cadsoft Eagle 5

Eagle 5 installs to dedicated version 5 directory -- the new version won't overwrite a previous install. You still have full access to your original stuff if anything goes wrong.

When I start Eagle 5 it attempts network access; this might be an auto updater or license checker. It didn't complain when I permanently blocked access.



All my old schematics and circuit board files from Eagle 4.16r2 load in the new version. The board layout editor got a minor makeover with "web 2.0" pastel color shades.

Say goodbye to the awkward ALT+Backspace undo, because Cadsoft joined the rest of the world and standardized on CTRL+Z!!! Need I say more? Oh happy day!



Eagle now has right-click context menus in the schematic editor and the board layout editor. While context menus are ubiquitous (does your browser have it?), previous versions of Eagle pretend the right mouse button doesn't exist.
next page

Gallery: Eagle 5 and Eagle3D

Eagle 5 PCB color schemeCadsoft Eagle 5 context menusCadsoft Eagle 5 properties dialogEagle3D 1.05 and 1.10 comparison

Cadsoft Eagle 5 test drive, part 3




Another great feature is the properties editor. Component or connection properties can be configured in one place. These features were previously scattered over dozens of menus and icons.

Eagle3D 1.05 compatibility

Like a Firefox upgrade, it's important that all your favorite Eagle add-ons are compatible with the new version. For me, that's the ultra-cool 3D rendering script, Eagle3D. The 3D renderings that accompany my projects are made with Eagle3D 1.05, but I'll also test a new 1.1 beta version with Eagle 5.

First, I installed Eagle3D 1.05 in the same folder as Eagle 5 (C:\Program Files\EAGLE-5.0.0\Eagle3D). I also installed POVray (try MacMegaPOV for Mac) to render the files created by Eagle3D. If you're not familiar with how to use Eagle3D, or run .ulp files with Eagle, see the Eagle3D documentation and this illustrated tutorial.

I loaded a circuit board file and rendered it using the Eagle3D .ulp file intended for Eagle version 4.1. It worked normally, and generated a POVray compatible file.

New users often run into this error when rendering the their first Eagle3D .pov file with POVray:
Parse Error: Cannot open include file tools.inc.
File: C:\ ... DIYLife.com - MSP430 voice recorder - vc.pov Line: 117
Parse Warning: Check that the file is in a directory specified with a +L switch or 'Library_Path=' .INI item.


This means that POVray can't find the Eagle3D component libraries. You need to add Eagle3D to the POVray search path:
  1. Open POVray and make sure you have a .pov file open.
  2. Go to tools->edit master povray.ini. Povray.ini opens in a text editor.
  3. Add the path to your Eagle3D files at the very bottom of povray.ini. This is the folder where Eagle3D was installed earlier. I added this line to the end of my poyray.ini, but use your own install location: Library_Path="C:\Program Files\EAGLE-5.0.0\Eagle3D\povray"
My board rendered perfectly after this minor configuration change.
next page

Gallery: Eagle 5 and Eagle3D

Eagle 5 PCB color schemeCadsoft Eagle 5 context menusCadsoft Eagle 5 properties dialogEagle3D 1.05 and 1.10 comparison

Cadsoft Eagle 5 test drive, part 4


Eagle3D 1.1 beta compatibility

Next, I upgraded to the new 1.1 beta version of Eagle3D. The beta version was released on the Eagle3D mailing list.

I deleted my old Eagle3D folder and copied the new version to the same location. If you use a different location, update the Library_Path you specified in povray.ini. Be careful not to include multiple search paths for different versions of Eagle3D, the result will be unpredictable.

The interface of version 1.05 and 1.1 are nearly identical. The new version optionally generates SVG formatted vector graphics.

Eagle3D 1.1 generates a list of components it wasn't able to match to the 3D parts library. This is a helpful new feature that will help diagnose why certain parts don't render correctly.



Functionally, the new version performs similarly to version 1.05. It didn't render any more parts on my test board than the last version. The new version (above, right) excludes the water background, and I don't know how I feel about this yet -- the old background (above, left) was getting tired, but white is a bit jarring.

Verdict

I'm tentatively using the new versions of Eagle and Eagle3D. They've been solid for a few days, and backwards compatibility seems good. The new features in Eagle 5 make it much easier to use and more intuitive for beginners. Both versions of Eagle3D are compatible with Eagle 5, but I highly recommend the new 1.1 beta version. Eagle3D 1.1 is several years newer than its predecessor, has a larger parts library, and generates helpful reports.

Related links

Draw electronics schematics with cadsoft Eagle.
Turn your eagle schematic into a PCB.
Render 3D images of your PCBs using Eagle 3D and POVray.

Gallery: Eagle 5 and Eagle3D

Eagle 5 PCB color schemeCadsoft Eagle 5 context menusCadsoft Eagle 5 properties dialogEagle3D 1.05 and 1.10 comparison

Computer mouse salvage

Electronic components.Salvaging electronic parts is a must for any DIY'er. You save big on shipping charges, and recycling is good for the environment. Hack-a-day dissected an old computer mouse and found some useful components.

What useful parts are inside an outdated PC mouse? There are a bunch of sensors and buttons, including rotary encoders that can be used to measure movement in robotics projects. My favorite find is the microchip that glues the sensors to a computer. Learn about all these parts in detail, in the how-to.

Hack-a-day doesn't delve into the proper techniques for removing parts, but there are a ton of tutorials that can help you get started. It's possible to remove many parts with a simple soldering iron and an absorbent copper braid, called solder wick. Many use a solder sucker to vacuum solder away from parts, or a special desoldering iron. Surface mount chips can also be removed, but they may require the gentle embrace of 400 degree air from a hot air rework station, or the crude gust of a heat gun.

Record audio with the MSP430 microcontroller

This article continues a series about building a DIY digital audio recorder. Inspired by this microcontroller audio project [via], I set out to build a simple digital recording device. I chose Texas Instrument's MSP430 microcontroller for this project because it's fast (16 MHz), it's cheap ($1), and it's very low power. Read the first part, the second part, and the third.

In the first few segments I developed a digital audio recorder prototype that plays raw audio files from an SD card. This time we finish up the introductory segments by recording audio to the SD card. Before the audio can be recorded by the microcontroller, it has to be prepared by a small amplifier. Read on to learn more about working with microphones and recording audio with a microcontroller.



Gallery: MSP430 audio sampling

Audio sample overviewRaw microphone outputAnalog measurementEcho audio input

Record audio with the MSP430 microcontroller pt. 2

Preparing raw microphone output for sampling
This project uses a small, common electret microphone to convert audio to an electrical signal. These are the cheap microphones found in most PC headsets. The microphone output must be amplified and zeroed before it can be recorded with the MSP430. This is done with an operational amplifier, or op-amp. The op-amp amplifies the tiny, oddly centered audio signal into a full range signal based on 0 volts. The diagram shows the original signal (blue) and the amplified, full range signal outputted by the op-amp (red).



I'm not much of an analog designer, so may I refer you to any of these tutorials on op-amps if you need more info: wikipedia, a flash tutorial, opamp basics.

The op-amp design I used came directly from TI's digital audio recorder application note slaa123 [pdf!] (page 3). TI's design uses a TI TLV2252 dual op-amp. We only need one, so I substituted a single channel TI TLV2221 op-amp. I used the circuit and values from the TI app note, but substituted the 2K/.01uf low-pass audio filter I chose in part II. The TLV2221 is only available in a surface mount package. If you want to do an all through-hole version of this project, consider a TLV2252 based design.


click for full sized schematic image


Sampling an audio signal
We'll use the MSP430's on-chip analog-to-digital converter (ADC) to measure the audio signal. The ADC is a pin that measures analog voltages. Measurements taken by the ADC are recorded as a fraction of a voltage reference (Vref). In the prototype, the voltage reference will equal that of the circuit -- 3.3 volts.

The smallest voltage change that can be measured by the ADC is denoted in bits. An 8 bit ADC measures voltage on a scale of 0 to 255. A reading of 127 (127/255=50%) from the ADC represents ~1.65 volts (0.50 * 3.3 volt reference). The diagram shows the relationship between bits, voltage reference, and measurements taken by the ADC.



The MSP430F2012 has a 10 bit (0-1024) ADC, while the F2013 has a higher-resolution 16 bit (0-65535) ADC. The higher resolution ADC could, in theory, be used to capture better audio.

Gotcha --
The prototype design is unproven and bound to have problems. Here's a big one! Most ADCs, including the Microchip PIC, ATMEL AVRs, and even the MSP430F2012, can use the circuit power supply as the ADC voltage reference. An internal switch, manipulated from software, determines the reference source. I planned to use this feature to measure the op-amp output, which is scaled to the 3.3 volts used in the circuit. The F2013, despite my assumptions, does not appear to have an internal Vref connection to the chip power supply. The F2013's internal Vref comes from a precision 1.2 volt reference. An external voltage reference can be sourced through pin 5 (P1.3), where a LED currently connects. Future designs should take this limitation into account, and connect the F2013 Vref pin directly to the power supply.

My work-around was to remove the LED and solder a fly-wire from the power pin to the Vref pin. An external Vref is used if SD16REFON and SD16VMIDON are both cleared to 0, according to page 24-4 of the MSP430F2xxx Family User's Guide [pdf!]. This didn't work for me.

Next, I calculated a voltage divider to cut the op-amp 3.3 volt output to 1.2 volts - this helped to some extent.

Eventually, I messed around enough to destroy the MSP430. In desperate need of a break, I removed the dead MSP430F2013 and replaced it with a F2012. The F2012 has only 10 bits of ADC resolution, but is able to use the chip supply as a voltage reference.

Test audio capture (example firmware 4)
NOTE:unlike the previous firmware, this is intended for the MSP430F2012!!!
The example program samples audio from the microphone and puts it immediately in the PWM duty cycle register. The result is a useless "middle man" that echoes everything heard by the microphone.

This project is based on the firmware from my last article. A timer triggers an alarm (an interrupt) 8000 times per second. An ADC measurement is started each time the alarm sounds. The ADC measurement isn't ready immediately - it takes a few cycles for the conversion to be readable. We don't need to worry about this period, because the ADC will trigger it's own interrupt when the measurement is complete. A single line of code in the ADC interrupt service routine copies the ADC measurement to the PWM duty cycle register.



As you can see in the video, everything I play into the microphone can be heard from the powered PC speakers. There's no direct audio path from the microphone to the speakers -- the sound is first sampled, and then output on the PWM. This simple concept can be used in different ways to create custom digital audio effects and real-time audio distortions.

Record audio with the MSP430 microcontroller pt. 3

Recording to a SD card (example firmware 5)
The whole series of articles comes down to this moment -- it's time to save audio samples to the SD card. Like last time, a MMC/SD card library from TI takes care of accessing the SD card. The original TI library requires a 512 byte block of memory to hold a whole SD card sector, but the F2012/3 chip only has 128 bytes of RAM. A low memory version of the write routine is possible if we write the bytes into the sector sequentially. I broke the write function into three smaller functions that:
  1. mount a sector for writing,
  2. send a single byte to the SD card, and
  3. starts the sector save and unmounts the sector.
If we only write a single byte to the card at a time, a full 512 byte cache is unnecessary. This is the same technique I used to read from the card in Make a talking MSP430 microcontoller.

The example firmware builds on the existing projects. A timer generates an interrupt 8000 times per second. Ten seconds of audio is recorded immediately after the circuit is powered. For these ten seconds, each timer interrupt begins an ADC measurement. Upon completion, the ADC triggers an interrupt that stores the audio sample in a buffer and sets a flag. This flag triggers code in the main program loop to write the byte to the SD card. After ten seconds (80000 samples, 157 sectors), recording stops.



Next, the recorded audio is played in a loop. As in the previous project, each timer interrupt (8000 per second) copies a sample from the SD card to the PWM duty cycle register.

Sector switching and management is handled in the background by the sdRead() and sdWrite() functions. Every 512 bytes the sector is switched -- the old sector is closed and the next sector is mounted. If you use these functions, pay close attention to the setup steps that prepare the card for a sequential read or write. Set the start location to read or write in the flashDisk and audio variables, and manually mount the start sector.

NOTE: The SD card is used as a cheap and handy source of flash storage. Audio data is recorded to the SD card in a raw format. Audio files will not appear if you put the card into a memory card reader and attach it to a PC. The MSP430F2012/3 lacks the resources needed to implement a full FAT file system. The raw data can still be viewed and extracted with special disk tools, such as HxD.

The example program starts recording audio at the beginning of the SECOND sector of the SD card (sector 1). The first sector (sector 0) will be used to record the length of the file in the final digital audio projects. The reserved sector provides 512 bytes for meta data, allowing us to delineate the flash storage space into multiple audio clips.

Continuing...
Next time, I'll finish up with the MSP430 by designing a complete digital audio recording experimenter's board. The final project joins everything from the previous four articles with an amplifier chip that drives a small speaker.

Prototype
This project uses the digital audio recorder prototype from Make a singing MSP430 microcontoller. I replaced the original F2013 with a F2012. The only difference between these chips is the type of ADC: the F2012 has a 10 bit ADC, the F2013 has a 16 bit sigma delta ADC.



The microphone amplifier prototype is included in the project archive. The circuit was designed with the freeware version of Cadsoft Eagle.

Parts list


Op-amp:
U1 - TLV2221 (surface mount, SOT23-5L). TLV2211, and TLV2231 would also work.

Capacitors: (through-hole unless noted)
C4 - 0.1uF (surface mount, 0805)
C5 - 0.01uF
C7,8 - 4.7uF
C9 - 470pF

Resistors: (all through-hole)
R2 - 2K
R5,6 - 18K
R7,8 - 1K1
R9 - 56K

Gallery: MSP430 electret microphone ampifier

Microphone amplifier circuitPCB and part placementMic amp renderingMic amp prototypePrototype overview





Related links
Program a MSP430 microcontroller.
Make a singing MSP430 microcontroller.
Make a talking MSP430 microcontroller.

Next Page >

DIY Lists

About DIY Life

Do Life! DIY Life highlights the best in "do-it-yourself" projects.

Here you'll find all types of projects, from hobbies and crafts to home improvement and tech.


Powered by Blogsmith

DIY Life Contributors

#ContributorPostsCmts
1Erin Loechner390
2Diane Rixon201

Featured Galleries

An easy way to insulate and skirt an elevated structure
USB analog gauge overview
USB analog gauge circuit
Basil harvesting
Bug snacks
Fabric scraps projects