Show Posts
Pages: [1] 2 3 ... 56
1  Using Arduino / Programming Questions / Re: Keep losing Arduino (Micro) boards when uploading this code on: April 10, 2014, 09:30:34 pm
Flashing a sketch with the Arduino IDE does not brick the Arduino.
What do you mean "lost"?
Are you sure you don't have a hardware/hookup problem?
2  Using Arduino / Programming Questions / Re: Interrupt and Virtualwire on: April 06, 2014, 08:18:48 pm
Maybe I'm missing something.  I don't quite follow where you are wanting to use an interrupt exactly.  On the receiving end, VirtualWire uses a timer interrupt to continuously sample the receive signal and has a state machine to recognise, decode and store the received message.  You don't need an additional interrupt to make that happen.

If you are looking for an asyc notification that a message has been received by VirtualWire, you could probably hack something into the VW code, but it would not wind up being any faster or more efficient than polling the receive message function already is.
3  Using Arduino / Project Guidance / Re: What (system) do you use for mechanical prototyping? on: April 06, 2014, 07:57:40 pm
19mm PVC tubing and a collection of elbows and tees.
a bunch of 10mm extruded aluminium angle, box and U-channel stock
a box of m3 nuts and bolts
4  Using Arduino / Programming Questions / Re: Strange behavior storing objects on an array on: April 06, 2014, 02:14:12 pm
String _title;

String does not contain the actual bytes of the string, but instead contains a pointer to a string in the heap.  Copying the struct or object containing the string does not copy the string content, which, I guess, is probably overwritten by the time you go fetch it.
5  Using Arduino / Project Guidance / Re: can an ultrasonic sensor detect pingpong ball between water and oil ? on: February 26, 2014, 09:23:19 pm
What sort of ping-pong ball will sink in oil?  I guess it's weighted to have a density between the two?

Most ultrasonic distance sensors are designed to operate in air, not a liquid like water or oil.  If you came up with an in-liquid sensor pair, you could likely measure the depth to the oil/water interface from the bottom up.  It would not matter if there were a ping-pong ball there or not.  The impedance discontinuity between the two fluids would reflect the signal just fine.

What is the objective here?  To sense the position of the ping-pong ball?  The presence/absence of the ball?  To measure the water level under the oil?  The thickness/level of the oil above the water?
6  Using Arduino / Programming Questions / Re: error code, expected unqualified-id before numeric constant on: February 21, 2014, 04:20:31 pm
int pi = 3.14159265359
int wheelDiameter = 0.5 //wheel diameter in metres!!!

These numbers are not integers (whole numbers).
You are also missing semicolons in several places.
7  Using Arduino / Programming Questions / Re: DS1820 wire length--one-wire code on: February 21, 2014, 04:18:22 pm
The secret seems to be, for start and ladder topologies in particular, that you add 4.7K resistors for each wire. Makes no sense to me, since all the wires in a star are shorted together at the port pin, but it works.

I found that with a longer bus you need to reduce the pull-up resistor.  With a 50m bus I had to go to 3K3 I think.  When you put more pull-ups in parallel, you effectively lower the pull-up resistor -- increasing the bus current.  High bus current leads to greater self-heating in the sensors, so that's the down-side.

I also found that, although it's supposed to work fine, a 3.3V (or 3.5V) bus just wouldn't work for me past 10m or so.  A 5V bus was okay.

The 1-wire network design write-ups I've read discourage star topologies.  If you need a star, then you should run N different buses out from different pins on the Arduino.  I've done this and it's fine.
8  Using Arduino / Project Guidance / Re: 12V to 5V on: February 19, 2014, 10:20:38 pm
How much 5V current do you need?  If it's less than 3A, there are many 5V linear regulators to choose from.  Mouser lists dozens.
Here's a likely one, an ST Microelectronics LD1085V50ST
9  Using Arduino / Programming Questions / Re: real time computing on: February 14, 2014, 04:44:25 pm
  idletime = (1000 - cycletime);
