Go Down

### Topic: New library for PWM playback from SD cards: SimpleSDAudio (Read 116520 times)previous topic - next topic

#### Tuttut

#135
##### Feb 22, 2013, 09:31 pm
Another thing: I don't like the solutions from sparkfun levelshifter site because most of them are pretty slow. Better use a voltage divider with two resistors per line as described in SimpleSDAudio.h. This is proven to work even at fast SPI speeds as required for my lib.

#### xl97

#136
##### Feb 22, 2013, 09:37 pm
if you really want to test this..

I suggest grabbing a few resistors.. and making a voltage divider, so that your LOGIC level will work correctly..

I have read about the voltage dividers being 'slow' (or too slow even).. but I have tried and tested this myself.. and it works fine for me & initial testing.

IMHO (again Im a noob!  <--- disclaimer!) .. you have +5v Arduino/board..  (period)

In order for the SD card to 'work'.. you need an Arduino that RUNS @ +3.3v logic...
or
A voltage divider between Arduino & SD card.

#### meowth08

#137
##### Feb 22, 2013, 09:43 pmLast Edit: Feb 22, 2013, 09:44 pm by meowth08 Reason: 1
+5V------4.7k-----(x)-----10k------gnd

this will be for mosi, sck, and cs

MISO does not need a level shifter.

is this already correct?

#### xl97

#138
##### Feb 22, 2013, 09:51 pm
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

#### Tuttut

#139
##### Feb 22, 2013, 10:09 pmLast Edit: Feb 22, 2013, 10:10 pm by Tuttut Reason: 1
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".

#### meowth08

#140
##### Feb 22, 2013, 10:25 pmLast Edit: Feb 22, 2013, 10:27 pm by meowth08 Reason: 1
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.

#### Tuttut

#141
##### Feb 22, 2013, 10:44 pm
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.

#### xl97

#142
##### Feb 22, 2013, 10:53 pm
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)

#### Docedison

#143
##### Feb 23, 2013, 02:42 am
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
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

#### purgedsoul

#144
##### Feb 23, 2013, 04:12 pm
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

#### meowth08

#145
##### Feb 24, 2013, 08:10 pm
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

#### xl97

#146
##### Feb 24, 2013, 09:09 pm
are you using a level shifter?

have you made a resistor based voltage divider??

follow the images/wiring that was posted for you.

#### meowth08

#147
##### Feb 24, 2013, 09:42 pm
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?

#### purgedsoul

#148
##### Feb 25, 2013, 04:00 am
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    XD and it's from five years ago...

http://arduino.cc/forum/index.php/topic,24039.msg181921.html#msg181921

#### xl97

#149
##### Feb 25, 2013, 06:39 pm
just saw this today... and it sorta applies here:

https://tindie.com/shops/thinkl33t/sd-level-shifter/

Go Up