MOBILE HOME Technical Tips  

SD/SDHC CARD SOUND RECORDER
For SD with PETIT FAT File System see SD Bitmap project
For sound playback with EEPROM see Doorbell

Updated on 30.6.2015
The PIC16F876A's ADC
digitizes the sound and store it in the SD or SDHC card. The firmware works for SD or SDHC cards only, for old SD (before 2009) use ver1 firmware. Do not use SDXC cards with this project because some of them work on 1.8V drive. The code detects whether the card is SD or SDHC and selects the proper addressing system for the card.
The PIC's CCP is used as a DAC to convert the digital data back to audio. The sound is converted to 20KHz 8 bits mono in a format similar to .wav files. The quality of the audio is reasonable.
SD card interface the PIC in SPI mode. Reading and writing data is in multi-blocks. Memory is used at the rate of 20KB/s. The Error LED indicates error sent by the SD card. The software doesn't use any file system, it just uses absolute memory addresses (raw). Since the programme is less than 680 bytes there is much resources left for adding features.
Audio input is 1Vp-p , you can use the mic circuit or other source. The CCP in PWM mode gives 20KHz wave with duty cycle modulated to the audio amplitude. A low pass filter removes the 20KHz component. I added a simple 2 transistors amplifier to boost the power to drive 32 Ohm speaker or headphones.

SD/SDHC CARD SOUND RECORDER FOR ARDUINO

A sound recorder project for Arduino Uno with ATMEGA328P device.
The firmware works for SD or SDHC cards only. Do not use SDXC cards with this project because some of them work on 1.8V drive. The code detects whether the card is SD or SDHC and selects the proper addressing system for the card. The quality of the audio is reasonable.
The ADC converts the sound to 20KHz 8 bits mono in a format similar to .wav files. Timer0 in Fast PWM mode is used as a DAC to convert the digital data back to audio. During recording the ADC converts the audio to 10 bits, the low byte is streamed to the SD card. The 0.65V bias to the ADC input is for setting the signal to the low byte of the converter output.
SD card interfaces the microcontroller in SPI mode. Reading and writing data is in multi-blocks. Memory is used at the rate of 20KB/s. The Error LED indicates error of communication with the SD card. The software doesn't use any file system, it uses absolute memory addresses (raw).
Audio input is 1Vp-p , you can use the mic circuit or another source. The PWM gives 64KHz wave with duty cycle modulated to the audio amplitude. A low pass filter removes the 64KHz component. I added a simple 2 transistors amplifier to boost the power to drive 32 Ohm speaker or headphones.
Circuit diagram
You are free to use the circuit diagram and software with no limitations.

SD/SDHC CARD FAT32 WAV PLAYER PIC16F876A