delayMicroseconds (idletime);

If cycletime ever exceeds 1,000, then the idletime calculation gives you a negative idle time, which delayMicroseconds(unsigned int) treats as a large positive value.  This yeilds actual cycle times in the 65,000 range.  But  because you're doing a long calculation and discarding the high bits, you are printing the actual cycle times MODULO 65536.  These are the +/- 8,000 figures.

Make idletime and cycletime long integers and do this, and see if it helps:

  idletime = (1000L - cycletime);
  if (idletime > 0L)
10  Using Arduino / Programming Questions / Re: real time computing on: February 14, 2014, 03:30:10 pm


Also, Serial.println() will eventually block, if you feed data too fast.

I think printing two 4-char numbers with linefeeds and start/stop bits and all that, at 115200bps, is running in the 870 microsecs range.  That could be a source of timing skew.
11  Using Arduino / Programming Questions / Re: Making a Boundary Using GPS on: February 12, 2014, 11:27:36 pm
Incidentally, to preserve accuracy, the TinyGPS software stores positions as long integers in steps of one millionth of a degree

I see no reason that the point-in-poly algorithm couldn't be used on this representation of coordinates.  Multiplication and division would require using long long and renormalization, but that's all doable.
12  Using Arduino / Programming Questions / Re: Making a Boundary Using GPS on: February 12, 2014, 10:00:42 pm
Yes, you need to convert everything to a local 2D orthogonal coordinate system.

I think you're over-complicating this.  Plugging lat/long values directly into the point-in-polygon algorithm is likely going to be fine.  This effectively treats the world like a giant Mercator map.  The point-in-polygon solution will be correct so long as none of the points on the polygon is near the poles and the polygon doesn't straddle the date-line.

If the polygon is something like the size of a city and is located within +/- 60 degrees latitude and not at the date-line, I think the error in geometry will be along the lines of basic GPS positioning errors.

If you want to use this algorithm to determine if you are in/not-in the pacific ocean, then, obviously a lot more careful coordinate conversion is needed.  But also more accurate math than you'll get on Arduino.  Also, a boundary polygon specified accurately enough to make any of this matter is likely to take more than a few dozen points to specify and it's going to be a whole other problem to store that in a wimpy Arduino.
13  Using Arduino / Project Guidance / Re: increase AnalogRead() accuracy , when VCC fluctates?? on: February 11, 2014, 05:39:17 pm
There is a built-in 1.25V 1.1V reference, and you could use a voltage divider to place the measured voltage in that range.

Most models of Arduino have a 3.3V voltage regulator that you could also use as a reference, if the Vcc is above 4.1V or so.  Again, you might need a voltage divider to put the measured voltage in range.

Either of these is a more accurate and stable reference than the 5V regulator, but not as good as a precision voltage reference.

Edit: corrected value for internal voltage ref.
14  Using Arduino / Programming Questions / Re: Making a Boundary Using GPS on: February 11, 2014, 03:24:38 pm

This link has a code solution in just a few lines:
15  Using Arduino / Project Guidance / Re: Fotobox - guidance and feedback please on: February 11, 2014, 03:04:27 pm
if(button_right) menu = menuline[mode][++menuitem];button_right=false;
if(button_left) menu = menuline[mode][--menuitem];button_left=false;

I don't see any code to keep menuitem from walking off the beginning or end of the array.

I find this whole construction a bit difficult to follow:

#define flipbit(ADDRESS,BIT) (ADDRESS ^= (1<<BIT))
#define shutter flipbit(PORTB,5) //13


In my view it would be more readable to do something like

const int SHUTTER = 13;

setup() {
   pinMode(SHUTTER, OUTPUT);

    digitalWrite(SHUTTER, 1);
    digitalWrite(SHUTTER, 0);
Pages: [1] 2 3 ... 56