Show Posts
Pages: 1 2 [3]
31  Using Arduino / Interfacing w/ Software on the Computer / Re: Processing to Arduino, mistakes while transfering data on: March 16, 2013, 03:15:31 am
I have just written my first (and only) processing sketch myself and had similar problems as you but solved them when I noticed the following:

The type has to be the same i.e. if you want to receive a byte, you have to send a byte as they are stored differently. A byte is one byte and an int is 2 bytes etc. I notice you have mixed these.

If you want to send something longer than a byte then you need to know when you have all of its component parts before converting it into something else such as an integer.

I used an I2C 16x2 LCD display connected to the Arduino to print any debugging messages as the serial monitor won't work at the same time as processing has the port.

I hope this helps
Mrs Z
32  Using Arduino / Sensors / Re: Is my US-020 defective or am I doing something wrong? on: February 04, 2013, 09:19:36 am
Thanks for your help Pylon.

As you say, the HC-SR04 is quite accurate. I have tried a few more experiments and I think that the US-020 must have a much wider angle than the 15 degrees stated or the 15 degrees is not 'pointing out' from the board in the way I expect.

I wanted to use the sensors to measure the distance to the four walls of an empty room (of a known size) at 90 degree intervals to be able to pinpoint the locations where the measuring point could be in the room using trig. I have a stepper motor that I was going to use to turn the sensor 90 degrees between measurements or I was going to use four sensors in a square pointing outwards. I say 'was' as I now realise that it is not going to work as I had not taken into account the 15 degree angle.

Ho hum ... thanks again.
33  Using Arduino / Sensors / Re: Is my US-020 defective or am I doing something wrong? on: February 01, 2013, 03:59:50 pm
What's the object your measuring the distance to? A wall? Do you have an absolutely clear line of sight to the measuring object within the opening angle of the sensor? Recall the physics behind your measurement.
Thanks for the reply. There is an absolutely clear line of sight. I have tried the ceiling, the wall, the TV screen, a piece of card, the sofa ...
The objects surfaces are perpendicular to the two sensors' lines of sight.
34  Using Arduino / Sensors / Is my US-020 defective or am I doing something wrong? on: February 01, 2013, 06:40:47 am
I bought a HC-SR04 ultrasonic sensor and it seemed to work well enough but the range fell short of the distance advertised  (450cm) so I bought a US-020 which claimed to have a range of 700 cm.

I am finding that the US-020 is inaccurate for distances over about 106 cm. If I use both sensors at the same time (with a short wait to avoid interference) the US-020 gives the distance as significantly less (it is always less over 106 cm), e.g.
HC-SR04  208.63 cm
US-020    155.92 cm
although they are similar for values under about 106cm
I get the same problem with my code (below)
      digitalWrite(Trig_pin, HIGH);
      digitalWrite(Trig_pin, LOW);
      duration = pulseIn(Echo_pin, HIGH);
      dist_in_cm = (duration*0.034029) / 2 ;
and when using from the NewPing library.

I am very new to electronics and the Arduino and do not understand what sort of problem(s) could cause this. Should I be clamouring for a refund or doing something different? Neither sensor came with instructions - I bought them from ebay.

Thanks in advance for any help.

Here are links to products similar to my sensors
35  Using Arduino / Motors, Mechanics, and Power / Re: Stepper motor, doesn't turn counter clockwise, wrong steps number indication on: January 31, 2013, 10:06:01 am
From your picture, your stepper motor looks suspiciously like the 28BYJ-48 unipolar stepper motor I bought on ebay (as a package with a ULN2003). I had a similar problem with it not turning backwards with the example code for stepper_oneRevolution.

It may be that your problem (like mine) was because the wires on the motor were not in the expected order. I had to order my stepper pins as 8, 10, 9, 11 rather than 8,9,10,11 when creating the stepper instance. This enabled the motor to go backwards and forwards as expected. You could try other permutations to see which work for your stepper. (connect 8,9,10,11 to in1, in2, in3, in4 on the ULN)

For the speed/revolutions per minute issue I found combinations with speed * revolutions = about 2^13 (i.e.8192) would work as this is used to calculate the delay needed for the stepper to move. The most accurate one for my stepper was speed = 4 (used for setSpeed) and stepsPerRevolution = 2048 as my stepper moved at about 4 revs per minute.
Pages: 1 2 [3]