This project is for .wav file type player (no recording). The software has the functions needed to read SD/SDHC card formatted in FAT32. The software can play only PCM 22.050KHz, 8 bits, mono. The bytes from the file are streamed to CCP1 (PWM mode) and with an external low pass filter you get the audio. The sound quality is OK for speech or medium quality music.
The software searches for files entries in the root directory only, it streams any file type without reading its name or type.
The circuit diagram is the same as the SD Sound Recorder minus the components for recording. Drawing is included with the software zip.
TO SET UP THE CARD:
Format the card with FAT32.
Create sound files type .wav
Name the files with short names, 8 low case characters max.
Save the files as 22.050KHz, 8 bits, mono.
Add the files to the root directory of the card (don't use a subdirectory).

SD/SDHC CARD SOUND RECORDER 3.3V PIC16F690

This sound recorder has the same characteristics as the sound recorder with PIC16F876A. The difference is the supply voltage is 3.3V. This makes the direct drive of the SD card simpler. It also makes it easier to power it from a battery.
8MHz internal oscillator is used, if the frequency drifts it causes the playback to change speed. I left pins 2 and 3 free in case I have to use crystal oscillator.
The programming of the pic can be with 3.3V, if you have a pic programmer for 5V only remove the SD card while 5V is connected to the circuit, 5V will damage the SD card.

SD/SDHC CARD FAT32 WAVE PLAYER 3.3V PIC16F690

This wave player has the same characteristics as the wave player with PIC16F876A. The difference is the supply voltage is 3.3V. This makes the direct drive of the SD card simpler. It also makes it easier to power it from a battery.
The playback speed can be changed by changing the time of TMR0 in the code.
The programming of the pic can be with 3.3V, if you have a pic programmer for 5V only remove the SD card while 5V is connected to the circuit, 5V will damage the SD card.

Troubleshooting:
If the Error LED is on immediately on power up it means that the card failed to initialize. This code works for SD card rev 2 or SDHC card, it doesn't work for SDXC (1.8V) or MMC or SD rev 1 cards. If your card is SD rev 1 you can use my firmware ver 1.
For a successful recording a sector (512 Bytes) has to be writen in 20ms, some old SD cards may be too slow writing data to the flash memory, in such case the error LED comes on. Try another make of card.

More about FAT32 in this document: https://staff.washington.edu/dittrich/misc/fatgen103.pdf
More about WAV in here: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
Good free specifications for SD can be found in SanDisk PDF: http://alumni.cs.ucr.edu/~amitra/sdcard/ProdManualSDCardv1.9.pdf
PIC C source code. You are free to use the circuit diagram and software with no limitations.

Circuit Description
See also Technical Tips

PIC supply is 3.3V. The SD Card supply must be 3-3.6V.
Audio input at pin 8 is 0.8Vp-p max. Voltage over 3.3Vp-p can damage the PIC input protection. 22K,47K and 10K bias input to 0.413V DC input which is the middle range of the ADC to give 8 bits.
One option is to boost the pic output by the Simple Headphones Amp. You can use a 32 Ohm speaker. For use with another amplifier connect via the lowpass filter.
Stop, Rec, Pause and Play are pushbuttons.

Circuit Description
See also Technical Tips

PIC supply is 5V. The SD Card supply is only 3.3V (3-3.6V) The 3.3V is generated by dropping the 5V with 2 diodes.
Audio input at pin 2 is 1Vp-p max. Voltage over 2Vp-p can damage the PIC input protection. 100K and 12K resistors give 0.6V DC input which is the middle of 1.25V range of the ADC.
One option is to boost the pic output by the Simple Headphones Amp. You can use a 32 Ohm speaker. For use with another amplifier connect via the lowpass filter.
Pin 1 is the PIC's reset.
22pF capacitors may need to be changed depending on the type of crystal used.
Digital outputs from the PIC to the SD card use 1K and 2K resistors to reduce the 5V signals to 3.3V. SD output at pin 7 is 3.3V but is enough to drive the PIC's input.
Stop, Rec, Pause and Play are pushbuttons.


Circuit Description
See also Technical Tips

The ground, 3.3V and 5V are sourced by the arduino board.
AREF pin on IOH connector is connected to 5V to supply the ADC Vref.
22K 47K and 10K give the audio input 0.62V DC bias to set the ADC to the low 8 bits.
1K and 2K resistors at the inputs to the SD are to reduce the 5V signals to 3.3V signals. MISO card output is only 3.3V but it is ok for the 5V input of the AMD.
The card's pins number are for standard size SD, for Micro SD the pins are different.
Audio output can use output filters as the drawing above. For microphone you can use the simple amp above.





Name:

Comments and questions

Copy the number from the picture It stops net-robots from adding comments.



10.07.2017 - 20:34
Name: Miguel
Comment: Excelente diseño y muy útil.

20.05.2017 - 02:39
Name: Moty
Comment: Hi Djalltra, Thanks for the reply. I got it wrong too and that must have been the reason for you to miss the connection. I've corrected the drawing by connecting AREF to 5V. Have fun.

19.05.2017 - 19:05
Name: djalltra
Comment: hi moty I finally got the arduino version working my problem was I forgot to connect aref pin to vcc pin is 5v supply it now works like a charm thanks a lot for your support moty

16.05.2017 - 06:45
Name: djalltra
Comment: OK I really did not use the arduino I only took a raw atmega328p chip n loaded the hex to the chip I reprogrammed the fuses to use external oscillator

16.05.2017 - 05:21
Name: djalltra
Comment: OK I really did not use the arduino I only took a raw atmega328p chip n loaded the hex to the chip I reprogrammed the fuses to use external oscillator

15.05.2017 - 22:31
Name: Moty
Comment: The atmega must have the arduino bootloader burnt to the ROM because only the bootloader programs the fuses.

15.05.2017 - 19:43
Name: djalltra
Comment: in addition when I first power the circuit I hear a high frequency sound of about 7khz when I press play it vanishes. I am using an SD card module with an on board 3.3v regulator could this be the problem because the led seems to go of as expected an I can always see space being consumed after recording the problem is from the play side I chose to build this on a Vero board instead of using an Arduino board

15.05.2017 - 19:36
Name: djalltra
Comment: hi moty after hooking up the arduino pin 12 to an oscilloscope when I press record button it consumes some space in the SD card but when I press play the output goes high to about 4.3v then I see a frequency of about 7.3khz I am still unable to get any sound I connected the low pass filter and still no results can you please upload ur hex file so that I can try it I has tripple checked all my connections thank you

15.05.2017 - 00:27
Name: Moty
Comment: Someone already left a comment saying that he used 16f877.

14.05.2017 - 14:32
Name: flex
Comment: hi moty i want to please ask if i can use pic16f877a with pic 16f876 coz its the one i have available to me n they r also very similar

13.05.2017 - 17:01
Name: Djalltra
Comment: ok thank you for your response i would get back to you i would also love if you could do tutorials on reading and writing on sd card usung fat and fat32 file system .

13.05.2017 - 16:36
Name: Djalltra
Comment: ok thank you for your response i would get back to you i would also love if you could do tutorials on reading and writing on sd card usung fat and fat32 file system .

13.05.2017 - 15:41
Name: Moty
Comment: The atmega is 16 MHz. Check with your oscilloscope that the output at pin 12 is 64 KHz with varying duty cycle during playback.

13.05.2017 - 11:40
Name: Djalltra
Comment: what conciliator frequency is the atmega328p running at because i am using 16mhz external oscillator i am able to see some space consumed in the sdcard(2gb) but is dosent play any sound

13.05.2017 - 10:27
Name: Djalltra
Comment: ok thank you very much using the atmega328 version i purchased a 4gb sdhc sd card and when i record i just hear some noise at the speaker but not the recorded sound

12.05.2017 - 18:59
Name: Moty
Comment: None of these projects can write a *.wav file. You will see nothing on a computer because the recording doesn't use a file system. You can only record and listen to the recording on the project circuit. The initialization code doesn't work with every card, I don't have the knowledge and ability to test the code on many cards. I use cheap cards that I bought on ebay.

12.05.2017 - 14:26
Name: Djalltra
Comment: also in addition i am using a 2gb micro sd card with the adapter,i dont know if the problem if form the type of card itself i even built the version with the pic16f690 version all it does is the error led just keeps showing up.

12.05.2017 - 14:20
Name: djalltra
Comment: ok thank you for your response i was able to initialise the sd card i.e the error led goes off but i am also encountering another problem,it does not record when i press the record button the record led commes on but its not recording any sound i checked my mic amp circuit with my ossciloscope at the pin and it seems to be working fine isnt the circuit record and create a wav file in the sd card? when i check i see no wav file in the card thank you

12.05.2017 - 02:46
Name: Moty
Comment: Hi Djalltra, The card works with any format. Make sure the card is SD or SDHC 1GB-32GB. Make sure your card gets 3.3V supply.

07.05.2017 - 03:05
Name: djalltra
Comment: hi moty i built the arduino version but the error led keeps coming on i am using an sd card adapter i purchased from ebay and please in what format am i to format the sd card fat16 or fat32

13.02.2017 - 13:36
Name: NIHAL
Comment: moty from which website we should buy electri component

13.02.2017 - 03:05
Name: NIHAL
Comment: moty can you make USB audio player

13.02.2017 - 03:02
Name: NIHAL
Comment: moty can you make USB sound recorder

12.02.2017 - 14:34
Name: n
Comment: moty your of which country and can I got your phone number

12.02.2017 - 12:47
Name: Moty
Comment: Buy adapter like this one, and you will have 9 pins like in the circuit. http://www.ebay.co.uk/itm/SANDISK-MICRO-SD-to-SDHC-MEMORY-CARD-ADAPTOR-ADAPTER-CONVERTER-x1-/201638681445?hash=item2ef29a1b65:g:DTMAAOSwnQhXoxPd

12.02.2017 - 09:00
Name: NIHAL
Comment: moty your of which country and can I got your phone number

12.02.2017 - 03:30
Name: NIHAL
Comment: I won't to say that in this page is did not find anything about convert

12.02.2017 - 03:28
Name: NIHAL
Comment: sorry my English is not good

12.02.2017 - 03:13
Name: NIHAL
Comment: sorry india in this page

12.02.2017 - 03:10
Name: NIHAL
Comment: in this page is did not find anything about convert

12.02.2017 - 03:08
Name: NIHAL
Comment: moty in india did not find anything about convert

11.02.2017 - 16:55
Name: Moty
Comment: Hi Nihal, It will work on 8 pins card (Micro SD). Look at this page to see how to convert from 8 pins t0 9 pins. http://www.interfacebus.com/MicroSD_Card_Pinout.html

11.02.2017 - 15:22
Name: NIHAL
Comment: hi moty it is a good circuit but in my sd there is 8 pins instead of 9 pin can I make it with 8 pin

11.02.2017 - 12:33
Name: NIHAL SINGH
Comment: Hello friend these is good circuit but I have one question that in my sd there is 8 pin I can make with 8 pin

25.12.2016 - 16:41
Name: Moty
Comment: The ADC is only 10 bits.

25.12.2016 - 03:15
Name: Dushu Warsom
Comment: hello friend. I tried these circuit but i have one question? Can i modify it to have at least 16bit and 48kHz recording? if so, how? please tell me.. Thanks

02.12.2016 - 12:52
Name: Moty
Comment: For speed, in the code of 16f690 line 146 TMR0=165, try TMR0=166. In the 16f876 code line61 change it to CCPR2L=90 About 2 seconds noise, I can't guess the reason. Try another SD or try format the SD again and load the songs one at a time.

01.12.2016 - 22:09
Name: Jaap
Comment: I have made the files PCM 22.050KHz, 8 bits, mono but the sound is a littlebit too slow. And at each next song there are two second noise

27.10.2016 - 23:51
Name: Moty
Comment: Hi Ezequiel, Thank you for the hint, I will try it. One way is to use a program to write zeroes to the whole of the CD. Another way is to stop the playback at the address that you stopped recording. Look at this code www.moty22.co.uk/sd_eeprom.zip , it writes the address to the eeprom.

27.10.2016 - 19:12
Name: Ezequiel
Comment: Hi, everyone! First of all, I want to congratulate to the creator of this project for his very nice job. All the versions he provided are working just perfect. Second, you need to add "#define _LEGACY_HEADERS" before the includes to all your codes. That way, your code will compile on any version of MPLAB. Third and last but not least is a question: How can I do to reproduce only the first file by pushing play button and eliminate the annoying noise it does on each reading? Thanks in advance!

27.10.2016 - 19:00
Name: Ezequiel
Comment: Hi, everyone! First of all, I want to congratulate to the creator of this project for his very nice job. All the versions he provided are working just perfect. Second, you need to add "#define _LEGACY_HEADERS" before the includes to all your codes. That way, your code will compile on any version of MPLAB. Third and last but not least is a question: How can I do to reproduce only the first file by pushing play button and eliminate the annoying noise it does on each reading? Thanks in advance!

08.10.2016 - 05:39
Name: Daniel
Comment: it's fine. Thank you very much. It is likely that the noise is from the power supply. I change cap for power, it's better :) Have a nice day !

