بنابراین زمانی که من برای اولین بار کار با میکروکنترلرها را شروع کردم، آردوینو عمدتاً آزاردهندهترین چیزی بود که تا به حال این کار را انجام دادهام این بود که من آموزش دیگران را برای پروژهای دنبال میکردم و آنها از آردوینو uno استفاده میکردند، من از آردوینو میکرو یا چیزی دیگر استفاده میکردم. یک ساعت سیم کشی آن را دنبال کنید دستورالعمل ها را تکه تکه انجام دهید، برای روشن کردن آن بسیار هیجان زده شوید و همانطور که من مستقیماً این کار را انجام می دهم کار نمی کند - صدای خش خش ناشی از آن به این معنی بود که بسیاری از آردوینوها جان خود را از دست دادند. به هر حال، بعد از اینکه آرام شدم، گوگل کردم و علت و راه حلی را پیدا کردم که از آن زمان تاکنون استفاده کردم، در این مقاله امیدوارم آن را برای شما توضیح دهم، امیدوارم با هم بتوانیم به خشونت روی کنترلرهای Micro بی گناه پایان دهیم. همچنین تعداد زیادی کامنت را دیده ام که می پرسند "آیا می توانم از میکرو آردوینو به جای uno استفاده کنم"
مشکل این است که گاهی اوقات یک پروژه روی آردوینو uno کاملاً خوب کار می کند اما روی یک میکرو آردوینو اصلاً کار نمی کند و گاهی اوقات یک پروژه روی هر دو کاملاً کار می کند، آزاردهنده ترین چیز وقتی است که زمان زیادی را صرف سیم کشی چیزی می کنید و به طور ناگهانی به دلایلی کار نمی کند و هیچ کاری نمی توانید انجام دهید آن را به کار نمی اندازد، بنابراین من مراحلی را مستند می کنم که اغلب اوقات این مشکل را حل می کند.
مرحله 2: تفاوت ها
برای درک اینکه چرا این مشکل رخ می دهد، باید درک کنیم که بردهای آردوینو و در واقع اکثر میکرو کنترلرها دارای چیزی به نام پین های اختصاصی هستند که یک عملکرد مانند ارتباط SPI یا usb را انجام می دهند. آنها را می توان در پایه های io برد، به عنوان مثال پین پیدا کرد. A5 در آردوینو Uno یک پین آنالوگ است اما یک پایه scl اختصاصی نیز دارد. بسیاری از پینها نیز عملکردهای اختصاصی دارند و مشکل ما اینجاست، بگذارید بگوییم آموزشی که استفاده میکنید میگوید کامپوننت خود را به پین A5 در Uno وصل کنید تا کامپوننت بتواند از پین اختصاصی scl استفاده کند، اما اگر از آن استفاده میکنید میکرو آردوینو کار نمی کند زیرا پین scl روی a5 نیست و روی پایه 4 میکرو قرار دارد. کمی پیچیده است اما اگر متوجه نشدید نگران نباشید! برای رفع این مشکل می توانید مراحل را بدون اینکه متوجه شوید دنبال کنید.
مرحله 3: مرحله 1
ابتدا باید اجزایی را که میخواهید استفاده کنید بررسی کنیم و سعی کنیم پینهای اختصاصی را که ممکن است روی آنها وجود داشته باشد شناسایی کنیم.
- SCL (خط ساعت)
- SDA (خط داده)
- MISO (Master in Slave Out)
- MOSI (Master Out Slave In)
- SS (Slave Select)
- TX (ارتباطات USB)
- RX (ارتباط USB)
اگر هیچکدام از این موارد را پیدا نکردید و پروژه شما هنوز کار نمیکند، باید پینآوت برد را پیدا کنید، دستورالعملهایی که دنبال میکنید و ببینید آیا قطعات به پینهای اختصاصی متصل میشوند یا خیر. ممکن است روی کامپوننت برچسب گذاری نشده باشد و باید به آن بروید، اگر به یک پین اختصاصی متصل نیست، باید قسمت عیب یابی این مقاله را بررسی کنید.
مرحله 4: مرحله 2![شماتیک آیا می توانم از Arduino Uno برای این کار استفاده کنم؟](https://duino4projects.com/wp-content/uploads/2017/07/Schematic-Can-I-Use-an-Arduino-Uno-for-This.jpg)
ثانیاً باید مطمئن شویم که آردوینو مورد استفاده ما تمام پینهای اختصاصی مورد نیاز اجزای ما را دارد، برای مثال اگر قطعات شما دارای پین SDA، MOSI و MIso هستند، آردوینویی که استفاده میکنید باید آنها را نیز داشته باشد، میتوانید این را پیدا کنید. با گوگل کردن بردی که استفاده می کنید و اضافه کردن پین اوت، فقط به تصاویر نگاه کنید و باید لیستی از پین های اختصاصی را مشاهده کنید، در غیر این صورت پیوندهایی را به پین اوت های همه بردهای محبوب آردوینو اضافه کنید.
برای جزئیات بیشتر: آیا می توانم از Arduino Uno برای این کار استفاده کنم؟
در ادامه، متن انگلیسی این مطلب را میتوانید مشاهده نمایید:
So back when I first started working with micro controllers, Arduinos mainly the most annoying this ever was when i would follow someones tutorial for a project and they would use the Arduino uno, I would be using the Arduino micro or something, 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 iv 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 looooots 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 wont work at all on an arduino micro and sometimes a project will work perfectly on both, its the most annoying thing when you spend a tone of time wiring something up and it suddenly doesn’t work for some reason and nothing you can do will get it working so im going to document the steps that will solve this issue most of the time
Step 2: The Differences
To understand why this problem occurs we need 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 its also a dedicated scl pin. a lot of the pins also have dedicated functions and this is where our problem arises, lets 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 wont work because the scl pin isnt on a5 of the micro its on pin 4. Its a bit complicated but if you dont understand it dont worry! You can follow the steps to fix this problem without understanding this.
Step 3: Step 1
first we need to look at the components that you want to use and try and identify any dedicated pins that may be on them they are normally labelled 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 comminication)
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 board the instructions you are following are using and see if the components connects to any dedicated pins if it does it may have just not been labeled on the component and you should move step to, if it isnt connected to a dedicated pin you should check the troubleshooting part of this article.
Step 4: Step 2![Schematic Can I Use an Arduino Uno for This](https://duino4projects.com/wp-content/uploads/2017/07/Schematic-Can-I-Use-an-Arduino-Uno-for-This.jpg)
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, ill add links to the pin-outs of all the most popular Arduino boards
For more detail: Can I Use an Arduino Uno for This?