Showing posts with label board. Show all posts
Showing posts with label board. Show all posts

Monday, November 30, 2015

Remote Controlled Arduino Motor

In these blog we are going to learn that how to build an arduino dual motor shield and how we can decode and used the infrared remote.


Remote controlled Arduino motor

Step 1: Parts and assembly!

Remote controlled Arduino motor


Remote controlled Arduino motor


Remote controlled Arduino motor




















Parts:


- L298 Motor Driver (x1)

- Vero board (x1)
- Male or female Header Strip (enough to fit your arduino (32)) 

- 1N4007 Diodes (x8)

- 0.1uf and a 22uf capacitor

- Block connectors (x3)

- Jumper Wires

NOTE: 

+5V connected to the E1-2 & E2-3 and these pins are enable pins so we are not connected to the block connector in these we need to add servo for steering and need enough PWM pins. 
In these blog we are going to use the Red,Green LED’s and 2.2KHM resistor and counted on the serial communication.

Assembly:-

You can etch a circuit board and we are going to use the jumper wires.
In this blog firstly you can cut them so that it can be match your arduino pins if we are not using all pins then its is better to fit the headers on all of them so its looking very nice and stable.

then place the headers like you would any component and solder from beneath.

L1 and L2 are connected to Arduino pins 5 and 6 respectively which control motor (A) on pins 2,3 of l298 (forwards and backwards).

L3 and L4 are connected to Arduino pins 9 and 10 respectively .which control motor (B)on pins 13,14 of l298(forwards and backwards).

Step 2: Decode an IR remote.

Remote controlled Arduino motor



In this blog the most important part is IR receiver.

You could either buy it or salvage it from and remote controlled device.

Pin1 of IR receiver goes to pin 11 of arduino , pin2 to ground ,pin 3 to +5v.

That’s everything for the hardware, now upload the attached file "IR-Decoder" to you arduino and open serial and make sure the baud rate is 9600.

Now get a remote and start clicking you should start getting values on the screen.

You need 2 buttons for the forwards direction(increase and decrease speed), 2 buttons for the backwards direction(increase and decrease speed),and 1 button for stop.

You choose whatever buttons you need .

NOTE: 
Some of you may have noticed that if you press the same button for a long duration you'll get a different value which won’t work in the code, so you have to click the button gradually not continuously.
I found a lot of TV remotes that give you the same values while pressed for a long duration(example: Sony),you just need to keep testing remotes.

The code will work fine even if you don't find one but its better and faster this way.


#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
  delay(100);
}

Step 3: Updating and uploading the code.

Now we're done with the IR-Decode file,we don't need it anymore,we only need the values that we noted.

now take these values and place them here but in the code(attached file):

#define upi 0x"value" ...(up increase)

#define upd 0x"value"... (up decrease)

#define Stop 0x"value" ...(stop)

#define downi 0x"value" ...(down increase)

#define downd 0x"value" ..(down decrease)

replace the ones in the quotes " replace" .

If your decoding and you get letters and numbers at the same time you have to place a 0x at the beginning, if you only have numbers don't place it. 

So now connect everything up, place the shield on the arduino solder the IR Receiver pins as described before on the shield, connect the USB, and upload only the motor-shield-dual-motor-variable-speed file which you modified.

And after uploading open Serial and check if you’re getting feedback and attach one motor at a time because the arduino alone can’t handle two motors so it starts glitching.

After checking everything remove the USB cable connect an external power supply (12-18vdc)

and test both motors at the same time .

Note:-

if your motors aren’t rotating in the same direction and you dont want to flip the pins on the arduino or change the pins in the code just reverse the polarity of the motor

UPDATE:

I updated the code so that if you’re going forwards and u suddenly went backwards without stopping I’ll momentarily stop and start reversing and no matter how many times you pressed forwards and backwards without stopping you'll start from initial value or speed 0.