08.10.2016 - 04:45
Name: Daniel
Comment: Thanks for your answer! I used 3v power supply for 16f690 and 5v for 16f876A. They also run very well and both of them have this noise. When I change PR2 of PWM, this noise also change. This noise always exits when i record but it does not affect the sound obtained. So I think that it is likely that the noise of period PWM.

08.10.2016 - 04:34
Name: Daniel
Comment: Thanks for your answer! I used 3v power supply for 16f690 and 5v for 16f876A. They also run very well and both of them have this noise. When I change PR2 of PWM, this noise also change. This noise always exits when i record but it does not affect the sound obtained. So I think that it is likely that the noise of period PWM.

07.10.2016 - 18:08
Name: Moty
Comment: Hi Daniel, the PWM frequency is 20KHz and most people can't hear it. It is likely that the noise is from the 5V power supply. Try 220uF cap on the 5V. If the output is connected to an external amplifier try cascading 2 Low Pass Filters.

07.10.2016 - 11:14
Name: Daniel
Comment: Thanks you for your project. It runs very well. But when I record and play, there is the noise of clock period pwm. How can I remove it ? please!

24.05.2016 - 20:44
Name: Hasan Bilgin
Comment: I did the same as the PIC16F876 circuit. The program "hex" I installed each. No one was run. What is the reason. Could you help. Thank you

