Showing posts with label electronics. Show all posts
Showing posts with label electronics. Show all posts

Sunday, April 24, 2016

VoiceBox Shield Quickstart Guide

"Hello World" never sounded so good
Voice Box Shield is a unique element to your Arduino- compatible system allows a robotic voice. It's a SpeakJet speech-synthesizer chip and an audio amplifier that can directly drive consists of a small speaker. In addition to forming the speech commands sent to it, SpeakJet tones and other chips, such as "robot" noises There are many other features such as the ability to coordinate. It is pre-stored phrases that can be set up when the input pin is triggered. Detailed technical information, see the User Guide SpeakJet.


VoiceBox Shield Quickstart Guide
VoiceBox Shield Quickstart Guide
Requirements:
In this manual you will need the following:
  • Soldering iron
  • Solder
  • Or stranded wire jumper wires
  • arduino
  • Speaker
How it works:
Arbitrary text-to-speech generation is a difficult problem. * When you (maybe with a ball & Spell) Think back to speak and spell. As you have learned, the correct pronunciation of many arcane rules are exceptions to the rule (actually hundreds) is governed by. VoiceBox SpeakJet chips on a slope in a speech to arbitrary text can not turn, but if you're willing to go up to the sound of the words rather than characters, SpeakJet chip is quite capable of synthesizing them.

A special audio chip SpeakJet the individual speech sounds, the synthesizer is capable of generating allophones. "A" parrot "There will be a different letter of the word" part "in comparison - it is different than the character. Unlike the characters, there are two words for different allophones. Allophones spelling out the words:

parrot= \PE \EYRR \UX \TT
part= \PO \AWRR \TT

Each allophone a text representation (as shown above), and a numeric code, which is stored in the following example code is. allophones In addition, there \ slow and \ rapid cadence that, as a result of stress and other effects that make the speech more natural way to add inline command.

So this means that I have to learn a whole new language?
Sort. But it really is not difficult, and you can use it quickly. How they're using the best available SpeakJet User Guide list of all allophones, along with tips, and hundreds of SpeakJet words into a text file already in their allophones. You have a limited number of words that need to be spoken, they are easy to copy your code out of the dictionary. You do not need to build new words in the dictionary, you see how it is built, and until it sounds just right allophones a similar sounding words in the dictionary starting to play around with.


How to use it:
Rally
An Arduino shield plug in your voice box, you will need to solder the board include paretabe header. If you've never welded before, do not worry, it's easy (although you have to practice on something else this is your first time, you may want to soldering). Six and eight-pin header on the edge of the board into groups of six and eight-hole matches. Header socket component side of the board (top) goes on, and the pins stick out at the bottom. The easiest way to solder the header board, board assembly and then flip upside down and insert it into the hole all four titles, and it is placed on a flat surface. Then you (the face) can solder joints on the bottom side of the board.

VoiceBox Shield Quickstart Guide
VoiceBox Shield Quickstart Guide
It is important for the header straight welded on so that they will easily plug into an Arduino (and other board can plug in). This is a good way to make sure that each header is only one pin first, then the alignment of the test solder. If something is not right, in front of the solder joint remelt cool straight title. Once the header is straight, all solder joints. In this example, the plug sockets on your Arduino must be clean, pin-up is sticking too long Try not to get too.

Also at your disposal (such as our 0.5W model, the COM-09151) need to be connected to a speaker or amplifier speaker header, SPK + and SPK- (such as our kit -09612). The easiest way to do this on your speaker or amplifier speaker terminal solder short lengths of wire from the header. Speaker, it usually does not matter which side you which terminal (but if you're using more than one speaker, you'll want them all the same way wired) connection. If you use an external amplifier If the amplifier's input ground or minus minus side to side (SPK-) connection.


Use
Once you have connected to a speaker, and upload your Arduino code examples below to give it a try. The Board will "prepare" the Reset, and then say, "All your base are belong to us", followed by some robotic beeps and chirps. Volume is not to your liking, then you can adjust the potentiometer on the board smaller. You will need to turn in an equally small Phillips screwdriver, and remember to be gentle as the small pots are fragile.

