Ardumotive Arduino Greek Playground
  • Home
    • About us
    • License
  • Arduino
    • Tutorials
    • Workshop
  • Raspberry Pi
  • DIY 3D Printer
  • News
    • Events >
      • Unboxing & Review
    • Blog
The 1st Arduino Playground in Greece - Open Source Hardware

Arduino Bluetooth Car with custom PCB

Available Languages
Picture
Picture

Εισαγωγή

Published date: 2/4/2017
Picture
Σε αυτόν τον οδηγό θα φτιάξουμε το δικό μας Arduino bluetooth αυτοκινητάκι. Για τον σχεδιασμό της PCB πλακέτας χρησιμοποιήσαμε το online πρόγραμμα σχεδίασης EasyEDA .

Παρακάτω θα βρείτε όλα τα αρχεία του πρότζεκτ μας από το easyeda.com ώστε να μπορέσετε να φτιάξετε και εσείς το κύριο κύκλωμα. 

Ας ξεκινήσουμε! 

Τα υλικά που θα χρειαστούμε: 

Στο συγκεκριμένο πρότζεκτ θα χρειαστούμε:
  • Την PCB πλακέτα μας
  • Atmega328 (with Arduino UNO bootloader)
  • 28 dip socket  & 2x 16 dip socket
  • 2x L293 IC 
  • 16 MHz κρύσταλλο
  • 10 uF πυκνωτή
  • 2x 22 pF πυκνωτές
  • 10 kΩ αντίσταση
  • Buzzer 
  • Bluetooth module HC-06
  • 4x κλέμες για PCB
  • Pin header 1x10 Θυλικό
  • Pin header 1x40 Αρσενικό
Picture
Επίσης θα χρειαστούμε ενα TTL to USB module ή ένα  Arduino UNO για τον προγραμματισμό του. 

Το κύκλωμα στο EasyEDA

Picture
 Μπείτε εδώ για να παραγγείλετε την PCB πλακέτα.

To EasyEDA είναι ένα δωρεάν εργαλείο σχεδίασης κυκλωμάτων το οποίο δεν απαιτεί καμία απολύτως εγκατάσταση απ' τον χρήστη, καθώς τρέχει online. Έχει σχεδιαστεί έτσι ώστε να μπορεί να δώσει μια πολύ πιο εύκολη εμπειρία χρήσης σε  ηλεκτρονικούς μηχανικούς, διδάσκοντες, μαθητές αλλά και απλούς χρήστες, πάνω στην σχεδίαση ηλεκτρονικών κυκλωμάτων. 
Είναι πολύ εύκολο να σχεδιάσεις τα κυκλώματα σου μέσα απ' το circuit design, να τα προσομοιώσεις μέσα απ' το circuit simulator και τέλος να τα εξάγεις σε μορφή PCB έτοιμα προς εκτύπωση, και όλα αυτά μέσα απ' το παράθυρο του browser σου!
Picture
Picture

Κώδικας

Συνδέουμε το TTL to USB module με το programming header όπως φαίνεται στο σχηματικό. 

Σημείωση: Στην περίπτωση που χρησιμοποιείτε το Arduino UNO για τον προγραμματισμό του θα πρέπει να αφαιρέσετε τον ATmega328 και να συνδέσετε τα RX και TX pins του header στα RX και TX pins αντίστοιχα του UNO. Επίσης το RS pin θα πρέπει να  συνδεθεί στο reset pin του Arduino.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/* Arduino Bluetooth Car
 * Created by Vasilakis Michalis // 2/4/17
 * More information at www.ardumotive.com
 */
#include <SoftwareSerial.h>

//Software serial connection
SoftwareSerial btSerial(A2,A3); // RX & TX
//L293 Connection   
  const int motorA1  = 5;  // Pin  2 of L293
  const int motorA2  = 3;  // Pin  7 of L293
  const int motorB1  = 11; // Pin 10 of L293
  const int motorB2  = 10;  // Pin 14 of L293
//Leds connected to Arduino UNO Pin 12
  const int lights  = 8;
//Buzzer / Speaker to Arduino UNO Pin 3
  const int buzzer = 2 ;   

//Useful Variables
  int i=0;
  int j=0;
  int state;


void setup() {
    // Set pins as outputs:
    pinMode(motorA1, OUTPUT);
    pinMode(motorA2, OUTPUT);
    pinMode(motorB1, OUTPUT);
    pinMode(motorB2, OUTPUT);
    pinMode(lights, OUTPUT); 
    // Initialize serial communication at 9600 bits per second:
    btSerial.begin(9600);
    Serial.begin(9600);
}
 