11.05.2016 - 00:43
Name: Sean Hall
Comment: Spot on...My answer machine has just died and as I use it only for outgoing messages it will be ideal for that purpose. I'm familiar with pics (using pic basic pro) but not the interfacing with sd cards.Will make a active low pass filter with audio opamp & suitably biased output transistors to make the most of the audio output. So thanks again.73 Sean Hall Easingwold, York UK

04.05.2016 - 22:46
Name: ayk
Comment: thanks good

04.05.2016 - 22:45
Name:
Comment: thanks

08.04.2016 - 08:35
Name: Mikhail
Comment: Thank you so much! Everything works fine. Good job.

21.03.2016 - 14:37
Name: subramanian
Comment: this project is very usefull for me I want to assembled the project and then leave you a comment. thanking you

04.03.2016 - 06:45
Name: wimpie
Comment: Hi thanks for feedback can you point me to a good c course to download to first get the basics down thanks alot

02.03.2016 - 21:14
Name: Moty
Comment: To complete your project you need basic knowledge of SD card, basic knowledge of wave and basic knowledge of microcontrollers. It takes about 20 hours to learn each subject. I recommend to learn how to do it in C because it's the easiest language to learn and this is why it is so popular.

02.03.2016 - 09:02
Name: wimpie
Comment: Hi .i want to use the same project but with 4 switches as inputs to play 4 wave files on sd card .so input 1 plays wave file 1 input 2 playes wave file 2 ect .i am useing flowcode 4 but no luck can someone please help .batteling with c code .thanks in advance .my email is wimpieswanepoel1@gmail.com

07.02.2016 - 02:37
Name: Moty
Comment: If you use Microchip EEPROM then you can copy the data of one chip to others using PicKit2 or other programmers.

07.02.2016 - 01:32
Name:
Comment: I dont wanr ro use SD card . So i will be recording on chip. But can i copy one chip daya to other sone how or for each chip i have to record seprately?

17.12.2015 - 10:28
Name: QAMAR SHAIKH
Comment: GR8

21.10.2015 - 15:23
Name: lili
Comment: thanks moty. Well, what can I recommend for this?

21.10.2015 - 12:06
Name: Moty
Comment: Hi Lili. pic16f isn't powerful enough to write wave file.

20.10.2015 - 15:47
Name: lili
Comment: I Placing wave encoder between SD card and microprocessor Is wav format audio recording would be?

17.10.2015 - 09:38
Name: hseyin
Comment: Ctrl+F "download software" :)

17.10.2015 - 02:03
Name: tohu
Comment: very nice .......hex or. code?

14.10.2015 - 09:30
Name: RZA
Comment: I did use the code while (1 ) inside.but I could not... very thanks moty. good work...

14.10.2015 - 00:31
Name: Moty
Comment: Add line SLEEP(); I've never used it so I can't help any more.

13.10.2015 - 13:19
Name: RZA
Comment: I tried I could not wait to get sleep mode. You can help friend

05.10.2015 - 13:46
Name: z4
Comment: Can I save audio files in wav format ?

05.10.2015 - 13:40
Name: z4
Comment: Can I save audio files in wav format ?

02.10.2015 - 22:09
Name: Moty
Comment: Thank you Lili, almost as beautiful as Turkish food.

02.10.2015 - 15:19
Name: lili
Comment: a beautiful project. I congratulate. What kind of record ?

28.09.2015 - 16:21
Name: kazuya
Comment: I need Sleep mode for 16f690 . can u help me? thanks moty.

28.09.2015 - 16:17
Name: hseyin
Comment: for read again

