Tutorial 1 and Step 4 on Basic Input for Intel® Galileo Boards

Documentation

Install & Setup

000006320

09/17/2020

Step 1: Power up

Using the red and blue vertical strips on the breadboard, connect any two jumper cables from the breadboard's first or last row to the Galileo; this will free up space on the breadboard for prototyping. Use the set of pins that are below the Intel® Galileo Board logo.

Connect the negative (blue vertical strip) to one of the two GND headers on the board.

Carefully connect the positive (red vertical strip) to the 5 V header pin.

Step 2: Power the sound sensor

Connect two wires from the microphone's PWR and GND pins to the breadboard. Typically on sensors, red wires are for voltage, black is for ground, and the last one is for programmatic communication to and from the sensor.
Connect two other wires from the microphone sensor to the vertical tracks on the breadboard that are associated with PWR and GND.

Step 3: Prepare breadboard for communication with microphone

The middle section of the breadboard distributes an incoming signal horizontally. Connect a jumper cable from the remaining header on the sensor to one of the inner columns of the breadboard.

Using another wire, connect it from the same row to the input pin labeled A0.

Galileo board and connected wireless breadboard

The microphone sensor is powered by the vertical strips. It is programmatically accessible using one of the middle of the breadboard's horizontal track.

Note

In order to get input values from the microphone, we'll use an analog pin 0, which is referred to in code as A0. Using a function called analogRead, we're able to return a value from 0 to 1023, where 0 is 0 volts and 1023 is 5 volts.

Why a max value of 1023?
Intel Galileo Board's features the AD7298 chip, which is a 10-bit analog-to-digital converter. Using a base-2 numeral system (binary), we get 210 = 1024. In computer science, number sequences begin with zero, hence a max value of 1023.

Step 4: Seeing sound

Once all of the jumper cables are properly connected, carefully plug in the power cable to the Intel Galileo Board. Then connect the microUSB cable to your computer. If it's not already open, open the Arduino program.

Upload the following code to your Intel Galileo Board to run the sketch:

// Declare and assign an integer variable that stores the pin of the microphone sensor
int pin_sound = A0;
// Declare an integer variable that will store the sound sample from the microphone
int sound_sample;
void setup() {
// Begin serial communication at 57600 bits per second.
Serial.begin(57600);
}
void loop() {
// Assign the current sound reading sound_sample
sound_sample = analogRead(pin_sound);
// Print the sound sample to the serial monitor
Serial.println(sound_sample);
}

The word Serial is used to communicate with the microUSB port that is connected to the Intel Galileo Board. It has a function (referred to as a method of Serial) called begin. It uses a baud connection of 57600 bits per second.

In order to see what's going on behind the scenes, speak into the microphone, and open up the serial monitor by clicking on the top right of the UI:

Serial monitor

An array of values that represent realtime sound samples coming from the microphone.

As the microphone receives input, you'll notice a change in the output on the Serial Monitor.

The Serial Monitor is used for displaying data between devices. In the setup function, there is a call to a function called Serial.begin. A value of 57600 is passed to this function. This number represents the bits-per-second (baud) that is communicated between the Arduino and the host computer. On the serial monitor, if you're listening to a different baud rate (other than 57600), you may see some funny looking characters that make no sense. Make sure you set it to 57600 baud.

Not seeing anything?

  • Are you set to the correct baud rate?
  • Double-check all of your cable connections. Follow each wire from the breadboard to the Arduino and make sure everything is connected correctly.