void loop() {
  //Save income data to variable 'state'
    if(btSerial.available() > 0){     
      state = btSerial.read(); 
      Serial.println(state);  
    }	  
  /***********************Forward****************************/
  //If state is equal with letter 'F', car will go forward!
    if (state == 'F') {
    	digitalWrite(motorA1, HIGH); digitalWrite(motorA2, 0);
      digitalWrite(motorB1, 0);      digitalWrite(motorB2, 0); 
    }
  /**********************Forward Left************************/
  //If state is equal with letter 'G', car will go forward left
    else if (state == 'G') {
    	digitalWrite(motorA1, HIGH); digitalWrite(motorA2, 0);  
      digitalWrite(motorB1, HIGH);    digitalWrite(motorB2, 0); 
    }
  /**********************Forward Right************************/
  //If state is equal with letter 'I', car will go forward right
    else if (state == 'I') {
      digitalWrite(motorA1, HIGH); digitalWrite(motorA2, 0); 
      digitalWrite(motorB1, 0);      digitalWrite(motorB2, HIGH); 
    }
  /***********************Backward****************************/
  //If state is equal with letter 'B', car will go backward
    else if (state == 'B') {
    	digitalWrite(motorA1, 0);   digitalWrite(motorA2, HIGH); 
      digitalWrite(motorB1, 0);   digitalWrite(motorB2, 0); 
    }
  /**********************Backward Left************************/
  //If state is equal with letter 'H', car will go backward left
    else if (state == 'H') {
    	digitalWrite(motorA1, 0);   digitalWrite(motorA2, HIGH); 
      digitalWrite(motorB1, HIGH); digitalWrite(motorB2, 0); 
    }
  /**********************Backward Right************************/
  //If state is equal with letter 'J', car will go backward right
    else if (state == 'J') {
    	digitalWrite(motorA1, 0);   digitalWrite(motorA2, HIGH); 
      digitalWrite(motorB1, 0);   digitalWrite(motorB2, HIGH); 
    }
  /***************************Left*****************************/
  //If state is equal with letter 'L', wheels will turn left
    else if (state == 'L') {
    	digitalWrite(motorA1, 0);   digitalWrite(motorA2, 0); 
      digitalWrite(motorB1, HIGH); digitalWrite(motorB2, 0); 
    }
  /***************************Right*****************************/
  //If state is equal with letter 'R', wheels will turn right
    else if (state == 'R') {
    	digitalWrite(motorA1, 0);   digitalWrite(motorA2, 0); 
      digitalWrite(motorB1, 0);   digitalWrite(motorB2, HIGH); 		
    }
  /************************Lights*****************************/
  //If state is equal with letter 'W', turn leds on or of off
    else if (state == 'W') {
      if (i==0){  
         digitalWrite(lights, HIGH); 
         i=1;
      }
      else if (i==1){
         digitalWrite(lights, LOW); 
         i=0;
      }
      state='n';
    }
  /**********************Horn sound***************************/
  //If state is equal with letter 'V', play (or stop) horn sound
    else if (state == 'V'){
      if (j==0){  
         tone(buzzer, 1000);//Speaker on 
         j=1;
      }
      else if (j==1){
         noTone(buzzer);    //Speaker off 
         j=0;
      }
      state='n';  
    }
  /************************Stop*****************************/
  //If state is equal with letter 'S', stop the car
    else if (state == 'S'){
        digitalWrite(motorA1, 0);  digitalWrite(motorA2, 0); 
        digitalWrite(motorB1, 0);  digitalWrite(motorB2, 0);
    }    
}
Κατεβάστε τον κώδικα απ' εδώ και ανοίξτε το αρχείο με το Arduino IDE. 
ardumotive_bt_car.zip
File Size: 1 kb
File Type: zip
Download File

Android Εφαρμογή

Picture
Κατεβάστε την εφαρμογή από εδώ:
ardumotivebt_v2.1.apk
File Size: 2264 kb
File Type: apk
Download File

Αρχικά ενεργοποιήστε το Bluetooth του κινητού ή tablet σας και συνδέστε το με το αυτοκινητάκι σας (π.χ. HC-06, κωδικός 1234).

Πατήστε το Help & Info για να καταλάβετε πως λειτουργεί. 

Υποστηριζόμενες λειτουργίες: 
  • 9 κουμπιά κατεύθυνσης 
  • Κουμπί για την κόρνα

Εναλλακτικά, στην περίπτωση που δεν δουλεύει η εφαρμογή στο κινητό ή tablet σας, μπορείτε να χρησιμοποιήσετε και  αυτή.
Picture

Search Engine

Picture

Licence 

Picture

Help us to grow up!

Picture


Donate us
About us
License
Cookies policy

Visit the biggest Arduino Shop in Greece!

Picture
find us on dwrean.net
find us on Codebender
find us on Instructables
Developed and designed by Vasilakis Michalis Copyright © 2013 Ardumotive All Rights Reserved
All trademarks referenced herein are properties of their
Powered by Create your own unique website with customizable templates.
Design by DivTag Templates
Ardumotive Arduino Greek Playground