28.09.2015 - 16:16
Name: hseyin
Comment: void ReadSD(void) { unsigned int i,r; unsigned char data; aq: Command(12,0x00,0xFF); //stop transmit SPI(0xFF); SPI(0xFF); CS = 0; SPI(0xFF); SPI(0xFF); Command(12,0x00,0xFF); //stop transmit SPI(0xFF); SPI(0xFF); if(sdhc){loc = 10;}else{loc = 5120;} r = Command(18,loc,0xFF); //read multi-sector if(r != 0)errorLED = 1; //if command failed while(Stop && Pause) { while(SPI(0xFF) != 0xFE); // wait for first byte for(i=0;i<512;i++){ while(!TMR2IF){} data = SPI(0xFF); DC1B1 = data & 1; //shift byte to get the required PWM duty cycle CCPR1L = (data >> 1); TMR2IF = 0; if(!Play)goto aq; } SLEEP(); SPI(0xFF); //discard of CRC SPI(0xFF); Sayac(); } Command(12,0x00,0xFF); //stop transmit SPI(0xFF); SPI(0xFF); CS = 1; } void Sayac(void){ CS=1; if(sdhc){loc = 10;} else{loc = 5120;} CS=0; SPI(0xFF); SPI(0xFF); Command(12,0x00,0xFF); //stop transmit SPI(0xFF); SPI(0xFF); CS=1; }

24.09.2015 - 21:33
Name: Moty
Comment: Ask Google.

23.09.2015 - 19:47
Name: jethro
Comment: how can i program the pic?

23.09.2015 - 12:02
Name: Moty
Comment: I've added to the download a firmware that stops play at the end of the recorded track.

22.09.2015 - 11:26
Name: shahrukh
Comment: when finished reading the sector which line the error LED is burning ? I need to rotate the head of that line software

22.09.2015 - 09:34
Name: shahrukh
Comment: when finished reading the sector which line the error LED is burning ? I need to rotate the head of that line software

22.09.2015 - 08:41
Name: shahrukh
Comment: How do we trigger the stop button when finished to play ?

22.09.2015 - 07:57
Name: shahrukh
Comment: How do we trigger the stop button when finished to play ?

22.09.2015 - 00:10
Name: Moty
Comment: Hi Shahrukh. If stop isn't pressed then the code will read to the last sector in the card and then turn on the error LED.

21.09.2015 - 11:47
Name: shahrukh
Comment: hi moty . thanks for share. After reading is finished circuit is doing what ?

09.09.2015 - 11:08
Name: hseyin
Comment: I'm already looking electronic forums. I just needed to blow off the end of a record to a variable. or between the beginning and end of the record I need to identify with a timer.Is there anyone who can help in this regard ? thanks.....

05.09.2015 - 23:01
Name: Moty
Comment: Hi Huseyin. I'm afraid I don't have the ability to help you with changing the code. Try to get help in electronics forums or try to teach yourself, it is better fun to learn this way. Good luck.

04.09.2015 - 09:19
Name: hseyin
Comment: hi moty. how are u ? 2 will be questions 1) do{WriteSD();}while(!Rec); // for holding down the record button 2) How should automatically stop playback finished?

04.09.2015 - 09:19
Name: hseyin
Comment: hi moty. how are u ? 2 will be questions 1) do{WriteSD();}while(!Rec); // for holding down the record button 2) How should automatically stop playback finished?

02.09.2015 - 16:35
Name: hseyin
Comment: hi moty . can u help me? While reading, I want you to stop automatically after reading .

01.09.2015 - 11:09
Name: hseyin
Comment: hi moty. very thanks for share. 690 is best!... :) 876a is good.if 876a is not run, you use 512mb sd card.

24.07.2015 - 13:07
Name: Bob
Comment: Hi Moty, in your zip-file you included the MPLAB X with X8. This is only for the 876A-recorder. Can you please provide me with the files needed for MPLAB X (with X8) to compile the FAT32 (690-version; see my question 22.7.2015)?

22.07.2015 - 17:55
Name: Bob
Comment: Hello Moty, Can you transfer the 876-software for a FAT32 to the 690? This would be very helpfull as I have 690 as a standard PIC.

19.07.2015 - 23:20
Name: Bob
Comment: Hi Moty, the circuit looks great. Two questions: 1. Does the 16F690 also play FAT32 or is it just like the first circuit raw data? 2. Can you add extra buttons to the circuit (16F690). With these buttons it should be possible to select a wav-file from the SD-Card. It may be a selection in binary format.

11.07.2015 - 02:05
Name: Moty
Comment: Hola Andres. Try the code in here http://www.moty22.co.uk/sdhc.zip I made the SD card initialization more robust. Try it and please let me know if it solves the problem.

10.07.2015 - 22:10
Name: Andres
Comment: Moty hola de nuevo. No se que estara pasando mi circuito, no funciona, podria ser un error en el CRC?

10.07.2015 - 20:42
Name: Moty
Comment: Hi Huseyin, congratulations, can you tell us please what was the fault so others could learn from it.

10.07.2015 - 17:41
Name: Andres
Comment: Moty hola de nuevo. No se que estara pasando mi circuito, no funciona, podria ser un error en el CRC?

10.07.2015 - 10:31
Name: hseyin
Comment: hola moty. circuit is running:) thanks for share

06.07.2015 - 15:03
Name: Moty
Comment: Hola Andres. My SD is EMTEC. Don't use boot loader with your PIC and use a PIC Programmer that you know from experience that it works well.

