New library for PWM playback from SD cards: SimpleSDAudio

Follow this diagram (worked for me)

not sure the 4.7k / 10k will work..but other diagrams seem to elude to it works fine:

make 100% sure that your +3.3v output pin on the Arduino is REALLY outputting only +3.3v

Hi,
I think both voltage dividers will work, if you don't have those 1.8k and 3.3k resistors also the 10k/4k7 solution should do it. BUT: Do you really have a ~~CrApDuInO+~~gizDuino+ (the plus version)? In such a case please tell me exactly how the menu item under "Board" inside Arduino-IDE is called that you use. I can help you to get it running even on such strange Arduino board but it will need some "special handling".

I have the CRAPduino that appears on this site #?!! site.. http://www.e-gizmo.com/KIT/Gizduino.html

Only 4.7k and 10k resistors are available with me now.

The 3.3 volts pin on my crapduino outputs about 3.3 volts so it's correct.

In my voltage divider with 4.7k and 10k, i get a 3.3 to 3.4 volts accross 10k.

I use 1.0.3 IDE. Board: Gizduino (mini) with atmega 328. Programmer: AVR ISPmkII.

Ok, at least this Arduino clone has a ATmega328, better than the one with the plus at the end. If you do your wiring correct and with levelshifters it should work with the lib.

should work now...

voltage divider in place of the level shifter...

+3.3v output ON the +3.3v pin..

Can you run any other SD or sdFat libs to check the SD communication at all?? (be sure to check the CS pin used in the sketch)

Level Shifters. One of the more important but rarely addressed subjects. for the record either the 3K9 or 4K7 resistors will work fine. There is a slightly different method that can be used to give true level shifting. Instead of 2 resistors (Besides the bus pull-ups) a single mosfet is used. There is truly an added advantage in that the device is fully bi-directional it is described in this app note: AN10441. I have attached it to this post.
basically the Drain connects to the 5 V side (data - I/O), The Source connects to the 3V3 side (data - I/O) and the gate connects to 3V3. I had a bunch of 2N7000's and for the 3 or 4 I've built they've worked well. A BSS138 is recommended for this device and 2 or more? should fit nicely on one of those small SMT prototype boards. I also chose the 2N7000's because I had a bunch of them but I've not found it necessary to "Select" devices to make functional 2 wire translators, all have worked and I also use them in preference to the BSS138 because I breadboard everything and interconnect and a test all of any modules before I have an idea of what the final PCB is going to be.
As a note: Adafruit sells inexpensive level shifters for 2, 4, 8 channels but I've not bothered as it takes a fet/channel and a jumper not the 6 wires that breakout board does for 2 channels.

Bob

AN10441.pdf (52.4 KB)

That Gizduino+ is a Sanguino clone. The SPI pins are on Digital pins D5, D6, and D7:

D5 - MOSI
D6 - MISO
D7 - SCK

