Wednesday, 30 January 2013

Wiring up the STA013, DAC, PIC16F1825 (part 1)

I had my German tutor over this evening, so I did not get a chance to touch this circuit until an hour ago. So far I have hooked up my PIC16F1825 to programming pin headers and the colored blocks seen in the image below. Unfortunately I do not have a 14.7456MHz crystal so I am using a 16MHz for now - hopefully it either makes no major difference, but just to be safe I've placed an order for the other crystals which should arrive on Friday.

Original image from http://www.pjrc.com/

I'll try to finish off the circuit (wiring at least) tomorrow, and then I can start looking into the writing the code on the PIC16F to do the rest. Technically, since the SD card code is already done, the actual code for this circuit should be dead simple. Upon further reading, I've found somebody else has modified the circuit I am basing mine off of as well (https://instruct1.cit.cornell.edu/courses/ee476/FinalProjects/s2007/cd247_maw72/cd247_maw72/index.html) which makes me even more certain that this is just going to work without any problems. It's good to have some reassurance about a circuit working when you have a tight deadline!


Tuesday, 29 January 2013

Minor update

So I have all 40 of my decoder chips, and the 40 matching DACs all ready to go. With the help of Jason Hotchkiss, I got one of each soldered to a breakout board so I can play with them on a breadboard. Friday I was busy with general chores and things that needed to be done, Saturday I was helping somebody move house followed by going to a concert in London. Sunday I was teaching polymorphisms and exception handling... So unfortunately I've just been a bit busy, but I have not been lazily avoiding the task at hand!

For my own ease of mind, I am going to branch my current code so that I can keep my progress on sub folders, but divert and quickly get the MP3 support working, which will require ripping out all of the PWM code in the original source. Once I have the code playing a single MP3 on another breadboard, I will be happy and will return to the sub folder code and at the same time start to design the circuit in Fritzing.

On paper, it doesn't seem like there's much left to do, but in reality there is quite a lot of work still left. If there are no complications playing the MP3 files though, that's a major problem removed and I can put all my effort towards sub folder support. I'll allow myself a couple days to sort out the Arduino code and documentation for the workshop, which should be more than enough really. Arduino won't be doing much other than asking for a list of files, and stating which to play, along with displaying all this information on an LCD.

Monday, 21 January 2013

SD Card Reader with PIC16F1825


I was getting a bit tired of my friend Chris nagging me to hurry up and create some blog posts, and I have been busy with developing my own blog engine that makes use of Markdown, Mono, NoSQL and a number of other technologies. Unfortunately, with how busy life is getting, I don't get enough time to finish it and have other things which are a bit more important (such as my electronics projects). So anyway, this blog will hold as a temporary place holder until I get the time to finish my actual blog, and then redirect all the traffic over to there.

So this post is more of an introduction of what I am working on more than anything else really. Chris Holden created an amazing RAW audio playing device which has essentially only 5 components, as listed here:

  • PIC16F1825
  • 100uF capacitor
  • NPN Transistor
  • SD Card
  • Mini speaker

Obviously there is a power source to take into account, which depending on where you are presenting to the circuit may need a voltage regulator. None the less, it's an amazing little device.

It works on the FAT16 file system, and makes use of SPI to communite to the SD card, along with Pulse Wave Modulation to play the actual audio. Now the FAT16 file system unfortunately has a 4GB disk size limit, but for a lot of simple electronics projects this is more than enough. There is also a a limit of 512 files per folder, which really isn't much of a problem either, however Chris' implementation does not support sub folders. This is where I come in.

I am looking to make a number of changes to this project, and my improvements will be as follows:


  1. Add sub folder support
  2. Get this working with an STA013 to decode MP3 files
  3. Add support for other file systems (perhaps FAT32 or EXT)

Currently on my SD card I am working with the following file structure:



Now I have made a couple small tweaks so far, but nothing major yet. Originally Chris' code did not care if a file was deleted or not, which annoyed me a bit, so was the first tweak I had to make. Now when I query the root directory with UART I see the following:


The first strange thing I found was the "AMyFol" right next to "MYFOLDER". I decided to take a look at the raw hex for the SD card, and I found MyFolder without a problem, however nothing about AMyFol, so something isn't quite right in the code. An extra thing to add to my list of things to check I suppose. For those interested, my hex looked as follows:


So anyway, a number of blog posts are sure to follow whilst I work on this. I am hoping to get the Sub Folder support added very quickly, as I need it for another project I have in mind.