05.07.2015 - 22:19
Name: Andres
Comment: Moty gracias por responder. Cual marca de sd utiliza usted? Ya hemos armado el circuito 2 veces para comprobar si era algun error en la construccion y continua el error. Voy a probar con otra marca de sd para ver si funciona. Gracias

05.07.2015 - 00:24
Name: Moty
Comment: Hola Andres, He utilizado Google para traducir. Tambin utilizo la tarjeta MicroSD con adaptador y funciona bien. No utilice la tarjeta SDXC. Usted puede intentar otra marca de la tarjeta SD a pesar de que el cdigo tiene que ser bueno para todas las tarjetas.

04.07.2015 - 21:57
Name: Andres
Comment: hola, tengo una pregunta... Hemos armado el circuito con una microSD con adaptador a SD. y nos esta enviando el led de error. Queria saber si el problema es por la tarjeta microSD con el adaptador a SD. Me podria ayudar por favor. Mi correo: victoraqc@hotmail.com

13.06.2015 - 09:10
Name: hseyin
Comment: hi Moty , can you send me whether circuit. Can you send out the printed circuit board or official . My mailbox My huseyin035harran@gmail.com

28.05.2015 - 23:39
Name: eu del tecnico
Comment: holis me salvaron con el circutito este ahora puedo hacer algo al fin :)

28.05.2015 - 22:47
Name: viti y eugenio
Comment: To tens toda la razn, es la ostia!!!

25.05.2015 - 16:06
Name: hseyin
Comment: Did you run the circuit in Proteus ?

25.05.2015 - 15:59
Name: hseyin
Comment: but I did 3 one circuit . They all got the same result . Are you sure that Code are correct ? if possible, you can send a video or picture of the circuit you do?

25.05.2015 - 13:36
Name: Moty
Comment: If the Error LED is burning it means that it is not connected to the right pin. Check for errors in your build.

25.05.2015 - 13:11
Name: hseyin
Comment: hi moty. ı created curciut and running... but , circuit making record 2 or 3 seconds. After errorled burning.ı using 2 gb sd card . I do not understand what the problem

14.05.2015 - 05:31
Name: pablo
Comment: Gracias pro todos los circuitos, que hay son muy bueno,para poder aprendes com funciona.

14.05.2015 - 00:35
Name: Moty
Comment: Hi German, SD cards are the cheapest because they are popular and also very easy to interface.

13.05.2015 - 16:12
Name: German Alberto
Comment: What other device of memory and more cheaper that SD memory card can be used?

11.05.2015 - 16:38
Name: Moty
Comment: Try the hex file that you downloaded from here.

11.05.2015 - 12:31
Name: hseyin
Comment: hi moty. I created at electronic circuit and instaled hex file in pic. but only error led activeted. are u help me for this job? hex file is does it work properly? I have xc8 compiler . compile properly but when I say this directly to the 2000 lines create a hex file ıkarıyor.progra I 'm not properly install the pic to your hex file .

06.05.2015 - 09:50
Name: Hseyin
Comment: hi moty . very thans, I understand I need to integrate into MPLAB X hi-tech . but I do not know how one goes about thanKs

05.05.2015 - 18:05
Name: Moty
Comment: Hi Huseyin, look at the C file for MPLAB X theses errors are corrected.

05.05.2015 - 09:50
Name: Hseyin
Comment: look at proteus and I use hex files. http://www.upload.gen.tr/d.php/www/2shBG/proteus-and-hex.rar.html

05.05.2015 - 08:28
Name: Hseyin
Comment: Thank you first. We did like the link you gave the project , but I am getting compiler error in the 3rd floor. 1) __ CONFIG 2) GODONE the line 3) RBPU row

05.05.2015 - 00:02
Name: Moty
Comment: Hi Huseyin, Make sure you have SD or SDHC card. Maybe you can find help here: http://320volt.com/pic16f876a-sandisk-sd-kart-ses-kayit-calma/

04.05.2015 - 15:19
Name: hseyin
Comment: I did circuit , I upload the hex file in pic , but the error lamp lights up Help me!

30.04.2015 - 10:36
Name: hseyin
Comment: thanks :)

24.04.2015 - 18:55
Name: Moty
Comment: Hi Huseyin, htc.h file is placed in HI-TECH or XC8 compiler.

24.04.2015 - 17:19
Name: hseyin
Comment: htc.h library not be opened.

24.04.2015 - 17:16
Name: hseyin
Comment: #include file can not be opened help me!

09.04.2015 - 03:36
Name: dude
Comment: Didn't see your reply, many thanks! I will make the circuit and try it out.

01.04.2015 - 22:10
Name: Moty
Comment: Hi dude, In the 16f887 the CCP and the SPI are more advance so the code needs some changes. I have the code but I don't have the circuit, you will have to work it out yourself. You can download it from here: http://www.moty22.co.uk/sdhc16f887.zip

01.04.2015 - 16:40
Name: dude
Comment: Hi, this project helps a lot, but i\'m seeing the code and would like to know if it can be directly applied to a pic16f887.

29.03.2015 - 04:53
Name: ktdt
Comment: this is a good project

