Lab 1

The Artemis board

0. Objective

Get familiar with the Arduino IDE and the Artemis board, blink the LED, read/write serial messages over USB, display the output from the onboard temperature sensor, and measure the loudest frequency recorded by the Pulse Density Microphone.

1. Download and Install the Arduino IDE

I had the Arduino IDE installed before and updated to 1.8.19 version.

2. Hook the Artemis board up to a computer

Before plug into to my PC, I noticed this board is running in +3.3V, but the USB output voltage is +5V. This concern solved by located board Eagle Files, the below picture shows there is a power source selector on the board, both USB and battery input are fed to VIN, and VIN connects to a 3.3V regulator to provide correct voltage to the Artemis Nano board.

When I plug the Artemis Nano board, the operating system does not recognize this hardware, by looking up the Hookup Guide, I found the CH340 Drivers. After installing the required drivers, the Arduino IDE is able to detect the correct COM ports.

This part is pretty easy, just load the sample code and upload to the Artemis Nano board. I use baud rate 460800. Below video shows the internal blue LED flashing in 0.5Hz. Click here if the video does not show.

4. Serial

Simple as the previous, load the sample code and upload to the board. Need to be careful set the baud rate to 115200. Once upload to the board, use Tools-->Serial Monitor to send and view messages. Click here if the video does not show.

5. Analog Read

This example shows how to read analog data. First, load the example file, on my Arduino IDE, it locates at Files-->Examples-->Example02_AnalogRead. Then choose it and upload to the board. On line #56, 57 and 58 shows how to retrieve analog data;

1
2
3
int vcc_3 = analogReadVCCDiv3();    // reads VCC across a 1/3 voltage divider
int vss = analogReadVSS();          // ideally 0
int temp_raw = analogReadTemp();    // raw ADC counts from die temperature sensor

on line #60, the code shows “computed die temperature in deg F”.

1
float temp_f = getTempDegF();       // computed die temperature in deg F

Open the serial monitor, we can see temp, VCC and VSS data updates in millisecond. To test it, I put mu thumb onto the board to makes it warm, and the temp value jumps from 33872 to 34232. Click here if the video does not show.

6. Microphone Output

In this example, load the example file located at File-->Examples-->PDM-->Example1_MicrophoneOutput then upload to the board. The Artemis Nano board is using a Pluse-Density Modulation microphone. Open the serial monitor, it continuously shows the loudest frequency currently captured. One thing I noticed, when my environment is silent, the serial monitor shows the loudest frequency is around 20015 Hz

To test, I use my iPhone app to generate serval different frequencies, and finally I use my PC to generate a 16kHz sound, it seems this PDM microphone is pretty precise. Click here if the video does not show.

7. Additional Task

Here is my solution for this special task. First, I need to light up the LED, so inside the setup function, I add the following.

1
pinMode(LED_BUILTIN, OUTPUT);

Second, I need to determine when to turn on the LED and turn it off. By testing multiple times, I found out the whistle sound is around 2000~3000 Hz. Then I goes into printLoudest function, and at the end of this function, I add a return statement inorder to return the current frequency.

1
return ui32LoudestFrequency;

Also, I need to modify the function definition to specify the type of my return value.

1
uint32_t printLoudest(void)

In the loop function, I use a variable called freq to save the current frequency value that returns from the printLoudest.

1
uint32_t freq = printLoudest();

Finally, use the if-else statement to see if the current frequency is between 2000~3000 Hz, turn on the LED if so, otherwise turn it off.

1
2
3
4
if(freq >= 2000 && freq <= 3000)
  digitalWrite(LED_BUILTIN, HIGH);
else
  digitalWrite(LED_BUILTIN, LOW);

Click here if the video does not show.