Show Posts
Pages: [1]
1  Using Arduino / Motors, Mechanics, and Power / Re: Arduino becomes unidentified after connecting servo signal cable on: October 07, 2012, 04:34:45 pm
@kd7eir
I don't get what your problem is, I don't want to know. I don't want to start an argument either. Please, next time, if you're going to write something like this: don't. I think no one needs info given the way you did it. You're just ruining the joy of using Arduino.
I wrote that it's hard to belive in for me because I used few servos with an arduino before and never got any problem with that, never said that what dxw00d wrote is not possible.
 
Nevertheless, I would like to thank everyone for their anwsers.
2  Using Arduino / Motors, Mechanics, and Power / Re: Arduino becomes unidentified after connecting servo signal cable on: October 07, 2012, 10:09:11 am
Arduino can't provide that kind of power? I won't check that until tommorow but it's hard to belive in for me. Especially that the specification of the servo (HS 645MG) says that it operational voltage is between 4.8V and 6V (changing the torque respectively) and the servo moves as it's supposed to: the problem is that it blocks the serial communication.

Any other suggestions?

3  Using Arduino / Motors, Mechanics, and Power / Arduino becomes unidentified after connecting servo signal cable on: October 07, 2012, 08:06:47 am
Hello everyone,

I'm using win7 64-bit and Arduino IDE 1.0.1-rc2 because 1.0.1 didn't want to cooperate with mine OS (after a unusually long boot of IDE I got a "An error occured while starting the application." error).
I'm trying to make a project which constains moving servo and using Serial communication but for now I've simplified it to the blink example which I've expanded by adding 1 servo (code below).
I managed to install the arduino drivers (I've tried both - RC2 and official drivers and the problem repeats in both situations) and I got the Communication port (COM3) in my device menager (the arduino microcontroller).

Here's my circuit:
Servo connected to arduino 5V (red) and ground(black). signal cable (yellow) connection problem described below.
 
Here's my problem:
when I connect servo signal cable to the pin I've declared in servo.attach() function (8 in this case) several things occur:
-the OS keeps playing the standart device pluged in and device unplugged sounds in random sequence (for example: plug in 4x, unplugged 2x, plug in... ). This happens as long as the servo signal cable is connected and stops the moment I remove it.
-the communication port (arduino) is not visible in device manager of my computer, and the list refreshes all the time (new device found, device unplugged).
-from time to time I get "Found new device" notification but it says that Unknown device has been connected (looks like the servo wanted to add it self as a new device but no new device is shown in device manager)
-the Arduino IDE Tools > Serial port menu is not available
-no new messages in Serial monitor are shown
-I'm not able to upload any new programs until I disconnect the servo signal cable
-the servo moves as I specified in the code

What may cause that kind of behaviour? How to fix this?

My arduino test code:
Code:
#include <Servo.h>

Servo servo;
void setup() {               
  pinMode(13, OUTPUT);     
  servo.attach(8);
  servo.write(90);
  Serial.begin(9600);
}
void loop() {
  servo.write(90);
  Serial.println("90");
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  servo.write(45);
  Serial.println("45");
  delay(1000);      // wait for a second
 }
4  Using Arduino / Programming Questions / Re: ID-12 gives weird characters as output on: May 02, 2012, 06:12:29 pm
Hi, You're using Serial.write() instead of Serial.print(). Try using print to get ASCII coded output (write() returns a binary output). Additionally, if there's no data available at softSerial you'll get some random values at output.

5  Using Arduino / Programming Questions / Re: Serial.write command execution time variations on: May 02, 2012, 11:23:21 am
Thanks, I think everything is clear right now!
PaulS, where do you get all those anwsers from?

Regards
Gr4jp3r
6  Using Arduino / Programming Questions / Re: Serial.write command execution time variations on: May 02, 2012, 11:10:31 am
Quote
Would decreasing the size of the buffer to the size of frame  decrease the time needed to send the package?
No. Writing 8 letters on a sheet of paper takes the same amount of time, regardless of the size of the paper, doesn't it? Writing 8 bytes into the buffer, and then waiting for the buffer to empty takes the same amount of time if the buffer is 10 characters as it does if the buffer is 64 characters.
Since I'm sending always the same amount of bits (1 frame) to the buffer and than flush it immediately after calling Serial.write(), than filling and emptying of the buffer takes the same amount of time. Why does Serial.write() + Serial.flush() take more time than calling Serial.write() only? Shouldn't it be contrary? Sending only 1 frame and flushing it should take less time than filling the whole buffer with frames and than emptying it, right?
7  Using Arduino / Programming Questions / Re: Serial.write command execution time variations on: May 02, 2012, 10:46:18 am
Thanks for the anwser, I'm curious about one more thing: the buffer we are talking about is the UART buffer right? Sending the package without flushing took about 5 times less time to realise than with flushing on. What other data is stored in that buffer? Would decreasing the size of the buffer to the size of frame  decrease the time needed to send the package?
8  Using Arduino / Programming Questions / Re: Serial.write command execution time variations on: May 02, 2012, 06:08:22 am
So i need to call Serial.flush() after every Serial.write() right? It dramatically increased the frame sending time but it's more consistent for sure. Is there any other way to decrease the sending time but to provide its consistency at the same time?
9  Using Arduino / Programming Questions / Re: Serial.write command execution time variations on: May 02, 2012, 05:53:22 am
Hi, I'm using IDE 1.0 (I tought that everyone use this version now, sory) Yesterday I noticed, that reducing the frame length to 50 bytes stabilizes the execution time at a little bit over 1.3ms and that time was not fluctuating (time variation was about 30us, like previously) . Today however, the same code generated Serial.write execution time 1.3ms to 3.2ms. Yesterday I tought that dividing the frame to 2 smaller ones will solve the problem but today the issue is back again. What is going on? Why do those times vary so significantly?

@WizenedEE
What did you mean by
it waits until everything has finished transmitting
? I use UART only to send this frame, communication with the sensors is realised by I2C.
10  Using Arduino / Programming Questions / Serial.write command execution time variations on: May 01, 2012, 06:16:47 pm
Hi, I'm writing a  module for spatial orientation using Arduino UNO. I came across a weird behaviour of Serial.write lately (I send pretty big amount of data through serial and I need it to be send fast, that's why Serial.print is useless). It worked fine until today, when I checked the sampling time of my sketch (micros() before first and after last command at loop() section) and found out that the execution time of Serial.write varies from 1600 us to even 15000us! I can't understand where did this come from, especially that when I checked it previouselly (before writing libraries for the project, about week before) the sampling times were very stable (about 30 us variation). I need program execution time to be constant and possibly shortest as I use numeric integration acions in my computations. I send 60 bytes of data through the serial in every loop realisation. What may cause the execution time variations? Why did this parameter change? How can I fix this?
Below I attach a simplified sketch of my program.

