DC MOTOR CONTROL WITH BLUETOOTH [TUTORIAL ARDUINO LESSON 29]

in #utopian-io8 years ago

Hello to everyone,
We continue our Arduino lessons. In this lesson we will do motor control using Bluetooth module. If we want to step into big projects with Arduino, we need to learn motor control. That is why this class is very important. In our class we will write Arduino UNO card with Arduino IDE program. In the next lesson we will learn element connections with the Fritzing program. We start our software lesson.

Herkese merhaba,
Arduino derslerimize devam ediyoruz. Bu dersimizde Bluetooth modülü kullanarak motor kontrolü yapacağız.Arduino ile büyük projelere adım atmak istiyorsak motor kontrolünü öğrenmemiz gerekir. Bu yüzden bu dersimiz oldukça önemlidir. Dersimizde Arduino UNO kartına Arduino IDE programıyla yazılım yazacağız. Bundan sonraki dersimizde ise Fritzing programıyla eleman bağlantılarını öğreneceğiz. Yazılım dersimize başlıyoruz.

Devrede kullanacağımız elemanlar:

Bu projede en büyük avantajımız mobil tasarıma gerek duyulmaması. Devre ile iletişime geçmek için gerekli olan Android uygulamayı Uygulama Mağazasından BlueTerm programını indirerek gerçekleştirebileceğiz. Uygulamadan biraz bahsetmek gerekirse; kendisine ait seri haberleşme sistemi ile etkin olan bluetooth modüllü cihazı bularak iki cıhazı etkileşime geçiren uygulamadır.

Şimdi yazılım işlemine geçebiliriz.
1.AŞAMA
Bu aşamada pinlerimizi tanıtacağız. Pin tanıtım işlemlerinden sonra BlueTerm uygulamasından alınan verileri kaydetmek için değişken tanımlamamız gerekiyor.
bandicam 2017-12-25 21-26-57-939.jpg
KOD:
int motorPin1 = 3;
int motorPin2 = 4;
int enablePin = 5;
int durum;
int bayrak=0;
2.AŞAMA
Pin tanıtma ve değişken tanıtma işlemlerimiz bitti. Şimdi kurulum aşamasına yani Void Setup aşamasına başlıyoruz. Bu aşamada giriş çıkış pinlerini belirleyeceğiz. Ardından motorun çalışabilmesini sağlayacak olan komutumuzu gireceğiz. Daha sonra bluetooth modülü ile seri iletişim komutunu yanı seri başlangıç komutunu girerek kurulum aşamasını tamamlayacağız.
bandicam 2017-12-25 21-30-22-371.jpg
KOD:
pinMode (motorPin1, OUTPUT);
pinMode (motorPin2, OUTPUT);
pinMode (enablePin, OUTPUT);
digitalWrite (enablePin, HIGH);
Serial.begin(9600);
3.AŞAMA
Void setup aşamasını bitirdikten sonra loop döngüsüne başlıyoruz. Bu aşamada sistemimizin çalışma şartlarını tanımlayacağız. Veri alışverisi olursa o anki motorun durumunun okunmasını ve kayıt etmesini isteyeceğiz. Sonraki şartımızda eğer mobil cihazdan "0" verisi gelirse motorun durmasını isteyeceğiz.Bir sonra ki şartımız ise eğer mobil cihazdan "1" verisi gelirse motor sağa dönsün, eğer mobil cihazdan "2" komutu gelirse motor sağa dönsün şartları olacaktır. Belirttiğim şartlar altında kodlarımızı giriyoruz ve projemizin yazılım aşamasını bitirmiş oluyoruz.
bandicam 2017-12-25 21-35-11-770.jpg
KOD:
{
if (Serial.available ()> 0 )
durum = Serial.read () ;
bayrak=0;
}
if (durum == '0') {
digitalWrite (motorPin1, LOW);
digitalWrite (motorPin2, LOW);
if ( bayrak == 0 ) {
Serial.println ( "Motor: kapalı") ;
bayrak=1;
}
}
else if (durum == '1' ) {
digitalWrite (motorPin1, LOW);
digitalWrite (motorPin2, HIGH);
if (bayrak == 0){
Serial.println ("Motor: sağa dönüyor") ;
bayrak=1;
}
}
else if ( durum == '2' ) {
digitalWrite (motorPin1, HIGH);
digitalWrite (motorPin2, LOW);
if (bayrak == 0) {
Serial.println ("Motor: sola dönüyor") ;
bayrak=1;
}
}

Yazılım dersimiz bu kadardı. UNO kartımız hazır. Hazır olan kartımızı devreye ekleyerek projemizi oluşturabiliriz. Bluetooth modülü ile motor kontrol yazılımını bu derste öğrenmiş olduk. Aynı projenin Fritzing ile eleman bağlantılarını videolu bir anlatımla yapacağım. Şimdilik hoşçakalın. İyi çalışmalar.
GITHUB



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

hocam çok faydalı bir post olmuş . elinize sağlık ..
kanalıma bakarsanız sevinirim :)
https://steemit.com/@vordexus

Teşekkür ederim

Congratulations @sametceylan! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the total payout received

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by sametceylan from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews/crimsonclad, and netuoso. The goal is to help Steemit grow by supporting Minnows and creating a social network. Please find us in the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP. Be sure to leave at least 50SP undelegated on your account.

This post has received a 0.17 % upvote from @drotto thanks to: @banjo.

Resteemed your article. This article was resteemed because you are part of the New Steemians project. You can learn more about it here: https://steemit.com/introduceyourself/@gaman/new-steemians-project-launch

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @sametceylan I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x