/*


Voice Box Demo Sketch


Written by Ryan Owens


SparkFun Electronics




Uses the Voice Box Shield from SparkFun to send the message "All your base are belong to us" and a series

of robot sounds to the SpeakJet chip on the shield. 




A speaker can be plugged directly into the SPK+ and - pins on the shield.

*/




//Soft serial library used to send serial commands on pin 2 instead of regular serial pin.


#include <SoftwareSerial.h>




//Define the Pin Numbers for the sketch.

#define E0  5

#define E1  6

#define E3  8

#define E2  7
#define E4  9

#define E6  11

#define E5  10
#define E7  12


#define SPK  4

#define RDY  13
#define RES  3


//Create a SoftSerial Objet

#define txPin  2



SoftwareSerial speakjet = SoftwareSerial(0, txPin);

//The message array contains the command for sounds to be sent in order to inunciate the words "All your base belong to us." Check the SpeakJet Manual for more information


//on producing words

                                                  //All Your Base Are Belong to us


char message[] = {20, 96, 21, 114, 22, 88, 23, 5, 8, 135, 8, 146, 5, 128, 153, 5, 170, 154, 8, 188, 5, 152, 5, 170, 8,128,146,8,135,8,144,5,8,191,162,5,8,134,187};




//The sounds array contains the commands to send robot sounds to the SpeakJet chip.

char sounds[] = {200, 201, 202, 203, 220, 221, 222};




void setup()

  //Configure the pins for the SpeakJet module

{


  pinMode(txPin, OUTPUT);

  pinMode(SPK, INPUT);

  

  //Set up a serial port to talk from Arduino to the SpeakJet module on pin 3.


  speakjet.begin(9600);

  

  //Configure the Ready pin as an input


  pinMode(RDY, INPUT);

  

  //Configure Reset line as an output


  pinMode(RES, OUTPUT);


       


  //Configure all of the Event pins as outputs from Arduino, and set them Low.


  for(int i=E0; i<=E7; i++)

  {

    pinMode(i, OUTPUT);


    digitalWrite(i, LOW);


  }

  

  //All I/O pins are configured. Reset the SpeakJet module


  digitalWrite(RES, LOW);


  delay(100);


  digitalWrite(RES, HIGH);

  

void loop()

}



{  

  //Send "All Your Base are Belong to Us" to the SpeakJet module


  speakjet.print(message);


  //Wait before sending the next string.


  delay(3000);


  //Send the robotic sounds to the module.


  speakjet.print(sounds);


  while(1);

}