and yes, level shift your pins. A simple resistor divider, as suggested, or you can use a 74HC4050 (CD4050 can be used if you can't get it locally).

connections using CD4050:

SD Card Pin----CD4050 Pin-----Gizduino+
CS--------------15 14-----D4
MOSI-----------12 11----D5
SCK------------10 09----D7
MISO----------------------------D6

the CD4050 connections can also be used with your Gizduino mini:

SD Card Pin----CD4050 Pin-----Gizduino mini
CS--------------15 14-----D4
MOSI-----------12 11----D11
SCK------------10 09----D13
MISO----------------------------D12

Unfortunately, it still doesn't work
This is my connection.
CS---------D4
MOSI------D11
SCK-------D13
MISO------D12

If I turn on the crapduino and upload absolute minimum, what readings should I get from this pins: D4, D11, D12 and D13 provided that I have not made any connection yet.

Because I am getting:
D4: 0.1 volt
D11: 5volts
D12: 0.1 volt
D13: 0 volt

are you using a level shifter?

have you made a resistor based voltage divider??

follow the images/wiring that was posted for you.

yes, I'm using a level shifter.
I followed the second circuit. Resistor values are 4k7 and 10k.
If I supply my level shifter with 5 volts, the drop across 10k with respect to ground is around 3.37 to 3.4 volts.
This means that my level shifter is OK.

If I turn on my crapduino, what voltage should I read from the SPI pins?

Can you take a picture of your setup and post it here?

Are you using an SD Card or a Micro SD Card in an adaptor?

What's the error code thrown out by the BareMininumWithDebug example, error code: 1 or error code: 08?

if it is error code 1, if your not using a shield, check your connections and contacts with the SD-Card pins. if it is error code 8, try level shifting using 1.8k and 3.3k resistor.

I recently had a problem with my setup above using CD4050. So i ditched that setup and use resistor divider with above values. I am using a micro-sd on an adaptor.

also if no error code and it is saying in the serial monitor "Initialising SD card...Wiring is correct and a card is present....... playing EXAMPLE.AFM.found.playing" lean-in, or put the speaker, closer to your ear, the audio volume is quite low. that it can be unnoticeable when your in a noisy environment.

and my *duino is even more crappier than yours XD :smiley: :smiley: XD and it's from five years ago...

just saw this today... and it sorta applies here:

When I run the BareMinimumWithDebug, the error code is 3.

Can anyone answer post number 145? Thank you.

Kindly check the schematic. I always connect my CS pin on pin 4 which is T0 (PD4) of the ATMEGA328P.

Schematic crapduino with atmega 328.pdf (16.5 KB)

Hi, it seems that is still something wrong, either with wiring or something else.

Regarding post 145: If you build your voltage dividers correctly and assuming that you are not driving MISO as output you should not measure more than 3.3 - 3.6v anywhere on the SD card.

Please also check:

  1. You use a SD or SDHC card, but not SDXC. Old MMC cards may work - not tested.
  2. You use Arduino IDE 1.0 or up to 1.0.3, but not 1.5 (the beta version only for Due)
  3. If you use a ATmega328 based Arduino, even a clone, you should use an unpatched Arduino IDE and program the Arduino using one of the boards-setting that came already with the standard IDE.
  4. If all is ok, check if your Arduino is still working on all ports used by the SD card. Set ports to output and high and you should measure 3.3v at appropriate SD pins.

Have you tried with a different SD card?

I have some SD cards that just won't initialise in my card reader. I have two cards exactly the same, 2gb and same make and model, and only one will work with the reader. Both work in the pc. I also have some microSD that won't work either, where others do.

Hi again.

I'm almost losing hope.
But before I turn into incredible hulk and destroy everything, I'll try my best to do it. :smiley:

I am attaching an image of my connection to the crapduino and to the sd card.

Question: What brand of SD cards are working for this application?

SD card CS goes to pin 4?
Please check the attached image...

Kindly let me know what it means by the error codes so I know what to check.

Thank you.

When I upload, I sometimes get this error:

avrdude: stk500_getsync(): not in sync: resp=0x00

I'm using an Aduino 1.0.3 IDE.

not sure of the error.. seems like it cant communicate..

as for the CS pin.. why do you have it connected to several pins?

seems like it goes to pin D4.. but 'also'.. D10 (SS) pin as well??

just follow the wiring diagrams that have been posted for you.

Hi

I think I followed exactly the schematic you posted.
There are 3 voltage dividers connected to MOSI, SCK, and CS.

PLUS: The testing for the BAREMINIMUMWITHDEBUG says that CS pin of SD card goes to digital pin 4 of crapduino.

What part did I not follow sir? I really need the audio ASAP. It's for a school project.

Im saying (to me at least).. it looks like you have the CS pin on the SD card connected to two other places on the Atmega

Is that how the other diagrams posted have it? (two places)

I have tried BOTH (with this library)..

using D4 and D10 and the CS pin...

and of course using D9 as the default audio output pin..

this gives you 'basic' audio output.. unless you build in a filter/amp..etc..

(more advanced/better audio output is use D4 as the CS pin.. and use BOTH D9 & D10 for audio output. [along with a few other components])