Show Posts
Pages: 1 ... 420 421 [422] 423 424 ... 591
6316  Using Arduino / Project Guidance / Re: When using Vin for input, can it handle more than 5V? on: July 28, 2011, 03:19:41 am
VIN has to be at least around 7v and HAS to go into the barrel connector (or the VIN socket on the power header). Put it anywhere else and you'll blow something up.

Vin refer to using it as an output pin.
VIN is not a pin al all.

Maybe you should tell us exactly what you want to do before you have to buy a new Arduino smiley

6317  Using Arduino / Networking, Protocols, and Devices / Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver on: July 28, 2011, 02:04:58 am
This does sound nice, I love the size of those modules, you could put them into just about anything.

I to have been keeping an eye on this, not ready to do anything yet though.

6318  Using Arduino / Interfacing w/ Software on the Computer / Re: Fighting with Vista on: July 27, 2011, 11:20:57 pm
Can I just move the folder?
Possibly, I know people install it in other places. Whether you can move an installed folder I don't know. Worst case is a new install.

How did you turn user access control off?
Yep, it's a real pain, and my PCB package can't save files with it on.

Go to Control panel > User accounts. The bottom link can be used to toggle the UAC.

6319  Using Arduino / Interfacing w/ Software on the Computer / Re: Fighting with Vista on: July 27, 2011, 10:48:42 pm
I assume you're talking about Arduino install files.

I have no trouble doing anything like this but I have the user access control crap turned off.

6320  Topics / Home Automation and Networked Objects / Re: PoolDuino - Automate my pool with Arduino on: July 27, 2011, 08:49:30 pm
Scare you off yet?
Reminds me of what a PITA a pool can be, glad I don't have one any more.

my liquidcrystal screen is limited in the amount of output. 16x2 is not a lot!
Simple, get a bigger one. Even better get a serial graphics LCD like the ones from 4D Systems, they have touch panels as well so you don't need buttons.

limited in the amount of input pins I have
Either move up to a Mega or use a MUX (like the 4051 or 4067) to get more inputs.


6321  Using Arduino / Networking, Protocols, and Devices / Re: 2 XBees, 2 Arduinos, numbers in terminal don't match... on: July 27, 2011, 08:42:21 pm
OK I think the problem is that my code snippet was not written to be entirely inside a function (in this case loop())

Why? Because having

int pos = 0;

inside a function initializes pos to 0 every time the function runs which in this case is probably a 1000 times for every character received. So no matter how many chars have been received before pos will always be 0 and when you finally get a CR that's the value that is printed.

Changing that line to

static int pos = 0;

should fix the problem. This causes the variable to only be initialized the first time the function is called.

6322  Using Arduino / Networking, Protocols, and Devices / Re: 2 XBees, 2 Arduinos, numbers in terminal don't match... on: July 27, 2011, 08:33:18 pm
Those numbers are decimal representations of ASCII chars

48,13,10 == 0 CR LF
54,52,52,13,10 == 6 4 4 CR LF
54,52,56,13,10 == 6 4 6 CR LF

So at the top you are getting 0, makes sense, depending on how the pot is wired.
In the middle you are getting 644, makes sense.
In the bottom you are getting 646, doesn't make sense, are you sure about this one?

So it looks like the Xbees are working.

As for the -48, I may have stuffed up with that code, I'll have a look. -48 == -0 which should give me a hint.

6323  Using Arduino / Sensors / Re: LMS303 sample reading on: July 27, 2011, 08:19:40 pm
I had a think about this after switching off my computer last night. I think all you need to detect is the case when 2 or more readings differ by more than the expected jitter.

So I modified your code to do this, plus simplified the rest of the code. I hope I didn't stuff it up on the process smiley

#define FUDGE_FACTOR 100  // any number > the expected jitter will do
#define SPECIAL 1
#define NORMAL 2
#define N_SAMPLES 10
#define BAND 10

int heading_samples[N_SAMPLES];
int hstate;

// dummy funcs just to get it to compile

void setup () {}

void loop () {}

int read () {}