14.10.2014 - 11:55
Name: Moty
Comment: Hi Dan. I'll be glad to see someone answering but I doubt it, not many people read these comments. The sound quality should be like the sound we get from a cassette player. If the sound is distorted than look at the mic and the headphones amplifiers. If the buttons don't function look at the pic. Try for help on this forum, Ian Rogers is very helpful: http://www.electro-tech-online.com/threads/websites-blogs-containing-some-pic-16f877a-based-projects.142237/ http://www.electro-tech-online.com/threads/sd-card-to-small-ram-pic-pic16f877a.128641/

13.10.2014 - 20:27
Name: D847
Comment: Could anyone post a video to this design working? I just wanted to compare to the functionality I have. Thanks!

29.09.2014 - 22:05
Name: Moty
Comment: Hi D847. I used HI TECH V9.80 they must have changed the header file for this device, I'm using dialup internet and I can't download the new HI TECH. You can try to find the new names for these bits in the file pic168xa.h , they could also changed the name of this file. The other way is to change GODONE to ADGO or ADCON0 |=0B100 , RBPU can be changed to OPTION &=0x7F.

29.09.2014 - 15:21
Name: Selim KOC
Comment: Thanks. elektrokod.wordpress.com

29.09.2014 - 14:56
Name: D847
Comment: Ok, I got past the config errors, but know I get: Error [192] W:\DJW\DJW Projects 05-21-14\PROJECTS\PIC-SD-RecorderPlayer\SD PLAYER\sdhc.c; 113.1 undefined identifier "GODONE" Error [192] W:\DJW\DJW Projects 05-21-14\PROJECTS\PIC-SD-RecorderPlayer\SD PLAYER\sdhc.c; 183.1 undefined identifier "RBPU"

29.09.2014 - 14:49
Name: D847
Comment: Hi Moty, It does not appear HI TECH compiler is compatible with MPLABX. Regardless, I tried using my MPLAB 8.89 and HI TECH C compiler and ran into errors. The errors are below: HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.83 Copyright (C) 2011 Microchip Technology Inc. (1273) Omniscient Code Generation not available in Lite mode (warning) Error [800] SD PLAYER.as; 45. undefined symbol "HS" Error [800] SD PLAYER.as; 45. undefined symbol "UNPROTECT" Error [800] SD PLAYER.as; 45. undefined symbol "WDTDIS" Error [800] SD PLAYER.as; 45. undefined symbol "LVPDIS" It looks to be the config settings for the PIC. I will try to fix and let you know the results. I appreciate your help!

26.09.2014 - 22:15
Name: Moty
Comment: Hi d847. You can use the MPLABX with the free HI TECH compiler for pic16. Compiling with XC8 gives many errors. PicKit2 will work too. I'm sure you can still download the free HI TECH C compiler.

26.09.2014 - 18:43
Name: D847
Comment: Can I use MPLABX and the XC8 Complier? I have a PicKit2 to program with. Thanks!

10.09.2014 - 11:10
Name: md raja
Comment: bangladesh

06.09.2014 - 21:22
Name: Moty
Comment: Hi Paul. When you compile the C file with free HI TECH compiler on MPLAB you get a file sdhc.as which is ASM version of each line in the code. This is an easy way to understand the code if you understand ASM. To my opinion it is easier to learn the C language than learning how SD card works. If you wish I can email you the file sdhc.as .

05.09.2014 - 00:17
Name: Paul
Comment: Hi Moty, many thanks for this, I shall build probably using a fet agc for the input. Shame its not in asm as c means nothing to me - can you explain step by step the process and maybe I could write it in asm? cheers and well done

04.09.2014 - 19:10
Name: Moty
Comment: Hi MPN. See answers from 9.8.2014 and 23.1.2013

04.09.2014 - 13:07
Name:
Comment: Hi Moty, As per given directions, Use of MPLAB (HI TEC C Free version) Compile the code and found followng error as undefined: GODONE = 1; //ADC input sample RBPU = 0; //pullup on How can it be fixed?

04.09.2014 - 13:04
Name: MPN
Comment: As per given directions, Use of MPLAB (HI TEC C Free version) Compile the code and found followng error as undefined: GODONE = 1; //ADC input sample RBPU = 0; //pullup on How can it be fixed?

29.08.2014 - 23:29
Name: mysu
Comment: Moty, the new software is "just what I wanted" (words of abhishek rai). Many thanks.

29.08.2014 - 12:47
Name: abhishek rai
Comment: just what I wanted

21.08.2014 - 00:29
Name: mysu
Comment: I have no ideea how do that, but I will ask the opinion of a my friend. I will make that repeater anyhow. That LED signal on play put in TX the CB station. I have not find nothing suitable on the net. ISD circuit voice recorder not found in my bloody country. And this project is very simply and accessible. Thank you very much for answer and excuse my for the insistence.

20.08.2014 - 23:58
Name: mysu
Comment: I have no ideea how do that, but I will ask the opinion of a my friend. I will make that repeater anyhow. That LED signal on play put in TX the CB station. I have not find nothing suitable on the net. ISD circuit voice recorder not found in my bloody country. And this project is very simply and accessible. Thank you very much for answer and excuse my for the insistence.

20.08.2014 - 20:53
Name: Moty
Comment: Hi Mysu. I can suggest one way. Write to the EEPROM the 4 bytes address (unsigned long loc) when you press Stop. When you press Play read the SD blocks from the start until you reach that address. You can look at the project Talking Clock to get some ideas. Turn the play LED on at the start of the write function and it off at the end of the function.

