Show Posts
Pages: [1] 2
1  Using Arduino / Networking, Protocols, and Devices / Re: JY_MCU Board problem (Connected to Arduino UNO) on: October 25, 2012, 11:12:10 am
If your bluetooth board is connected to pins 0 and 1, then you should be using hardware serial. Remove these lines:

Code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(0,1); // RX, TX pins

Replace all occurrences of mySerial with Serial.

Is it ok then to use Serial for receiving data and for debug information output? (As I am using now, Serial.println)
2  Using Arduino / Networking, Protocols, and Devices / Re: JY_MCU Board problem (Connected to Arduino UNO) on: October 25, 2012, 09:13:54 am
Code:
SofrwareSerial mySerial(0,1); // RX, TX pins

That line won't compile, but assuming it's correct in your real sketch, why are you trying to do software serial on the hardware serial pins?

Is it the source of problem? What should I do instead?
By the way, it is compiling. (of course without the spelling mistake, correctly would be SoftwareSerial)
3  Using Arduino / Networking, Protocols, and Devices / JY_MCU Board problem (Connected to Arduino UNO) on: October 25, 2012, 08:47:48 am
I have Arduino UNO + Motor Shield. And I have attached the JY_MCU board (Bluetooth) to it.
I am sending data (the commands) to the Arduino through Bluetooth. The JY_MCU board accepts it and executes the command, (the motor control).
In order to receive the command I use:
Code:
#include <SoftwareSerial.h>
SofrwareSerial mySerial(0,1); // RX, TX pins
...
// in setup function
mySerial.begin(9600);
...
// in the loop function
if (mySerial.available()) {
...
}
etc

The problem is that after some time the Arduino stops responding to the commands being sent to it. However the red LED on the
Bluetooth board doesn't blink, indicating that the connection still exists.

I have decided, in order to debug the problem, to output the commands received by bluetooth using Serial.println function:
Code:
// in setup function
Serial.begin(9600);
...
// at several places in the code
Serial.println(command);
...
And after I have put that function to several places in my code, the program started to work as it should work without any mistakes or sudden stops in receiving the commands.
What is the problem? I can't understand.
4  Topics / Robotics / Re: The car not moving, but motor speed is set to max on: October 17, 2012, 05:43:14 am
Just upload a sketch that only turn on/off the motor's. It seems like you have not enough power to let te motors spin. How do you feed the motor(shield)? I hope not via the 5v of the arduino because that pin doesn't have enough current.

I am supplying common power for arduino and motor shield through the motor shield.

My motors variables are:
AF_DCMotor motorBack(4, MOTOR12_64KHZ);
AF_DCMotor motorFront(1, MOTOR12_64KHZ);

The car goes only forward or stops, so for the motorBack my turn on/off motor's function is:
void SetMotorSpeed(int val) {
   if (mySpeed == val)
      return;
   mySpeed = val;
   motorBack.setSpeed(mySpeed);
   motorBack.run(FORWARD);
}
passing parameter 0 to the function above makes the motor stop.

For the motorFront, which is used for making turns, there are three functions, turn left, right and straight:

void turnRight() {
  if (turnState != 1) {
     setMotorSpeed(0); // for motorBack
     motorFront.run(FORWARD);
     turnState = 1;
     delay(100);
     setMotorSpeed(motorTurnSpeed); // motorTurnSpeed = 255
  }
}

void turnLeft() {
  if (turnState != 0) {
     setMotorSpeed(0); // for motorBack
     motorFront.run(BACKWARD);
     turnState = 0;
     delay(100);
     setMotorSpeed(motorTurnSpeed); // motorTurnSpeed = 255
  }
}

void turnStraight(int cycle) {
   if (turnState != 2) {
       setMotorSpeed(0); // For back motor
       if (turnState == 0) {
          motorFront.run(FORWARD);
          delay(cycle); // wait until wheels turn straight
          motorFront.run(RELEASE);
       } else if (turnState == 1) {
          motorFront.run(BACKWARD);
          delay(cycle); // wait until wheels turn straight
          motorFront.run(RELEASE);
       }
   
       turnState = 2;
       setMotorSpeed(motorStraightSpeed); // motorStraightSpeed = 200
    }
}

5  Topics / Robotics / Re: The car not moving, but motor speed is set to max on: October 17, 2012, 01:51:40 am
Quote
Previously I was using 6 AA. Now I am using 8 of them.

batteries in series increase voltage

batteries in parallel increase current

how do you have it set up?

It is connected in series
6  Topics / Robotics / The car not moving, but motor speed is set to max on: October 17, 2012, 12:03:31 am
I have made a toy car, with arduino UNO + Bluetooth + Motor shield installed on it.
There are two DC Motors, at the front of the car and at the back.
The front motor controlls the turn of the front wheels.
Motor at the back moves the car.

Commands, such as turn right, left or go straight are sent from android through Bluetooth.
Arduino accepts it and executes the command.

At first everything works fine. The car moves fast, and performs turns fast.
But after some time the car suddenly decrease in speed, almost stops, and I hear a sound from the back motor.
It seems like it doesn't have enough power to move the car, and if I pick up the car at that moment, the motor starts moving fast as before,
but if I put the car back to the floor it doesn't move with the needed speed again.

Let me explain you the command execution algorithm,
After receiving the turn Left or Right command
Check if I am already performing the same turn,
if not, then
1. Set the back motor speed to 0
2. RUN the front motor at the needed direction (backward or forward meaning left or right)
3. Set the speed of the back motor to maximum (255)