int getHeading () {
  int total = 0, min = 0, max = 0;

  for (int _sample = 0; _sample < N_SAMPLES; _sample++) {
    read(); // read the magnometer values
    // I don't have "vector" so commented the next line out
//heading_samples[_sample] = heading((vector){0,-1,0}); //create heading

    if (heading_samples[_sample] < min) min = heading_samples[_sample];
    if (heading_samples[_sample] > max) max = heading_samples[_sample];

    hstate = (max - min > FUDGE_FACTOR) ? SPECIAL : NORMAL;

  for(int _sample = 0; _sample < N_SAMPLES; _sample++){
    total += heading_samples[_sample];  //sum up readings
    if ( heading_samples[_sample] < 360 - BAND && hstate == SPECIAL)
      total += 360; //add 360 if not above 350

  total /= N_SAMPLES;
  if (total >= 360){
    total -= 360;
  return total;

6324  Using Arduino / Project Guidance / Re: Arduino for Tiptronic gearbox control on: July 27, 2011, 07:01:49 pm
if i switch 12v with the 5v i get from the arduino i only get around 4V from the emitter.
Then your circuit was wrong.

It sounds like you need to do some high-side switching, normally this uses a PNP to do the job and an NPN to switch the PNP.

Google for "high-side switching", if you can't find anything one of us can knock up a circuit.


6325  Using Arduino / Project Guidance / Re: Creating your own Arduino PCB on: July 27, 2011, 06:54:42 pm
Here's a link to the mega thread Bob mentioned,61126.0.html

Get a cup of coffee first though, at 24 pages you'll be reading for a while smiley

6326  Using Arduino / Sensors / Re: LMS303 sample reading on: July 27, 2011, 11:22:08 am
There's probably a really simple mathematical way to do this, but maths isn't my strong point so maybe the following brute-strength approach.

It's only a problem in the 360/0 boundary area. So let's define a band around that of maybe +-10, ie 350 to 10. Any readings outside this band are treated normally.

However if you get readings inside the band you switch to a mode that adds 360 to any values < 350, does the averaging, then subtracts 360 if the results is > 360.

If you get an average that falls outside the band you revert to the standard method.

(360+359+360+(1+360)+360 + (1+360))/6 = 360

(358+359+(5+360)+(4+360)+(3+360)+(1+360))/6 = 361.8, subtract 360 = 1.8

EDIT: all 360s should probably be 359s.

6327  Using Arduino / Project Guidance / Re: How hard would it be to build an EPROM writer? on: July 26, 2011, 11:01:52 pm
Well, I have a few "old school" CPU ( 8085, Z-80 and make program for them )
I'm often temped to make a Z80 board, just for the heck of it, but I'd probably make an EPROM emulator for development then use a flash chip when finished

There's a thread somewhere here about feeding the Z80 a program one byte at a time on demand from an Arduino.

Found it:,60739.0.html

Sounds like fun.

6328  Using Arduino / Programming Questions / Re: Printing Strings drops some characters on: July 26, 2011, 10:56:38 pm
Unfortunately there is no intrinsic run-time method of finding a string length except scanning for the null terminator.

6329  Using Arduino / Project Guidance / Re: Arduino controlled lab variable power suply on: July 26, 2011, 10:51:25 pm
If you run the PWM through a low pass filter it will produce a stable(ish) DC voltage. The RC time constant may have to be pretty large to smooth the PWM out and this will impact the response feedback time and therefore it will be slightly harder to handle in the software. Also there may be impedance issues so you may have to buffer with an opamp.

Personally I would go for the DAC.

As to wether either will work on the 317, I don't think so but this is getting a little analogue for me. The 317 tries to maintain a small voltage on the middle pin I think, and it does that by adjusting the output voltage. Maybe you could simulate that small voltage with a DAC, i don't know but even if it works I think you would have to scale the DAC output down (or use a small reference voltage if they have one) to get the full resolution.

Certainly either technique should work if you keep the existing transistor circuit as that's all the R2R network does anyway.

6330  Using Arduino / Project Guidance / Re: Interface one pair of rx/tx with multiple rs485 chips on: July 26, 2011, 11:55:24 am
As I understand it you will always have one hard connection at a time into the Arduino so there shouldn't be any issues with the RX signal, OTOH there may be small glitches as you change channels so a pull up on RX may not be a bad idea.

I would organize the address control lines for the decoders so they are on a single port and can therefore be all set with a single instruction (don't use digitalWrite()). That way there's no long period when you have a floating connection or the connection is bouncing between lines because you are setting addresses over several instructions. EG

digitalWrite (addr0pin, a);
digitalWrite (addr1pin, b);
digitalWrite (addr2pin, c);
digitalWrite (addr3pin, d);

Will cause all sorts of addresses to be momentarily selected, whereas

PORTB = x;

does all the pins at the same time.

I would also flush the UART RX buffer after changing channels just to be sure, and the code running on the mega48 slaves should be robust in regard to transients on the line. This implies a reasonable protocol with error checking is in place.

The RS485 lines should have what they call "failsafe" termination (~560R pullup on A and pull down on B) because they will be in a hi-Z state for much of the time and floating lines will have noise issues. Many (most?) transceivers these days have built-in fail safe I think but I'd still do it externally with resistors.   

As for the power supply, I haven't looked at the specs for it (no data left on my plan until tomorrow) but I would not expect it to cause problems, RS-485 is designed to handle such things and it shouldn't have any affect on your logic.

Pages: 1 ... 420 421 [422] 423 424 ... 591