20.08.2014 - 00:33
Name: mysu
Comment: Hi Moty. I build this project and it work. But I need a LED on play (It will stay alight when play the track and it will lights off when end the track, last track recorded). how can I achieve this? If last recorded is 5 seconds (par example), it no stop after 5 seconds. it will play all the card.

09.08.2014 - 01:30
Name: Moty
Comment: Hi Dan. Also make sure in MPLAB you select PIC16F876A in menu > Configure > Select Device

08.08.2014 - 21:37
Name: DAN
Comment: Sorry Moty! If I would have looked at the older comments, I would see that shari had the same questions. I will try your suggestion dated 23.01.2013 Thanks!

08.08.2014 - 21:30
Name: DAN
Comment: Hello Moty! I am going to give this one a try because I am new to PICs and SPI. I was reading through the sdhc.c code (trying to make sense of it) and it will not compile using MPLAB v8.89 and Hi-Tech C complier. The error is line 113, undefined identifier "GODONE" and line 183, undefined identifier "RBPU". Could you please explain why GODONE and RBPU are not identified? Should they be ints? Thank you for your help. This looks like a fun project.

21.07.2014 - 14:43
Name: Moty
Comment: Hi Manfred. The raw audio data on the SD is meaningless anyway. I've never looked for a program to read the SD by PC. It is possible to add a routine to the pic to transmit the data via serial COM port. Also to add VB or other language program to your PC to put the data in any file form.

20.07.2014 - 21:36
Name: Manfred
Comment: Hi Moty I spent hours searching on the internet, via reading of headless raw files to the sd card without success even under windows and linux, found no program! This audio recorder is breaking agents Cheers!

20.07.2014 - 14:24
Name: Moty
Comment: Hi Mysu. The software can record or play only one track. For recording more than one track you have to modify the code. If you are using the MIC AMP then the reason for distortion could be that you are using very different condenser mic. The voltage on the mic should be 2 to 3 volts, and the voltage on the collector of BC337 2 to 3 volts. You can also try to connect audio signal of 0.5 volt to the audio input of the pic circuit.

20.07.2014 - 00:45
Name: mysu
Comment: And second question is if it can stop playing after playing the last record. He play all registered before the SD card. (sorry for my english. I translate with Google. HI HI)

20.07.2014 - 00:39
Name: mysu
Comment: Hi Moty. Thank you for this good project. I build it and it worked "at first key" . But I do have two questions. At small signal appear large distorsions. It's normal to appearing this? Or is it a problem to my construction?

17.07.2014 - 16:07
Name: Manfred
Comment: Hi Moty Can you send your E-mail adress to me?

17.07.2014 - 15:31
Name: N B BASAVARAJU
Comment: I ILIKE YOUR GUIDENCE AND DESIGNING CIRCUIT

15.07.2014 - 19:33
Name: Manfred
Comment: Hi Moty Thank You for the Attached Code, It works very well

14.07.2014 - 20:53
Name: Moty
Comment: Hi Manfred. Attached code with the playing while recording removed, this will stop the feedback.

14.07.2014 - 17:32
Name: Manfred
Comment: this shematic is very good,but I have a heavy accustic feedback in rec modus. Cheers!

08.07.2014 - 21:06
Name: Moz
Comment: Awesome, thanks Moty. Just the kind of starting point I need. The PIC16F876A is my baseline PIC - old but trustworthy! Also very pleased to get round to using an SD-Card for mass storage without the filing system overhead. I'm looking to adapt this design to make a seismic recorder (amongst other logger types), so I'll need to add an easy to read the data back out again into a PC, probably using RS232(FTDI). If I can contribute in return, I will. Cheers!

19.04.2014 - 11:24
Name: Moty
Comment: Hi Mysu. Download: SD Specifications Part 1 Physical Layer Simplified Specification Version 3.01 Study the Card Initialization and Identification Process and implement it in the firmware. It can be an interesting challenge.

18.04.2014 - 21:15
Name: mysu
Comment: sorry! I don't no why appeared a second time message.

18.04.2014 - 21:11
Name: mysu
Comment: Why not go with SDHC? Normal SD can not be found at the store.How can I make it work with SDHC? Is that so hard to walk with SDHC? (sorry for my english)

18.04.2014 - 20:54
Name: mysu
Comment: Why not go with SDHC? Normal SD can not be found at the store.How can I make it work with SDHC? Is that so hard to walk with SDHC? (sorry for my english)

25.03.2014 - 01:46
Name: Moty
Comment: Hi Ali. I'm quite sure this project can be implemented on a PIC. You will need to know the AVR and the PIC specs to migrate the firmware. You may have to select a PIC with more pins because I don't think there is an 8 pins PIC with PWM.

24.03.2014 - 15:00
Name: Ali Afsahi
Comment: Hi my friend Look at this website http://elm-chan.org/works/sd8p/report.html It would be interesting if the project is implemented click pic I'm waiting for comments I also have a relationship with you Good luck

06.02.2014 - 17:27
Name: Moty
Comment: Hi Mr U. It is not possible to read the SD data with a computer. The code doesnt use any file system so there is no file on the SD and computers show like the card is empty. The code uses the SD card as if it is a RAM (random access memory).

06.02.2014 - 11:37
Name: MrU
Comment: Hi Moty, do you know how to read the stored file on the SD card in a computer - is it possible?