วันพุธที่ 25 กรกฎาคม พ.ศ. 2561

(งาน10) https://www.instructables.com/id/How-to-control-an-arduino-car-via-Bluetooth-for-be/


HOW TO CONTROL AN ARDUINO CAR VIA BLUETOOTH (FOR BEGINNERS)


132,508
283
149
Published 


Introduction: How to Control an Arduino Car Via Bluetooth (for Beginners)

Picture of How to Control an Arduino Car Via Bluetooth (for Beginners)
All we know that Arduino is an excellent prototyping platform, principally because it uses a friendly programming language and there are a lot of extra incredible components that provide us great experiences.
We can integrate the Arduino with differents shields or modules and build fantastic things. In this project i will show you how use the Bluetooth module to control a robot platform through commands coming from a smartphone.

Step 1: Parts

Picture of Parts
Picture of Parts
Picture of Parts
2 More Images
Hardware:
  1. Arduino Uno
  2. Motor Shield L293D Driver
  3. Bluetooth Module
  4. Robot platform
Software:
  1. Arduino IDE
  2. Bluetooth RC Controller (you can download this app here)

Step 2: Mount the Hardware

Picture of Mount the Hardware
The mounting of the robotic platform is very easy. If you buy one like that, you will receive a manual with all steps.
To connect the electric circuit, you have to fit the shield on the Arduino and then connecting the motors to the shield. After that you have to connect the bluetooth module. The module pins depends on what you are using, but basically it has: VCC (connected to the 5V pin of the Arduino), GND (connected on GND on Arduino), RX (connected to the TX pin of the arduino) and TX (connected to the RX pin of the Arduino).

Step 3: Software

Picture of Software
Picture of Software
Picture of Software
The code is also uncomplicated.
- To control the motors, i used the library <AFMotor.h>.
- The communication between the smartphone and the Bluetooth module was done using the serial communication arduino.
- The app "Bluetooth RC Controller" send to the bluetooth module the following commands:
  • Forward -> F
  • Back -> B
  • Left -> L
  • Right -> R
  • Forward Left -> G
  • Forward Right -> I
  • Back Left -> H
  • Back Right -> J
  • Stop -> S
  • Front Lights On -> W
  • Front Lights Off -> w
  • Back Lights On -> U
  • Back Lighst Off -> u
  • Horn On -> V
  • Horn Off -> v
  • Extra On -> X
  • Extra Off -> x
  • Speed 0 -> 0
  • Speed 10 -> 1
  • Speed 20 -> 2
  • Speed 30 -> 3
  • .
  • .
  • .
  • Speed 90 -> 9
  • Speed 100 -> q
  • Stop All -> D
In this project was used just the basic commands: Forward, Back, Left and Right.
The entire code is available for you to download.

Step 4: You Are Done

Now you have all you need to build your own robot controlled by a smartphone via Bluetooth. Easy and Funny.
THANK YOU

(งาน9) https://www.instructables.com/id/EAL-Arduino-Hovercraft/


EAL - ARDUINO HOVERCRAFT


13,513
58
6
Published 


Introduction: EAL - Arduino Hovercraft

Picture of EAL - Arduino Hovercraft
About: This profile is for uploading a schoolproject. The project is made by Michael Hiul, Thomas Staerk and Tobias Boergstroem 
For our school project, we needed to integrate arduino into an automated system/machine etc.
We chose to make an arduino controlled hovercraft.

Step 1: Part List

