PIC32 Project: Speech Synthesis with SAM TTS

Sometimes it is necessary to add low cost audio to your project. While playing a WAV file would produce high quality, sometimes it is necessary to have a low cost way to add audio to your project. Sensors, low cost robots or toys may require a low cost way to add audio to the project. Text To Speech or TTS is one way to provide feedback to users of your embedded device. While there are TTS modules on the market for embedded applications, they are sometimes hard to obtain or expensive. In this example we demonstrate the use of the Software Automatic Mouth (SAM) TTS program with the PIC32MX270F256D microcontroller.

Continue reading “PIC32 Project: Speech Synthesis with SAM TTS”

Starting with 32-bit PIC Microcontrollers Part 20: SSD1306 OLED

Organic Light Emitting Diode (OLED) displays are nice displays for embedded systems because they do not require a backlight to operate and have a sharp crisp display. The SSD1306 OLED is a popular display used in embedded systems projects today because it uses the I2C protocol and unlike the industry standard HD77480 they do not require as much space or I/O lines. In this example we interface the PIC32Mx270F256D to a SSD1306 OLED.

Continue reading “Starting with 32-bit PIC Microcontrollers Part 20: SSD1306 OLED”

Starting with 32-bit PIC Microcontrollers Part 19: One Wire Protocol

We examined the 3-wire SPI protocol and the 2-wire I2C protocol. The next protocol we will look at is the One Wire (OW) protocol. The One Wire protocol developed by Maxim is a protocol which uses only one wire for communication with devices on the bus. In this post we will look at the One Wire Protocol and use it to read and write to a temperature sensor.

Continue reading “Starting with 32-bit PIC Microcontrollers Part 19: One Wire Protocol”

Starting with 32-bit PIC Microcontrollers Part 17: SD Card

The on board USB module on the PIC microcontroller is very powerful able to function as both a device and host and is excellent for data logging applications. However sometimes you require a little higher transfer speed in your embedded application. For that reason we may need to use an SD card. SD cards are used to store data for your embedded system and are compact and robust little devices that function at very high speed. In this post we look at writing a text file to an SD card.

Continue reading “Starting with 32-bit PIC Microcontrollers Part 17: SD Card”

Starting with 32-bit PIC Microcontrollers Part 16 – USB Host

USB is a ubiquitous protocol in modern computing. There are many applications where we may need to use a USB Flash drive to store and read data. The PIC32MX270F256D includes an embedded USB host and in this example we interface the PIC32 to a USB flash drive and write a text file to it. This can be used for embedded data logging applications.

Continue reading “Starting with 32-bit PIC Microcontrollers Part 16 – USB Host”

Starting with 32-bit PIC Microcontrollers Part 15: DMA

Sometimes you need to increase data throughout in your application. Interrupts are powerful things that allow you to have a lot of control over what is done when, but there is a problem with interrupts. Even the fastest interrupt gives some latency in execution. This is especially noticeable during data transfer and that is the purpose of the DMA controller. It can transfer data from  memory to peripherals or memory to memory without CPU intervention. In this post we will look at using the DMA controller on board the PIC32MX270F256D.

Continue reading “Starting with 32-bit PIC Microcontrollers Part 15: DMA”

Starting with 32-bit PIC Microcontrollers Part 14: Watchdog Timer

There are sometimes when your program is executing and for whatever reason it fails to operate as intended and causes the program to behave erratically or the CPU may get stuck in an infinite loop for example. In such cases it may be necessary to reset the microcontroller. However there are situations where this is not possible for example on the Mars rover or a pacemaker, where human intervention is not possible or improper operation can cause loss of life or death. In such cases it is necessary to have some way of resetting the microcontroller autonomously. That is the purpose of the watchdog timer and in this post we use the timer on board the PIC32MX270F256D microcontroller.

Continue reading “Starting with 32-bit PIC Microcontrollers Part 14: Watchdog Timer”

Starting with 32-bit PIC Microcontrollers Part 13: IDLE and SLEEP

Microcontrollers excel at one thing and that thing is computing on a power budget. Microcontrollers are many times battery operated devices and for that reason it is sometimes necessary to have mechanisms to reduce power consumption. While reducing the clock speed or the CPU and peripherals is one way to reduce power consumption the PIC32 includes two power saving modes which are the IDLE mode and the SLEEP mode to reduce power consumption. In this post we use the PIC32MX270F256D in IDLE and SLEEP modes.

Continue reading “Starting with 32-bit PIC Microcontrollers Part 13: IDLE and SLEEP”

Starting with 32-bit PIC Microcontrollers Part 11: I2C

I2C is the protocol that we will look at in this post. Since I2C was created by Phillips in the 80’s it has found extensive use in microcontroller based systems. This is because the I2C module only requires two lines to communicate so it is versatile and can be used to allow a master to communicate with a lot of devices.  I2C can be used with displays, sensors, actuators and a host of other devices.

Continue reading “Starting with 32-bit PIC Microcontrollers Part 11: I2C”

Starting with 32-bit PIC Microcontrollers Part 9: Input Capture

In the last post we looked at the output compare module being used to generate a PWM signal. In this post we will look at using the input capture module on the PIC32. The input capture module is used for reading digital signals and measuring events via the pin it is connected. Thus the Input Capture Module can be used for measuring PWM signals and has applications in motor control.

Continue reading “Starting with 32-bit PIC Microcontrollers Part 9: Input Capture”

Starting with 32-bit PIC Microcontrollers Part 8: Output Compare

The PIC microcontroller contains a module known as the Output Compare module which is used to generate Pulse Width Modulation signals. The Output Capture or OC module generates pulses using the timer and outputs those pulses on the microcontroller pin. The most common use of the Output Compare module is to generate PWM signals which we will explore in the post.

Continue reading “Starting with 32-bit PIC Microcontrollers Part 8: Output Compare”

Starting with 32-bit PIC Microcontrollers Part 7: ADC

In this post we will look at analog to digital conversion or ADC on the PIC32 microcontroller. The data in our world exists in analog format, however computers are digital by nature. What this means is that to allow the microcontroller to interact with our world we must use an Analog to Digital Converter. The ADC has countless uses and in this example we will look at using the ADC module on the PIC32MX270F256D.

Continue reading “Starting with 32-bit PIC Microcontrollers Part 7: ADC”