Arduino Commands Cheat Sheet



Commands

Arduino Commands Cheat Sheet Pdf

Recently I had the chance to incorporate the DFPlayer Mini into a project. It’s a super cute MP3 player that is great for Arduino powered projects. The only problem being with the documentation. It is a little spotty and I had to work pretty hard to get around a few issues. So here is a little cheat sheet to help you along:

Arduino Commands Cheat Sheet

Obtaining the Arduino Sketch ELF File Path¶ In the settings of Arduino IDE, make sure that the Show verbose output during compilation and upload are both ticked. Under the Arduino sketch you want to debug, click Compile (select Wio Termianl as board), and check the log information to get the path of the.elf file location.

Arduino

The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. It’s a super cute MP3 player that is great for Arduino powered projects. The only problem being with the documentation. It is a little spotty and I had to work pretty hard to get around a few issues. So here is a little cheat sheet to help you along: How should I wire up the DFPlayer Mini to my Arduino? I really love cheat sheets. In a lot of cases they can take the place of an entire manual. So I was surprised, given its popularity that I couldn't find a single-page reference for the arduino online. I tried to make a sheet that captured all the things I hit the reference for while programming. What data type does the millis function return? Linux Commands Cheat Sheet in Black & White by Bobbin Zachariah pdf (linoxide.com) Linux CLI Ubuntu Command line cheat sheet by Patrick Kerwood gif (linuxbloggen.dk) Linux Command Line Cheat Sheet by DaveChild pdf (cheatography.com) Linux Cheatsheet by Muppix html, pdf (muppix.co) Basic Linux Commands by Muppix html, pdf (muppix.co).

Arduino Cheat Sheet Pdf

Arduino commands explained

Arduino Commands Cheat Sheet Free

How should I wire up the DFPlayer Mini to my Arduino?

If you dig into the pin map for the DFPlayer mini, you will find two different ways of driving a speaker. One set labeled ‘DAC left’ and ‘DAC right’ for use with an an inbuilt digital to audio converter. The other set labeled ‘SPK1 and SPK2’, and from the documentation looked like it is only useful for mono.

In practice, the SPK set supports stereo, and I found the DAC set to introduce a considerable amount of line noise. (Despite using the recommended 1K resistors between the Arduino and DFPlayer). Switching to the SPK set of outputs made a huge improvement in sound quality. I wired my DFPlayer mini up like this:

Oh and the polarity of a 3.5mm headphone jack? The pointy bit is the left channel, the middle the right and the part closest to the cable goes to ground.

What library should I use with the DFPlayer Mini?

The DFRobotDFPlayerMini library for the most part works pretty well. It works great with software serial, which is what DFRobot use in their example code on their wiki.

The DFPlayer library has made my main loop very slow?

I found making a call to setVolume each time in the main loop to be fairly destructive on the loop performance. This call could take upwards of 100ms and, this made the frame-rate of some LED animation stuff that I was doing unacceptable.. In the end, I only called setVolume when the value of a potentiometer was adjusted. Playback volume is something that is only occasionally changed, and having a drop in animation performance during those times wasn’t noticeable.

How do I format and organise my micro SD Card to be compatible with the DFPlayer Mini?

Plug your micro SD card into your computer and then In OSX open up a terminal and use the following commands:

This will let you work out what logical disk is being used for your micro SD Card. In my case, I used the listed SIZE to work out that it was /dev/disk2. Now the card can be correctly formatted:

Now copy your MP3 files over to the micro SD card. They can go into a folder named ‘mp3’, but will work fine straight on the disk themselves. They must be sequentially numbered like so:

You will also need to copy these files across in order, the DFPlayer seems to use some sort of creation timestamp when the files are index. So don’t copy 0003.mp3 and then 0001.mp3, otherwise wacky things will happen.

Finally, if you have done this all on OSX, you will need to clear out any hidden files as that will also mess up the DFPlayer’s indexing system.

(Your volume folder might be different, depending on what you used as the disk name during the disk erase step).

I had a bunch of MP3 files and micro SD cards to produce, so I made a little script to make it a bit easier (I had all my sequentially numbered files on the desktop in a folder titled ‘soundFiles’):

DFPlayer Mini randomly locks up and doesn’t play

This one was really tricky to nail down, it only happened maybe 4% of the time I called ‘void play(int fileNumber)’? Everything was setup correctly the selected MP3 fie would play most of the time, but every now and then it wouldn’t. Super annoying. I had to write my own play method to work around the issue:

This method makes sure any existing tracks are stopped first. Then we make sure that the current file number that the DFPlayer has matches the one we supplied. Keep trying till these track numbers match. It was the only way that I could play a track 100% of the time on the DFPlayer mini.

Arduino Commands Cheat Sheet Answers

Edits:

Arduino Code Cheat Sheet Pdf

  • 2019/01/19 - Updated schematic so that the speakers are wired to SPK1 and SPK2

Arduino Commands Cheat Sheet Cheat

Hi! Subconsciously you already know this, but let's make it obvious. Hopefully this article was helpful. You might also find yourself following a link to Amazon, Lego or eBay to learn more about parts or equipment. If you end up placing an order, I make a couple of dollarydoos. We aren't talking a rapper lifestyle of supercars and yachts, but it does help pay for the stuff you see here. So a massive shoutout to everyone that enables this place. Thanks!