Picture of Part List
Picture of Part List
Picture of Part List
Picture of Part List
3 More Images
1. The base part of the hovercraft is made of flamingo. We used a big square of it, that we cut out in the wanted dimensions and made the front-end circular.
2. 2x DC motors, for rotating the propel and the fan.
3. A stepper motor driver
4. A frame, for holding the motors. For our hovercraft, we made the frame out of wood and acryl.
5. A bluetooth module, for controlling the hovercraft. We used a HC-05 Bluetooth Module.
6. Arduino board, breadboard, wires, 9v batteries and a 12v adapter. We used the Arduino Mega 2560.
7. Propeller + Fan. We downloaded our propeller from Thingiverse, and printed them at our school ( http://www.thingiverse.com/thing:1733112 ) We use the same propeller as propel and fan, but removed the outer circle on the fan.

Step 2: Making the Boat

Picture of Making the Boat
Picture of Making the Boat
Picture of Making the Boat
2 More Images
In the center of the base, we cut a hole for the fan, which is going to levitate the hovercraft.
On the bottom, we wrapped on a plastic bag, and poked a lot of small holes in it, to make the air run through, and make the hovercraft levitate
We then used duct tape to secure the plastic bag, and to make sure that the flamingo does not dissolve into small pieces.
The frame was then placed on top of the hovercraft, and held together with glue. On top of the frame, and above the hole is an acrylic plate, for mounting the motors.
The propel/fan is glued to the motors and the motors and glued to the acrylic plates.

Step 3: The Mechanical Part

Picture of The Mechanical Part
Picture of The Mechanical Part
Picture of The Mechanical Part
First part is to wire the arduino. We use 1x 9v battery to power the arduino, trough the 12v adapter
We then wire the motor driver to the arduino to pin 3+4 for the propel and pin 8+9 for the fan.
Then we wire the motors to the motor driver. The motor driver is also wired to ground, and to 3 parallel connected 9v batteries, theese power the motors.
We then wire the bluetooth module to the arduino, through a breadboard, because we need to have resisters between.

Step 4: Software

Picture of Software
Picture of Software
For controlling the hovercraft, we use bluetooth, and then controls the hovercraft from our smartphone.
For making the app for our smartphone, we used the free online program, MIT App Inventor (http://appinventor.mit.edu). From our phone, we can now make the hovercraft move forward, backwards and stop.
We programmed our arduino board in the free Arduino program.
<p>/*<br> 
 */
 
int motor1Pin1 = 3; // Makes the hovercraft go forward
int motor1Pin2 = 4; // Makes the hovercraft go backward</p><p>int motor2Pin1 = 8; // Turns on the fan
int motor2Pin2 = 9; //</p><p>int state;
int flag=0;        //makes sure that the serial only prints the state once
int stateStop=0;
void setup() {
    // sets the pins as outputs
    pinMode(motor1Pin1, OUTPUT);
    pinMode(motor1Pin2, OUTPUT);</p><p>    pinMode(motor2Pin1, OUTPUT);
    pinMode(motor2Pin2, OUTPUT);</p><p>    // initialize serial communication at 9600 bits per second
    Serial.begin(9600);
}</p><p>void loop() {
    //if some data is sent, reads it and saves in state
    if(Serial.available() > 0){     
      state = Serial.read();   
      flag=0;
    }   
    // if the state is 'F' the Hovercraft will go forward
    if (state == 'F') {
        digitalWrite(motor1Pin1, HIGH);
        digitalWrite(motor1Pin2, LOW); 
        digitalWrite(motor2Pin1, HIGH);
        digitalWrite(motor2Pin2, LOW);
        if(flag == 0){
          Serial.println("Go Forward!");
          flag=1;
        }
    }
    
    // if the state is 'S' the hovercraft will turn off
    else if (state == 'S' || stateStop == 1) {
        digitalWrite(motor1Pin1, LOW); 
        digitalWrite(motor1Pin2, LOW); 
        digitalWrite(motor2Pin1, LOW);
        digitalWrite(motor2Pin2, LOW);
        if(flag == 0){
          Serial.println("STOP!");
          flag=1;
        }
        stateStop=0;
    }</p><p>    // if the state is 'B' the hovercraft will go backwards
    else if (state == 'B') {
        digitalWrite(motor1Pin1, LOW); 
        digitalWrite(motor1Pin2, HIGH);
        digitalWrite(motor2Pin1, HIGH);
        digitalWrite(motor2Pin2, LOW);
        if(flag == 0){
          Serial.println("Reverse!");
          flag=1;
        }
    }
}</p>

Step 5: Improvements

Picture of Improvements
First of all, we should have had some faster motors, so that the hovercraft would have more power and more easily levitate.
We should have made the body thinner, so its weight is reduced.
To make the hovercraft steer, you need a module which can push and drag and a fin to steer. Unfortunately, we never got the module that we ordered, so we did not get to make the hovercraft steer.
Sensors, we considered putting sensors on the front of the hovercraft, so it would stop when it got close to an object. We did not get to make this, because we ran into so many troubles that we simply did not have the time.

(งาน8) https://www.makerspaces.com/15-simple-arduino-uno-breadboard-projects/




arduino-uno-breadboard-switch

FREE EBOOK (PDF) – Ultimate Beginners Guide To Arduino

The easiest way for beginners to get started with Arduino is by creating circuits using a solderless breadboard.  These simple projects will teach you the basics of Arduino Uno, electronics and programming.   In this tutorial, you will be creating circuits using the following electronic components:
  • LED
  • RGB LED
  • Temp Sensor
  • Pushbutton
  • Potentiometer
  • Photoresistor
  • Servo
  • Motor
  • Buzzer
  • LCD screen
This tutorial is going to allow you to jump right in and start building circuits.  If you need some background on the Arduino Uno board or the tools that are needed, please check out post – Arduino Uno For Beginners.

Getting Started

Before you can start working with Arduino, you need to make sure you have the IDE software installed on your computer.  This program allows you to write, view and upload the code to your Arduino Uno board.  You can download the IDE for free on Arduino’s website.
Once the IDE is installed, you will need to connect your Arduino to your computer.  To do this, plug one end of the USB cable to the Arduino Uno and then the other end of the USB to your computer’s USB port.

Select The Board

Once the board is plugged in, you will need to open the IDE and click on Tools > Board > Arduino Uno to select the board.

select arduino board

Select Serial Port

Next, you have to tell the Arduino which port you are using on your computer.  To select the port, go to Tools > Port and then select the port that says Arduino.

select arduino port

Project Code

To complete the projects in this tutorial, you will need to download the project code which are known as sketches.  A sketch is simply a set of instructions that tells the board what functions it needs to perform.  For some of these projects, we are using open-source code that was released by the good people at Sparkfun and Arduino.  Use the link below to download the zip folder containing the code.
Once the file has been downloaded, you will need to unzip/extract the folder in order to use it.

#1 – Test Arduino

The first project is one of the most basic and simple circuits you can create with Arduino.  This project will test your Arduino by blinking an LED that is connected directly to the board.
Parts Needed
  • (1) Arduino Uno
  • (1) USB A-to-B Cable
  • (1) LED 5mm
  • (1) 220 Ω Resistor
Project Diagram
arduino uno projects for beginners
Click Image To Enlarge
Project Steps
  1. Twist a 220 Ω resistor to the long leg (+) of the LED.
  2. Push the short leg of the LED into the ground (GND) pin on the board.
  3. Push the resistor leg that’s connected to the LED into the #13 pin.
Project Code
  1. Connect the Arduino board to your computer using the USB cable.
  2. Open project code  –  Circuit_01_TestArduino
  3. Select the board and serial port as outlined in earlier section.
  4. Click upload button to send sketch to the Arduino.

#2 – Blink an LED

This project is identical to project #1 except that we will be building it on a breadboard.  Once complete, the LED should turn on for a second and then off for a second in a loop.
Parts Needed
  • (1) Arduino Uno
  • (1) USB A-to-B Cable
  • (1) Breadboard – Half Size
  • (1) LED 5mm
  • (1) 220 Ω Resistor
  • (2) Jumper Wires
Project Diagram
arduino uno projects for beginners
Click Image To Enlarge
Project Code
  1. Connect the Arduino board to your computer using the USB cable.
  2. Open project code  –  Circuit_02_Blink
  3. Select the board and serial port as outlined in earlier section.
  4. Click upload button to send sketch to the Arduino.

#3 – Push Button

Using a push button switch, you will be able to turn on and off an LED.
Parts Needed
  • (1) Arduino Uno
  • (1) USB A-to-B Cable
  • (1) Breadboard – Half Size
  • (1) LED 5mm
  • (1) 220 Ω Resistor
  • (1) 10K Ω Resistor
  • (1) Push Button Switch
  • (6) Jumper Wires
Project Diagram
arduino uno projects for beginners
Click Image To Enlarge
Project Code
  1. Connect the Arduino board to your computer using the USB cable.
  2. Open project code  –  Circuit_03_Pushbutton
  3. Select the board and serial port as outlined in earlier section.
  4. Click upload button to send sketch to the Arduino.

#4 – Potentiometer

Using a potentiometer, you will be able to control the resistance of an LED.  Turning the knob will increase and decrease the frequency the LED blinks.
Parts Needed
  • (1) Arduino Uno
  • (1) USB A-to-B Cable
  • (1) Breadboard – Half Size
  • (1) LED 5mm
  • (1) 220 Ω Resistor
  • (1) Potentiometer (10k Trimpot)
  • (6) Jumper Wires
Project Diagram
arduino uno projects for beginners
Click Image To Enlarge
Project Code
  1. Connect the Arduino board to your computer using the USB cable.
  2. Open project code  –  Circuit_04_Potentiometer
  3. Select the board and serial port as outlined in earlier section.
  4. Click upload button to send sketch to the Arduino.

#5 – Fade an LED

By using a PWM pin on the Arduino, you will be able to increase and decrease the intensity of brightness of an LED.
Parts Needed
  • (1) Arduino Uno
  • (1) USB A-to-B Cable
  • (1) Breadboard – Half Size
  • (1) LED 5mm
  • (1) 220 Ω Resistor
  • (2) Jumper Wires
Project Diagram
arduino uno projects for beginners
Click Image To Enlarge
Project Code
  1. Connect the Arduino board to your computer using the USB cable.
  2. Open project code  –  Circuit_05_Fade
  3. Select the board and serial port as outlined in earlier section.
  4. Click upload button to send sketch to the Arduino.

#6 – Scrolling LED

This project will blink 6 LEDs, one at a time, in a back and forth formation.  This type of circuit was made famous by the show Knight Rider which featured a car with looping LEDs.
Parts Needed
  • (1) Arduino Uno
  • (1) USB A-to-B Cable
  • (1) Breadboard – Half Size
  • (6) LED 5mm
  • (6) 220 Ω Resistor
  • (7) Jumper Wires
Project Diagram
arduino uno projects for beginners
Click Image To Enlarge
Project Code
  1. Connect the Arduino board to your computer using the USB cable.
  2. Open project code  –  Circuit_06_Scrolling
  3. Select the board and serial port as outlined in earlier section.
  4. Click upload button to send sketch to the Arduino.

#7 – Bar Graph

Using a potentiometer, you can control a series of LEDs in a row.  Turning the potentiometer knob will turn on or off more of the LEDs.
Parts Needed
  • (1) Arduino Uno
  • (1) USB A-to-B Cable
  • (1) Breadboard – Half Size
  • (1) Potentiometer – Rotary
  • (10) LED 5mm
  • (10) 220 Ω Resistor
  • (11) Jumper Wires
Project Diagram
arduino uno projects for beginners
Click Image To Enlarge
Project Code
  1. Connect the Arduino board to your computer using the USB cable.
  2. Open project code  –  Circuit_07_BarGraph
  3. Select the board and serial port as outlined in earlier section.
  4. Click upload button to send sketch to the Arduino.

#8 – Multiple LEDs

This project will use 8 pins on the Arduino board to blink 8 LEDs at the same time.
Parts Needed
  • (1) Arduino Uno
  • (1) USB A-to-B Cable
  • (1) Breadboard – Half Size
  • (8) LED 5mm
  • (8) 330 Ω Resistor
  • (9) Jumper Wires
Project Diagram
arduino uno projects for beginners
Click Image To Enlarge
Project Code
  1. Connect the Arduino board to your computer using the USB cable.
  2. Open project code  –  Circuit_08_MultipleLEDs
  3. Select the board and serial port as outlined in earlier section.
  4. Click upload button to send sketch to the Arduino.

#9 – RGB LED

This project will be using an RGB LED to scroll through a variety of colors.  RGB stands for Red, Green and Blue and this LED has the ability to create nearly unlimited color combinations.
Parts Needed
  • (1) Arduino Uno
  • (1) USB A-to-B Cable
  • (1) Breadboard – Half Size
  • (1) RGB LED
  • (3) 330 Ω Resistor
  • (5) Jumper Wires
Project Diagram
arduino uno projects for beginners
Click Image To Enlarge
Project Code
  1. Connect the Arduino board to your computer using the USB cable.
  2. Open project code  –  Circuit_09_RGBLED
  3. Select the board and serial port as outlined in earlier section.
  4. Click upload button to send sketch to the Arduino.

#10 – Photoresistor

A photoresistor changes the resistance a circuit gets based on the amount of light that hits the sensor.  In this project, the brightness of the LED will increase and decrease based on the amount of light present.
Parts Needed
  • (1) Arduino Uno
  • (1) USB A-to-B Cable
  • (1) Breadboard – Half Size
  • (1) LED 5mm
  • (1) 330 Ω Resistor
  • (1) 10K Ω Resistor
  • (1) Photoresistor
  • (6) Jumper Wires
Project Diagram
arduino uno projects for beginners
Click Image To Enlarge
Project Code
  1. Connect the Arduino board to your computer using the USB cable.
  2. Open project code  –  Circuit_10_Photoresistor
  3. Select the board and serial port as outlined in earlier section.
  4. Click upload button to send sketch to the Arduino.

#11 – Temp. Sensor

A temperature sensor measures ambient temperatures of the world around it.  In this project, we will be displaying the temperature in the serial monitor of the Arduino IDE.
Parts Needed
  • (1) Arduino Uno
  • (1) USB A-to-B Cable
  • (1) Breadboard – Half Size
  • (1) Temperature Sensor – TMP36
  • (5) Jumper Wires
Project Diagram
arduino uno projects for beginners
Click Image To Enlarge
Project Code
  1. Connect the Arduino board to your computer using the USB cable.
  2. Open project code  –  Circuit_11_TempSensor
  3. Select the board and serial port as outlined in earlier section.
  4. Click upload button to send sketch to the Arduino.

#12 – Tone Melody

The project will use a piezo buzzer/speaker to play a little melody.
Parts Needed
  • (1) Arduino Uno
  • (1) USB A-to-B Cable
  • (1) Breadboard – Half Size
  • (1) Piezo Buzzer/Speaker
  • (2) Jumper Wires
Project Diagram
arduino uno projects for beginners
Click Image To Enlarge
Project Code
  1. Connect the Arduino board to your computer using the USB cable.
  2. Open project code  –  Circuit_12_ToneMelody
  3. Select the board and serial port as outlined in earlier section.
  4. Click upload button to send sketch to the Arduino.

#13 – Servo

In this project, you will be able to sweep a servo back and forth through its full range of motion.
Parts Needed
  • (1) Arduino Uno
  • (1) USB A-to-B Cable
  • (1) Breadboard – Half Size
  • (1) Servo
  • (6) Jumper Wires
Project Diagram
arduino uno projects for beginners
Click Image To Enlarge
Project Code
  1. Connect the Arduino board to your computer using the USB cable.
  2. Open project code  –  Circuit_13_Servo
  3. Select the board and serial port as outlined in earlier section.
  4. Click upload button to send sketch to the Arduino.

#14 – Motor

Using a switching transistor, we will be able to control a DC motor.  If everything is connected correctly, you should see the motor spinning.
Parts Needed
  • (1) Arduino Uno
  • (1) USB A-to-B Cable
  • (1) Breadboard – Half Size
  • (1) DC Motor
  • (1) 330 Ω Resistor
  • (1) Diode 1N4148
  • (1) NPN Transistor
  • (6) Jumper Wires
Project Diagram
arduino uno projects for beginners
Click Image To Enlarge
Project Code
  1. Connect the Arduino board to your computer using the USB cable.
  2. Open project code  –  Circuit_14_Motor
  3. Select the board and serial port as outlined in earlier section.
  4. Click upload button to send sketch to the Arduino.

#15 – LCD Screen

An LCD is a liquid crystal display that is able to display text on its screen.  In this project, you should see the words “hello,world!” displayed on the screen.  The potentiometer is used to adjust the contrast of the display.
Parts Needed
  • (1) Arduino Uno
  • (1) USB A-to-B Cable
  • (1) Breadboard – Half Size
  • (1) LCD Screen
  • (1) Potentiometer
  • (16) Jumper Wires
Project Diagram
arduino uno projects for beginners
Click Image To Enlarge
Project Code
  1. Connect the Arduino board to your computer using the USB cable.
  2. Open project code  –  Circuit_15_LCD
  3. Select the board and serial port as outlined in earlier section.
  4. Click upload button to send sketch to the Arduino.

Troubleshooting

  • Make sure your board and serial port is selected in the IDE.  To do this, plug your board in and go to Tools > Board >Arduino to select your board.  Next, go to Tools > Port >Com (Arduino) to select your serial port.
  • The long leg of the LED is the (+) positive and the short leg is the (-) negative.  Make sure the correct leg of the LED is in the proper pin of the Arduino or breadboard as directed.
  • It can be easy to put a component or jumper into the wrong pin on the Arduino or the breadboard.  Double check the correct pin is being used.