Embedded Systems Pic Microcontroller Project

Discussion in 'Homework Help' started by misteree1, Apr 17, 2019.

  1. misteree1

    Thread Starter New Member

    Apr 17, 2019
    Hey everybody, I am fairly new to embedded systems and hardware design. For my embedded systems final project I would like to create a 7-button "piano" using a Curiosity development board and a PIC16F1709 uC. I had several questions that I hope somebody may be able to answer.

    Hardware already purchased:
    Curiosity development board w/ PIC16F1709
    8 ohm 1W piezo speaker

    1) Will the PIC16F have enough space for inputs/outputs for 7 buttons, a speaker, volume control (potentially handled with the Curiosity onboard potentiometer) mode switch button, and a button for entering a higher octave of notes?
    2) What other hardware will need to be purchased? Will I need op amps to amplify the voltage going into the speaker/How does one go about determining the op amp necessary for amplification?
    3)I'd also like to add a feature for playing 1-3 preset tunes from memory... will this uC be sufficient for storing the necessary information needed to play the preset tunes?

    Any other pertinent information that I might need?

    Appreciate the help, I'm an absolute noob at this stuff so any help is appreciated.
  2. WBahn


    Mar 31, 2012
    MOD NOTE: Moved to Homework Help.
  3. JohnInTX


    Jun 26, 2012
    The Curiosity board should be OK to do that. To answer your questions, think about each part.

    I count 11 IO. Take a look at the 16F1709 datasheet and the Curiosity schematic and assign pins. Digital inputs are easy, the sound might be good using a PWM output. Not sure about the volume control.. Anyway, I counted and it looks OK to me.
    Depends on how much sound you want to get. The PIC will drive a piezo speaker. You can also look into using one of the gazillion amplifier circuits available.. Maybe start with an LM386.
    Sure, if you're a halfway decent coder. A tune can be considered a series of notes and quiets with a duration for each. Store the tune elements in arrays or some other list structure and traverse to play the tune.

    If you are going to use XC8 and MPLABX, consider using MCC to configure the chip IO and peripheral functions.

    To start, write a spec that says what the system is to do. Then rough out the hardware making a block diagram of each function and show how it hooks to the PIC. Using that, start thinking about how you would organize (not code yet) the program. Break that down into smaller parts. You'll need to detect keys, generate a tone, etc. Draw a flow diagram for each function and trace it out in your head to see if it makes sense. As you go, drill down into the details. You'll have a box called 'generate tone'. How are you going to do that? The PWM will generate square waves at various frequencies and duty cycles but it sounds bad.. Maybe you use the PWM to generate sine-waves - that's not as straightforward but it sounds better. Maybe you can generate the tones with DDS (direct digital synthesis) techniques by using the on board DAC. Experiment and see what blows your dress up.

    But yeah, the Curiosity with a 1709 should be enough. It's a nice little package when you run under MPLABX. Be SURE to spend a few early minutes learning how the debug function works.

    Post your initial design and we can help from there
    Have fun!