By default, a three-pad solder jumper Pin Arduino D2 SpeakJet serial input that connects to the customer. Arduino is the value of D2 pin, Texas, are you of D2 (the advantage of this system is a software serial library SpeakJet to talk with chips that can be used for standard serial pins D0 and D1 and other cereals from the free use). If you want to use the standard pin in Texas, then you can change it to solder jumper JP2 (but if you do this, SpeakJet chips, unless you unplug Voice Box gibberish noises can shield the first, when you're uploading code Notes ). The first fully jumper solder wick (toll -09327) from the existing solder used to remove solder jumper to change its position, then the other side of the bridge connecting the solder jumper add.

Other resources:
WiFly wireless SpeakJet Server: A more advanced projects, a WiFly shield shield a voice box Check out our tutorial on clothes.
Rejoice! 

If you need help, please contact us at Tech support@sparkfun.com, or our forums do not hesitate to get advice from other users. We love hearing about your project, so let us know what you are doing!

Your friends at SparkFun.

TTS256 (COM-09811) - * Are you really arbitrary text-to-speech generation is required, then SparkFun sells a chip that can do it. Rule 600 of the chip that are allophones (and usually you have a problem with it, check your spelling words by "phonetically" can fix a problem), free text translation is a pretty good (but not always perfect) job to do. It is this chip to add Voice Box Shield, how to do this for our tutorial (tutorial Voice Box Board for the previous version, but the same process) that's even possible.

Friday, April 22, 2016

ProtoSnap - E-Sewing Kit Getting Started Guide

To add a little zest to your wearables you're looking for, it's bright, white LEDs do not get more delicious. But, if you're new to e-textiles game, really general electronics, cable (or sewing) can seem like a daunting task in a deliciously thought circuit. E-sewing kit ProtoSnap our more basic, yet useful, some of the concepts taught in the circuit is aimed at, so you confidently of anything you fancy LED, switches, buttons, and the battery can throw.


ProtoSnap - E-Sewing Kit Getting Started Guide
ProtoSnap - E-Sewing Kit Getting Started Guide

E-sewing kit looks like one of the keys to the whole board should arrive. Each component is already wired together, so if you toggle switch and / or push button to the right five LEDs can illuminate. If you look closely, you'll notice that the big board is a separate board is comprised of eight. This can be broken down into eight pieces each, serving as a separate board, however you see fit, so you can implement them in your project. Let's dig a little deeper into each part.

LilyPad Coin Cell Battery Holders
The energy that drives e-sewing kit. Just like your favorite toy, batteries, not included with the kit, so you can insert into a 20mm coin cell battery holder to do it. Are you just about anywhere you find "normal" AA or AA batteries to buy should be able to find this type of battery. Look for a CR2032 battery type.
When you get inserting the battery, it is inserted with the correct polarity. The positive side is usually a "+" is indicated, and it usually got it some other text. Batteries should be inserted, so that the positive side of the coin-cell touch the top of the container. Insert the batteries in backwards, do not fret if you can not do anything to break ... it just will not illuminate.
One last point here, if you really look closely Coin Cell LilyPad board, despite more than one character '+' s'll notice and "-" s printed board. The four petals of the lily pads on each label. Petal is a LilyPad where a connection should be made on whether you're sewing or welded place. Please note that the Board LilyPad E-sewing kit at least two petals of each individual and if they have specific functions - they're labeling (like + and). Just as we discussed in the next couple of boards to keep an eye on things.

LilyPad LED
ProtoSnap - E-Sewing Kit Getting
The E-sewing kit really make them shine! LED everywhere these days, it almost feels like electronics are required to have at least more than a blinky light. Therefore, there is no doubt that, should you want to add some other everyday items.
If you look closely at the LED board, I would like to draw your attention to a few things. Each LED on the board of two components, one little black resistance, and is driven in a large white-yellow. Obviously, the LED where the light comes out. The working behind the scenes to prevent a "current-limiter as"; Led his job to make sure it does not explode, and it will do its job well.
Just as the currency of the cell boards, each petal is with the "+" or one labeled "-". If you have a sewing line, board've noticed that seems to connect all together. The meandering line it is a representation of wire that's going on in the e-sewing kit, wired it up to show you how all of this stuff is just not there. Note that "-" "-" LEDs are connected to each petal petals coin cell board? This is for you, electronics ... It's really just one big game of connect the dots. Not so bad, right? But the pluses of LED plus battery does not seem to be connected to? They are the first of our next two boards like they're making a stop-over look.

LilyPad slide switch and button board
ProtoSnap - E-Sewing Kit Getting Started Guide
ProtoSnap - E-Sewing Kit Getting Started Guide
One of the basic rules of electronic circuit ... unless it's a circuit that will not work. There is a closed loop current is flowing. We use the open and closed circuit switches to manipulate, bending our will power!
Their "off" state, each switch to act as an open circuit (ie not closed). You can tell from the sewing line, battery switches and LEDs, "+" is added in each of the petals; They are a happy, close circuit to prevent the forming of forming both components.

However, if you are "on" switch slide, or buttons actuate, the switch is in a closed circuit. Imagine wire extending through the switch now, "+" battery "" LED is connected to, and in some glorious kit, making white light should be!
ProtoSnap - E-Sewing Kit Getting Started Guide
ProtoSnap - E-Sewing Kit Getting Started Guide
At this point you are probably aware of the effectiveness of a variety of e-sewing kit are switched on. Button, a "momentary switch" which means it is a closed circuit tripping-ness, it is only run when the button is actuated. Slide the switch state is relatively stable, until the other side of the slide switch is on or off.

Once you have gotten your e-stitch kit comes with the job, learn how to break it down and learn how to stitch your next project in Part 2 of this tutorial test.

Thursday, April 21, 2016

Office Door Knocker Castle

We are always looking for more ways to make our office fun and strange. One of our engineers, Mike, until recently rigged elevator Tardis sound and play. I wanted to do something similar in my office, but, especially. I often close my door does not work, but most of the time, when someone comes to my office, the door to indicate their presence in the rap formal announcement. I decided to have a little fun with him.


Instead of making annoying noise standard door door, I Young Frankenstein castle door knockers from the door, I wanted to sound like.
To do this, I'll need a few things:
  • Some knock to detect and
  • Some of the sound to play.
Knock for identification, I chose large Piezo vibration sensors.
Office Door Knocker Castle
Office Door Knocker Castle
Because it is cheap and only need to use a resistor with an Arduino ADC accuracy of this sensor. When the film moves back and forth in a small AC voltage output sensor. I have to do is to use the material for a 1M ohm resistor in parallel with the solder, an ADC pin and connect the ground lead to one of the other lead. I simply solder a resistor between the leads of the device, and then I'm on the solder wires to connect to the Arduino.
Office Door Knocker Castle
Office Door Knocker Castle
There is no sound to play in the second major piece of the project. In order to play sound, I need to get the word out. Luckily, I'm here to Young Frankenstein clip from the scene were able to find an mp3 song.
mp3 music was a recording of the whole scene, so I have a very useful program called Audacity using just the sound of the door knocker was cut out. I'll need to edit sound files when the program easier for me to go, and it's free. Audacity, I open the mp3, I did everything but knock the sound cut out and magnify the high waveform before clipping it as much as possible so that it began to be loud.
Office Door Knocker Castle
Office Door Knocker Castle
Next, I exported the mp3 file and save it as "track001.mp3." This is because the file name will be published later. And I'm onto a microSD card to be used with the mp3 of the MP3 player loaded Shield.
Office Door Knocker Castle
Office Door Knocker Castle
Arduino shield triggered by an MP3 player is designed to play MP3's. It's a microSD socket via a 3.5mm audio jack s raw MP3 and audio to mp3 files as output process and has been a VS1053 audio codec. An example of the product page sketch that only after the other in an endless loop of mp3 files on the microSD card has been played. I would like to recognize the sound of a knock trigger only when I had to change some code.
If you're playing along at home, here in this tutorial is the final Arduino sketch.
First, I checked a function that returns the line analog 0 to detect whether or not a knock. I readPads the bottom of the existing code to add () function:

int readPads(void)
{
  if(analogRead(0) > SENSITIVITY) { return TRUE; }
  return FALSE;
}

Piezo sensors are drawn on the ground, the constant "sensitivity" 3. The sketch above is defined as, it will report a zero voltage until it is heated. 3. sensitivity means that any time is a constant set of values ​​greater than 3 is detected, the function returns true. This makes the sensors are very sensitive, but since it has been identified in a thick door with a knock, just in case I set it low.

Then, a knock is detected only when I play track001.mp3 loop () function code needs to be changed. Since the code is already written several tracks to play, I had to add more code than I was to be removed. The final loop function looks like this:
void loop(){

    int pad_pressed = FALSE;
    pad_pressed = readPads(); // Check for a "knock"
    if(pad_pressed == TRUE)
    {
        trackNumber = 1;
        sprintf(trackName, "track%03d.mp3", trackNumber); //Splice the new file number into this file name
        playMP3(trackName); //Go play trackXXX.mp3
    }
  }

This code first readPads () function call. If the function returns true, it plays the first track. Function returns false, and then loops back to check it. Very simple. To my Arduino shield, Piezo sensor attached soldered on, and sure enough, when I tap sensor, it plays the sound.
Office Door Knocker Castle
Office Door Knocker Castle
Now, attach it to the door. For this, I have to supply my local store to special order a precisely-machine Custom attachment device:
Office Door Knocker Castle
Just kidding.
I have a battery holder with a barrel of Jack Arduino powered with 4 AA batteries. I then used a 3.5mm audio extension cable to connect my computer speaker MP3 Player Shield. I Piezo sensors are attached to the back door, to the right height, where no one will knock around. The whole rig looks like this:
Office Door Knocker Castle
Office Door Knocker Castle
The final effect was pretty impressive:


Now that sounds like a giant wave knock on my door knocker are using. The project is how to use the MP3 shield and a Piezo sensor to integrate the object is just one example of the word. I drum sounds and electronic drums and other percussion instruments set up with multiple Piezo sensors are used. Only one device can use it to turn on in! Tell us more ideas / flex / Piezo sensors do not forget to check out.


Wednesday, April 20, 2016

Earthquake Data Logger

You are not destined for greatness in every project. Or success. Or even building. Sometimes you lovingly crafted project will meet again warned never to fly. Sometimes your project a "success" may be an underwhelming result. This is the story of such a project.



Christchurch, New Zealand - where I live - the beginning of September this year, there was a 7.1-magnitude earthquake. (And, no, no earthquake caused my project.) Some significant property damage in the earthquake were imposed, even though no loss of life. After an earthquake of this magnitude, smaller - but still noticeable - After Shock or weeks or months may continue. As of mid-November 3000, or after the shock has passed.
Earthquake Data Logger
Earthquake Data Logger
Following the earthquake and aftershocks, GeoNet know the magnitude of the event and to see images generated from a seismograph drums became a popular destination. The magnitude 4.7 and 4.9 earthquakes in this post I will describe later time images generated from data recorded on a seismograph drum is used:
Earthquake Data Logger
Earthquake Data Logger
Whether it's something I thought one day after a shock or an accelerometer to detect when they happened to be able to use. I Quake-Catcher Network project, which is connected to the USB accelerometers to detect and study the distribution had read about. But, hey, we are here to make ourselves the things we want, is not it?

Unfortunately, when the idea first occurred to me that I did not have any accelerometers, and by the time I organized the distribution of after-shocks or three thousand, and most of it was gone. The first signs of this project probably would not have had a huge impact in the world of scientific discovery.

Hardware Selection
When deciding on the use of accelerometer ADXL335 or ADXL345 is a choice I had to make. I have to begin with an analog device ADXL335, which means that it is easy to hook up and decided to start with.level do not need to convert. We think, given the quality of the interpreters need to take into account the lower maximum voltage. (You may feel better, I'm making this particular note, because until I started writing this post, I forgot to take this into account, but I can not possibly comment.)
Earthquake Data Logger
Earthquake Data Logger
I was like an Arduino microcontroller platform and digital (ADC) input, three-axis analog accelerometer is more than enough to handle. This is a 3.3V supply ADXL335 is required to supply a small amount of current.
It's always nice when someone figuring out the connection to a device, and in this case an Arduino board similar to a cable project is a page demonstrating how to connect the ADXL335 has been completed.

Writing The Software
Even better when you've got someone you both code and retrieve data from the device you are using to display the data in a useful manner has been written. In this case, accelerometer / gairoskopa data Arduino is a fantastic blog post, realtime graphic helpfully displayed on the graph in real-time readings, and accelerometers for processing codes are codes for reading.

I tried out the code, and when I placed it on a desk or accelerometer to move around and defeated the desktop got some nice graphs. Things were going well.

Although real-time graph showing the beautiful, you immediately detect the earthquake, I was missing something different to look at the data, you're missing. Most of the time data is uninteresting - all this suggests is "an earthquake is happening now." This means that in some way we have to go back and when an aftershock occurs, so we just can extract the data you want to save the interesting part.

WiFly shield my original plan to use some space "in the cloud" to send data from the accelerometer, because apparently that's where all the cool kids are sent to these days. (Although the cloud has its valued.) Pachube web site to one of the "Internet of Things" with data logging devices. While I was looking at possible options, I Nimbits data logger which apparently discovered their data logger application capable of running your own example.

It is at this point that I realized I could be a problem. The adoption rate of cloud-based data loggers supported none of the data - as far as I could tell - accelerometer readings per second, but the production is going to be ten. As far as I can tell - - I can neither support services batch upload readings Batching and upload them once every few minutes, but once again considered. And, even if they did, I'm still new to upload the data from the previous data logging out how to deal with the situation.

Reluctance, I decided to take a new approach, as I noted in my project log:
Given the low-ish likelihood of detecting an aftershock and the low likelihood of the building holding the Arduino falling to the ground, in the short term it probably makes sense to just record the data to SD card and retrieve it manually. This is less exciting but will result in something quicker. While there's a definite value in having direct to the web uploading the effort to create the infrastructure to support it is probably not really justifiable at the moment.
MicroSD as a shield for the project, I already wrote a great sdfatlib library simplified wrapper libraries provide an easy way to record information. This is a slightly modified version of the library wrapper library will be available early next Arduino SD release. It is now a few lines of code to make changes to the original microSD card, after writing accelerometer readings.

Data Collection
The power of a standard nine volt wall wart power supply, I decided to use. I looked at some form of backup battery power of an earthquake, I have to kiss under the rules, but that the rest of the time going out for another day, I was really worried.

The entire system is wired up to his fancy enclosure:
Earthquake Data Logger
Earthquake Data Logger
Basically, I was just sitting on the carpet under my desk, but there does not seem to be very useful results - I'm not entirely sure where the best place would be to detect the device. It ended up sitting on a window sill and I just hope it was not knocked around by other people in the office.

Since I am not WiFly module is used to log in to each data point, I did not have an easy way to get the current time. A lock for a time sufficient to get a GPS signal, but at first I could have been able to confirm how well the device will not work. I just kiss and took the option to reset the random number recorded in the past. (If I were more organized, I have noted over the beginning of time, so that I could not count the points, but apparently I did not.)

Once I was connected to everything to keep running until I decided to do the next step. At this stage one or two weeks from memory by the aftershocks were excluded from a lot.

Finally, there was a noticeable aftershocks and the next I was in the office when I took a look at the data. There was not really much to see. Even when there was an earthquake sensor values will be within a couple of swing and there was no significant outliers. This was a good alternative to the window sill when I decided to try out.

Almost 4.7 and 4.9 magnitude - nearly a week later, the first one after another after the Sunday morning there was an aftershock to the day. I happened to be sitting at the outside of an armchair and shock was noteworthy for a number of seconds. Near the beginning of the post (and, yes, I checked it was one rocking armchair.) GeoNet shows how images of their seismographs record the special vibration.

Data processing

It turns out a lot of information, but generates almost twenty samples per second recording. In fact, nearly five million rows of data in the log files for about a week's worth. Given that your average spreadsheet few tens of thousands of rows I need to find different ways of processing the data at the tops. I tried a few different software packages but did not have much success.

I Python command-line tools (cut, sort and uniq) using a combination of an initial summary of the last generation:
X-axis
ADC Value 323 324 325 326 327 328 329
Occurrences 1 1 4,024 3,065,147 1,958,420 20 4

Y-axis
ADC Value 333  334  335 336  337
Occurrences  1  74,472  4,582,727 370,414 3

Z-axis
ADC Value 389  401  402  403 404 405 406 407
Occurrences  1  1  314  257,404 4,073,165 696,663  67 2
Apart from a couple of outliers, my six standard data logger to a range of 401 ~ 407, a 4.9-magnitude earthquake was recorded for the z- axis. Underwhelming, to say the least. In both cases, something did not work or something was wrong in my understanding. Time to read some more.

After reading some more and some calculations of the value each time it is changed by less than one percent represents a fraction of the force of gravity turns out. Once I discovered that I then "peak acceleration" and some sites with more information about the relationship between MMI scales were found. 1-2% of the shaking is noteworthy that the acceleration of gravity point ( "strong motion") is apparently in. 3.9% Gravity - I see the value of 4.0-4.9, the intensity level was consistent with the third-fourth or 1.4.

We are successfully detecting earthquakes. It was not just a very impressive number.

Results are displayed

After massaging the data into a spreadsheet in my most intense activity (about 5 seconds) to graph the results for the period under all their awesome glory:

Plot of raw ADC value for each axis over ~5s time (yellow = z, red = y, blue = x)
Earthquake Data Logger
Earthquake Data Logger
Plot of relative ADC value for z axis over ~5s time
Earthquake Data Logger
Earthquake Data Logger
If there is a successful result is underwhelming!

I do differently next time?
I'm probably in a narrow range with a high-resolution range of an accelerometer, which means I want to try to be. Accelerometer and Gyro Buying Guide a number of options in the range of +/- 2g or +/- 1G, which is (hopefully!) Will not be more than enough for any aftershocks. This means that small movements could not be identified.

I improve the resolution to restrict the values from 0 to 3.3V Arduino Aref would like to take advantage of the best functionality of the existing range.

Another option is a high-resolution ADC will be considered one of the inbuilt, but to a point where (especially this is all on a breadboard) to increase the resolution will be obscured by the noise.

I have an accurate time stamp on each sample would have to find a way to work.

Your Turn!
What are you trying to record a natural phenomenon, like an earthquake?
You can create huge amounts of data in a project like this, how will the process?
I'm not a geologist or log in projects I have developed a lot of information, how to write up the project developed or have suggestions?
With less than spectacular results in a project to share your own story?
Tell us in the comments ...





Breadboard Power Supply Kit 5V/3.3V Quickstart Guide

Short Description:
Breadboard Power Supply Kit 3.3Volts your breadboard projects are easily controlled by a selectable voltage to 5 volts, or be able to access. It's like the one that took power through a DC wall wart. DC barrel connector instead of providing a stripped +/- can be attached if desired. This guide Everything you need help to get started with breadboard power supply.


Triple-axis magnetometer - HMC5883L breakout Quickstart Guide

Short Description:
This Honeywell's HMC5883L, a breakout board for a 3-axis magnetometer. There are a wide range of uses magnetometers. The most common side affect of using a digital compass chip, or use them as a ferrous (magnetic) metal detection included.




Triple-axis magnetometer - HMC5883L breakout Quickstart Guide
Triple Axis Magnetometer Breakout - HMC5883L
Requirements:
This breakout board can be fitted to a number of microcontroller, as long as they have an i2c interface. However, following this guide you will find helpful:
  • arduino Uno
  • breadboard
  • Soldering iron
  • Solder
  • Male header or other connection methods
  • (Optional) needle nose pliers
  • (Optional) Third Hand
How it works:
Go hand-in-hand magnetic field and current. When current flows through a wire, a magnetic field is created. This is the basic principle behind electromagnetic. It is also used to measure the magnetic field with a magnetometer policy. The sensor in the direction of Earth's magnetic field affects the flow of electrons, and the change in the measurement and calculation of a compass heading, or other useful information can be extracted.

How to use it:
So if you use these chips with your Arduino is ready to start? Well, lucky for you, we have everything you need to get your project rolling.

Hardware:
First, we have some breakout boards solder on the header so it will fit into a breadboard. Welding for advice, this tutorial is helpful.

Breakout Board HMC5883 sensor and all filtering capacitors are required. Two unmanned pad in case you (you Arduino / ATmega328 is no need for them to use), pull-up resistors are required.

HMC5883 is easy to communicate with, and all done through a i2c interface. We will go into this in more detail momentarily. All you need to know for now is how the wire. A4 to A5 of the SDA and SCL lines connected to the line. 3.3V to Vcc and GND are also connected to GND. 
Triple Axis Magnetometer Breakout - HMC5883L
Triple Axis Magnetometer Breakout - HMC5883L
Software:
If you have not done so already, please download and install Arduino IDE.

Firmware:
The language speaks of a kind of funky HMC5883L serial i2c. A clock (SCL) for one and one for data (SDA) - i2c communication requires only two wires. You are probably aware that the two pins used for something else (except maybe another i2c device, you want to get cute) should be avoided. Do not try to use the analog input as they!
Triple Axis Magnetometer Breakout - HMC5883L
Triple Axis Magnetometer Breakout - HMC5883L
For example, we have the Arduino code, HMC5883.pde, continuous use i2c axis magnetometer to search for each of the data from the magnetometer. If you need help uploading your Arduino sketch is from, then there are plenty of helpful information on their sites.

Let's take a look at the first part of the code:
#include <Wire.h> //I2C Arduino Library
#define address 0x1E //0011110b, I2C 7bit address of HMC5883
void setup(){
  //Initialize Serial and I2C communications
  Serial.begin(9600);
  Wire.begin();
  
  //Put the HMC5883 IC into the correct operating mode
  Wire.beginTransmission(address); //open communication with HMC5883
  Wire.send(0x02); //select mode register
  Wire.send(0x00); //continuous measurement mode
  Wire.endTransmission();
}
Code that setup () function is run once in the beginning. It is the beginning of serial communication at 9600 baud. We use serial communication to send information back to the computer for each axis. I2c also is initialized. We then HMC5883L a "write" operation. The 'write' operation mode continuous operation objective is to adjust the value of the register configuration HMC5883L tell it. Our continuing to search for the information in this axis. By default, the single-chip once it is read from the read mode means that it will idle to save power. Once lazy, we can read it in writing before it is turned on again. In addition to the registration contains all the information about the datasheet and other useful information. Of course, we always encourage people to RTFM ... Just look at the datasheet ...

Moving on, here's where we request and receive data:
void loop(){
  
  int x,y,z; //triple axis data
  //Tell the HMC5883L where to begin reading data
  Wire.beginTransmission(address);
  Wire.send(0x03); //select register 3, X MSB register
  Wire.endTransmission();
  
 //Read data from each axis, 2 registers per axis
 
  Wire.requestFrom(address, 6);
  if(6<=Wire.available()){
    x = Wire.receive()<<8; //X msb
    x |= Wire.receive(); //X lsb
    z = Wire.receive()<<8; //Z msb
    z |= Wire.receive(); //Z lsb
    y = Wire.receive()<<8; //Y msb
    y |= Wire.receive(); //Y lsb
  }
  
  //Print out values of each axis
  Serial.print("x: ");
  Serial.print(x);
  Serial.print(" y: ");
  Serial.print(y);
  Serial.print(" z: ");
  Serial.println(z);
  
  delay(250);
}
Loop () function will run over and over again as long as the board has power. Every time, we have to write a quick read data for the axis where we want to start. 3. Registration will be selected and the X-axis is the most significant bytes. We're asked to read one after another 6 bytes. Automatic increase in the number of chips that we are reading from the book itself, so we have to register before each election, we will not fall from it. X, Y and Z axis data is then sent back to the computer in order. You Arduino development environment, as shown below: Serial Monitor can use this value.

Triple Axis Magnetometer Breakout - HMC5883L
Triple Axis Magnetometer Breakout - HMC5883L
All you need now to use this information in your next project will be a creative idea. Always feel free to share with us, it just might end up Sparkfun's homepage!
Resources:
  • Designed
  • HMC5883L datasheet
  • arduino code
  • Example C Code (ATmega328)
  • Digital compass How-To Videos
Conclusion:
Enjoy your new magnetometer! If you have any problems, feel free to contact technical support Take support@sparkfun.com SparkFun