Regards
Gr4jp3r

Code:
#include <Wire.h>
#include <math.h>
#include <CompassHMC6352.h>
#include <ITG3200Gyroscope.h>

#define TP_MICROS 12000
#define TP_SECONDS 0.012

unsigned int startTime = 0;
unsigned int stopTime = 0;

byte frame[60];
byte frameIncrement = 0;
\\...\\
void setup()
{
  Serial.begin(57600);
  Wire.begin();
   
  \\...\\
}

void loop()
{
  startTime = micros(); 
  kompas.LeaveSleepMode();
  gyro.UpdateVelocities();
  gyro.UpdateAngles();
  kompas.DownloadAngle();
  BMAReadAccel();
 
  AngleFusion(zeta,w0,fusionRoll,bmaAccRoll,gyro.GetPrevVelocity(0));
  AngleFusion(zeta,w0,fusionPitch,bmaAccPitch,gyro.GetPrevVelocity(1));
  AngleFusion(zeta,w0,fusionYaw,kompas.GetAngle(),gyro.GetPrevVelocity(2));

  SetFrameReady();
  unsigned int t9 = micros();
  Serial.write(frame, frameIncrement);
  stopTime = micros();
  delayMicroseconds(TP_MICROS-(stopTime-startTime));
  // Serial.println(stopTime-t9); //This varies from 1.6ms to 15ms!
}

inline void ConvertIntToByte(unsigned int intToConvert, byte *tempByte)
{
  tempByte[0] = (byte)intToConvert;
  tempByte[1] = (byte)(intToConvert>>8); 
}

void SetFrameReady(void)
{
  frameIncrement = 0;
  byte tempByteArray[2];
 
  ConvertIntToByte(11111,tempByteArray);
  frame[frameIncrement++] = tempByteArray[0];
  frame[frameIncrement++] = tempByteArray[1];
 
  \\...\\
 
  ConvertIntToByte(kompas.GetAngle()*100 +5000,tempByteArray);
  frame[frameIncrement++] = tempByteArray[0];
  frame[frameIncrement++] = tempByteArray[1];

  \\...\\

}
Pages: [1]