After receiving the GO Straight command:

Check if I am already going straight, if not, then
1. Set the back motor speed to 0
2. RUN the front motor at the opposite of the current turn direction
3. Delay for some time, enought to turn the wheels straight
4. RELEASE the front motor.
5. Set the speed of the back motor to some value, less than maximum (255).

Are there any defects in this algorithm?
And what can be the cause of the problem?

I want also to mention that the car was working properly before, but with not enough speed when making turn,
so I decided to add two more batteries. After that I am facing this problems.
Previously I was using 6 AA. Now I am using 8 of them.
7  Using Arduino / Networking, Protocols, and Devices / Arduino UNO + JY-MCU v1.03 problem on: June 21, 2012, 12:48:37 pm
Hello.
I have connected my arduino UNO with JY-MCU bluetooth version 1.03.
I have connected it's rx,tx to pins 2,3 of the arduino.
After running the program I am sending AT command and it returns OK. But I don't know any other commands, I have checked several of them, like AT+VERSION or AT+VERSION? nothing is returing.
1. Is there a special list of commands for my version of JY-MCU?
2. Another question is how to send data through BT? What kind of command should I be used in order to send, for example, one byte of data to Arduino? (I am planning to connect this Bluetooth to Ardiono pins 0,1 and send data from Android device by bluetooth.)


 
8  Using Arduino / General Electronics / Re: Power supply for Arduino on: June 20, 2012, 11:05:36 am
Current ratings are a capacity rating.  Electronics only draw the amount of current they need.  So if you have a 1000mA source and your electronics (such as the Arduino) only draws 50mA, it will still only draw 50mA.

The challenge here is that when powered through the USB port of the Arduino, there is an on board fuse that limits current to 500mA.  So even if your source is 1000mA capable, the Arduino will not allow drawing full capacity.

The alternative is to hook the battery directly to the 5V node, which bypasses the on-board fuse.
Thank you for the answer. Now I am safe to use it smiley
9  Using Arduino / General Electronics / Power supply for Arduino on: June 20, 2012, 10:11:04 am
I am not sure if this is the correct forum branch to ask such question, so I am sorry if I am asking in a wrong place.
I want to supply the power to my arduino uno through the USB cable (used to connect to the PC) by connecting the other part to the USB battery,
the USB battery is providing this parameters:
DC 5V - 1000mA.
I am afraid that I can't do it, only if 500mA, right?
10  Topics / Education and Teaching / Re: Documentation for the Shield on: June 20, 2012, 10:03:31 am
Thank you very much guys. I got it!
11  Topics / Education and Teaching / Documentation for the Shield on: June 19, 2012, 12:51:24 am
I have bought this motor Shield:
 http://www.ebay.com/itm/Motor-Drive-Shield-Expansion-Board-L293D-For-Arduino-Duemilanove-Mega-UNO-/290700252856?pt=LH_DefaultDomain_0&hash=item43af15d6b8#ht_3804wt_1396
But it is different than the one in the arduino web site, the motor shield. And the name says Motor Drive Shield Expansion Board L293D.

Do you know where can I find the documentation for that motor shield? I tried but couldn't..
12  Using Arduino / Programming Questions / Re: LED doesnt turn ON (or OFF) on: May 22, 2012, 10:42:58 am
What is the problem?

What you are trying to do is trivially simple and could be done in a couple of lines of code using the Arduino libraries.

The approach you're using attacks the hardware directly, which is much harder to implement. Why don't you simply do it the easy way?


You were right. I have already made it by changing the SerialEvent example.
But I was wondering why that strange things happened.
And if you can do this thing in a hard way - it means you understand the arduino quite well.
By the way the thing which is done in that code using the hard way, regarding the USB communication, what should be read from the datasheet in order to understand it? There are several chapters but I dont know which one exactly to read: the SPI, USART or USART in SPI mode?
13  Using Arduino / Programming Questions / Re: LED doesnt turn ON (or OFF) on: May 22, 2012, 04:14:54 am
Sorry I don't understand that.

Not to worry there is no reason why I should.

However the bit I don't understand is:-
Quote
but I have changed LED to be 6

So quoting from:-
http://www.arduino.cc/en/Reference/PortManipulation

Quote
PORTB maps to Arduino digital pins 8 to 13 The two high bits (6 & 7) map to the crystal pins and are not usable

So I don't see how 6 could possibly work, you are targeting the wrong bit.

LED is blinking but after sending some values as 4 or 22 to it it doesnt turn OFF but if I send 1 it blinks very often.
I also cant understand what is wrong but it seems not working as intendent if I set LED to 6,
if I set to 5 it doesn work at all.
14  Using Arduino / Programming Questions / Re: LED doesnt turn ON (or OFF) on: May 21, 2012, 09:37:24 pm
Quote
This code is what I actually have, and I need to rewrite it to use an easier way.
Sounds like an assignment or homework.
I mean I dont have another code so that I can chose want code to use, written in an easier way or harder way.
I do not need to rewrite it, I mean, I will have to rewrite it to get a usual form (easier way) using setup and loop functions.
15  Using Arduino / Programming Questions / Re: LED doesnt turn ON (or OFF) on: May 21, 2012, 09:31:31 pm
Quote
but I have changed LED to be 6
So have you got an external LED then?

Why are you using code that is writing in such a machine code way? There are much easier ways to achieve the same effect. As a learning exercise that code is useless.

No, I am using the LED which is the Arduino UNO's LED, and it was blinking.
This code is what I actually have, and I need to rewrite it to use an easier way.
Pages: [1] 2