#include <IRremote.h>
#define upi 0x10FED22D
#define upd 0x10FE50AF
#define Stop 0x10FEB04F
#define downi 0x10FE30CF
#define downd 0x10FE926D
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
int outPin1 = 9;
int outPin2 = 10;
int outPin3 = 5;
int outPin4 = 6;
int i=0,j=0,a=0,b=0,c=0,d=0;
void setup()
{
Serial.begin(9600); 
pinMode(outPin1, OUTPUT);
pinMode(outPin2, OUTPUT);
pinMode(outPin3, OUTPUT);
pinMode(outPin4, OUTPUT);
irrecv.enableIRIn(); 
}
void loop()
{
if (irrecv.decode(&results))
{
irrecv.resume();
if(results.value== upi){
delay(30);
if(a>=1){
  i+=5;
   }
Serial.println(i);
digitalWrite(outPin2, LOW);
digitalWrite(outPin4, LOW);
Serial.println("increase speed forwards");
   a++;
if(i>250){
   i=250;
}
if(j<=250 && j>=0){
  j=0;
  c=0;
}
analogWrite(outPin1,i);
delay(100);
analogWrite(outPin3,i);
}
if(results.value== upd){
delay(30);
Serial.println(i);
if(b>=1){
  i-=5;
  }
digitalWrite(outPin2, LOW);
digitalWrite(outPin4, LOW);
Serial.println("decrease speed forwards");
   b++;
if(i<0 ){
   i=0;
}
analogWrite(outPin1,i);
delay(100);
analogWrite(outPin3,i);
}
if(results.value== downi){
delay(30);
if(c>=1){
   j+=5;
  }
Serial.println(j);
digitalWrite(outPin1, LOW);
digitalWrite(outPin3, LOW);
Serial.println("increase speed backwards");
   c++;
if(j>250){
   j=250;
}
if(i<=250 && i>=0){
  i=0;
  a=0;
}
analogWrite(outPin2,j);
delay(100);
analogWrite(outPin4,j);
}
if(results.value== downd){
delay(30);
Serial.println(j);
if(d>=1){
  j-=5;
  }
digitalWrite(outPin1, LOW);
digitalWrite(outPin3, LOW);
Serial.println("decrease speed backwards");
  d++;
if(j<0){
  j=0;
}
analogWrite(outPin2,j);
delay(100);
analogWrite(outPin4,j);
}
if(results.value== Stop){
delay(30);
  i=0;
  j=0;
digitalWrite(outPin1, LOW);
digitalWrite(outPin2,LOW);
digitalWrite(outPin3, LOW);
digitalWrite(outPin4,LOW);
Serial.println("Stop");
}
}
}

Step 4: update

Remote controlled Arduino motor



If I get good feedback on this blog I’ll do a follow up that features a self navigating RC car with IR proximity sensors, and I’ll also share my Arduino code and explain how to modify it if you want to add more sensors for better navigation. Feel free to post comments and suggestions in the section below.



Tuesday, November 24, 2015

How to use a Keypad - Arduino Tutorial

We are known very well about Keypad which is the combinations of buttons arranged in manner like a block or pad. A keypad usually had digits, symbols and the set of alphabetical letters. If we using mostly numbers then this keypad is called Numeric keypad. Keypads can be found in many alphanumeric keyboards and other devices such as calculators, push-button telephones, combination locks, and digital door locks, which require mainly numeric input.

Alphanumeric Arduino Keypad

Step 1: What you will need

Alphanumeric Arduino Keypad

You will need:
Step 2: The Circuit

We are using 7 pins keypad with 3 columns and 4 rows.

Alphanumeric Arduino Keypad

Note:

If your system does not work properly you can change the connections in the next step and pin no in the commands Search the web for additional help or find the datasheet for your keypad.

Byte row Pins[ROWS] = {7, 2, 3, 5}; //connect to the row pinouts of the keypad
Byte column Pins[COLS] = {6, 8, 4}; //connect to the column pinouts of the keypad

Step 3: Code

Alphanumeric Arduino Keypad

Here's the code, embedded using codebender!
The keypad that we are using has 4 rows and 3 columns:
const byte rows = 4; //four rows
const byte cols = 3; //three columns
char keys[rows][cols] =
{ {'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'#','0','*'} };
Tip: If you have another set of keypad you can change those values with yours ;)

Step 4: Good Work

Alphanumeric Arduino Keypad

In this system we can learn about Arduino and how to use a keypad with arduino.

Saturday, November 7, 2015

Arduino Development Board

Arduino Development Board

Hello friends,
We are going to make a Bluetooth robot which is controlled by android.
We are making this robot with many codes & photos and we used step by step procedure to make this robot because everyperson know about that without any difficulty.
Step 1: Project components
1. One Arduino (Arduino 2560 in my case, but you can use any type of arduino)
3. Two 50:1 Micro Metal Gear motor.
4. Micro Metal Gear motor Bracket Pair
6. Chassis (You can by it from Robomart and you can see it From:https://www.robomart.com/multipurpose-13-8-cm-chassis-plate-for-imechano)
7. One Ball Caster with 3/8" Plastic Ball ( From:- https://www.robomart.com/l-caster-wheel-clamp-for-imechano)
8. Used 7.4 Volts, Li-Po Battery (and used some other similar batterys which having the voltage 7.4 V)
9. One, Li-Po balance charger
10. One, Bluetooth module (We used HC-05 module)
11. Led strip RGB (3 LEDs)
12. SmartPhone with android

Step 2:  Photos of the Component

 

 

Buy Arduino Development Board

 


Buy Arduino Development Board













 Step 3: Assembly Photos

Buy Arduino Development Board








 





Buy Arduino Development Board











Buy Arduino Development Board









Buy Arduino Development Board








Buy Arduino Development Board









Step 4: Connections

Bluetooth:
From Tx Bluetooth to Rx Arduino
From Rx Bluetooth to Tx Arduino
From VCC Bluetooth to 5 volts Arduino
From GND Bluetooth to GND Arduino
Led strip:
From B led strip to 22 Arduino
From G led strip to 24 Arduino
From R led strip to 26 Arduino
From 12v led strip to positive of battery.(purple-white wire)
Motor driver:

Follow the instructions:

https://www.robomart.com/l293d-motor-driver-arduino-v2.0

Step 5: App android:




Buy Arduino Development Board