So back when I first started working with micro controllers, Arduinos mainly, the most annoying thing ever was when I would follow someone's tutorial for a project and they would use the Arduino Uno, while I would be using the Arduino Micro or something, and I would spend like an hour wiring it up, following the instructions piece by piece, get all excited to turn it on, and as I do it just straight up doesn't work. The resulting hissy fits meant a lot of Arduinos lost their lives. Anyway, after I calmed down I did some googling and found the cause and a solution, which I've used ever since. In this article I hope to explain it to you, so hopefully together we can end violence on innocent micro controllers. Also, I have seen lots of comments asking "can I use the Arduino Micro instead of Uno?"
The problem is that occasionally a project will work perfectly fine on an Arduino Uno, but won't work at all on an Arduino Micro, and sometimes a project will work perfectly on both. It's the most annoying thing when you spend a ton of time wiring something up and it suddenly doesn't work for some reason and nothing you can do will get it working. So I'm going to document the steps that will solve this issue most of the time.
To understand why this problem occurs we need to understand that Arduino boards, and in fact most micro controllers, have something called dedicated pins which perform one function such as the SPI or USB communication. They can be found on the IO pins of the board, for example pin A5 on the Arduino Uno is an analogue pin but it's also a dedicated SCL pin. A lot of the pins also have dedicated functions and this is where our problem arises. Let's say the tutorial you are using says plug your component into pin A5 on the Uno so the component can make use of the dedicated SCL pin. But if you are using the Arduino Micro, it just won't work because the SCL pin isn't on A5 of the Micro it's on pin 4. It's a bit complicated but if you don't understand it, don't worry! You can follow the steps to fix this problem without understanding this.
First we need to look at the components that you want to use and try to identify any dedicated pins that may be on them. They are normally labeled like this (the labels are next to or near the pins):
- SCL (clock line)
- SDA (data line)
- MISO (Master In Slave Out)
- MOSI (Master Out Slave In)
- SS (Slave Select)
- TX (USB communication)
- RX (USB communication)
If you find none of these and your project still doesn't work, you're going to need to go find the pin-out of the particular board used by the instructions you are following and see if the components connect to any dedicated pins. If so, it may have just not been labeled on the component and you should move to step 2. If it isn't connected to a dedicated pin, you should check the troubleshooting part of this article.
Secondly, we need to make sure the Arduino we are using has all the dedicated pins that our components need; for example, if your components had a SDA, MOSI and MISO pin, the Arduino you're using needs to have those as well. You can find this out by googling the board you are using and adding "pin-out". Then just look at images and you should see a list of the dedicated pins. I'll add links to the pin-outs of all the most popular Arduino boards.
- Arduino Uno (https://goo.gl/E42WAo)
- Arduino Nano (https://goo.gl/Tniiip)
- Arduino Micro (https://goo.gl/xpPcwP)
- Arduino Leonardo (https://goo.gl/WCfeAU)
- Arduino Mega (https://goo.gl/R8niyR)
Once you've found the pin-out for your board and you have all the necessary pins you can move onto step 3.
Now we need to connect all the dedicated pins we found on the components to the corresponding pins on your Arduino. Now the chances are that your components have dedicated pins and pins that just need to connect to the IO of the Arduino. So what you need to do is connect all the dedicated pins to the corresponding pins on your board and connect the rest the exact same way that the tutorial did as these are defined in the code. Once you've done that everything should work perfectly; however, if it doesn't, check out the next step for troubleshooting.
If worst comes to worst and it still doesn't work, your options are:
- Double check everything and I mean everything. It's so easy to miss a pin or plug something into the wrong socket.
- Make sure the wires/plugs you are using don't have false contacts inside of them. I often find that my male-to-male jumper wires have broken off at the connector which is very annoying to fix.
- Try it with a new Arduino. I've never had an Arduino break but it's very possible that something may be wrong with yours if all else fails.
I've accompanied a video with this (above) which should help make this more clear. Thank you so much for reading. I hope I could help. If you need any more help, please feel free to send me a message or comment, and I'll do my best to answer you.