Show Posts
Pages: 1 ... 379 380 [381] 382 383 ... 542
5701  Using Arduino / Motors, Mechanics, and Power / Re: Arduino Motor Shield R3 Help on: January 30, 2012, 09:39:29 am
Can anyone help me connect a bipolar stepper motor and get it running. I have found tutorials with older Arduino Motor Shields but no the R3.  Do I connect all 4 of the stepper motor wires to the A+,A-,B+,B- ?  And then control the steps with the #12 & #13 pins (Dir A, Dir B)

Yes.  Be sure to set pins 3 and 11 (PWM-A and PWM-B) to HIGH to turn on power.  You should probably also turn 8 and 9 to LOW to turn off the brakes.

If you want to hold position without heating up the stepper you can use analogWrite() on 3 and 11 to reduce the power.  If you want to release the motor so you can turn the shaft by hand, set 3 and 11 to LOW.
5702  Using Arduino / Storage / Re: sd card as stoarge dsvice on: January 30, 2012, 09:23:42 am
Generally, no.  You would typically put the SD card into an SD card reader to read and write it on the PC.  Then take the card out of the card reader and put it into the Arduino for the Arduino to read and write.

An alternative is to use the serial port to move data between the PC and the SD card on the Arduino.  You will need to develop an upload/download protocol and write the programs at both ends (Arduino and PC).
5703  Using Arduino / Installation & Troubleshooting / Re: Problem uploading - stk500_getsync(): not in sync: resp=0xe0 on: January 30, 2012, 09:07:22 am
From the output of the batch file (you can get the same in the IDE by selecting 'Show verbose output during: [ ] compilation  [X] upload' in Preferences...) it looks like the Arduino is not responding at all.  Have you tried a loopback test to see if your USB-to_Serial is working in both directions?  The instructions are here:,73748.0.html
5704  Using Arduino / Networking, Protocols, and Devices / Re: HMC6352 Suggestions on: January 30, 2012, 08:49:33 am
The compass should work with your navigation code if you put the compass heading in place of myGPS.gprmc_course().
5705  Development / Suggestions for the Arduino Project / Re: pulseIn Bug on: January 30, 2012, 08:43:54 am
So is this "resolved" in the sense that the changed behavior is now understood?  If it's understood, is it believed to be a good change that happens to break this person's apps. or a bad changed that has caused a real bug?

The change to pulseIn() is good because it protects against a possible hang condition:  a timeout is specified and a pulse starts before the timeout but never ends.  The change increased the granularity of the pulse measurement from 0.625 microseconds to 1.3 microseconds, which is not ideal but bearable.

If you need a finer grain measurement you can re-implement pulseIn() easily enough.  Remove the timeout check to get back to 0.625 microsecond granularity.  It might even be possible to speed the code up more if you don't have to support both HIGH and LOW pulses with the same loop.  For short pulses,  using an int counter rather than long  (or even byte for very short pulses) will save time incrementing the count.

Might be able to reduce the granularity even more by simplifying the loop code a bit:
5706  Using Arduino / Programming Questions / Re: avoid delay() please help me on: January 29, 2012, 10:09:31 pm
One obvious error:
  if (val_proximity == HIGH && flag>0)
      if (val_proximity== LOW)   // You've already fond val_proximity to be HIGH so this will never be true.

Another note: once 'flag++' happens there is nothing to set flag back to 0 so it will just keep going up.
5707  Using Arduino / General Electronics / Re: need variable voltage on: January 29, 2012, 10:02:13 pm
The "analog output" from the Arduino is pulse-width-modulated 5V.  You control the duty cycle from 0/255ths to 255/255ths.  If you put that through a low-pass filter (resistor and capacitor) you can get a good approximation of a 0V to 5V analog output.  You could run an op-amp on a higher voltage (say, 12V) configured as a voltage doubler to boost the voltage range to 0V-10V.  If you want more precise control in the 9V to 10V range there is probably some way to offset the op-amp output.  Ideally you'd have the op-amp gain of 1/5th (probably takes two op-amps) and offset of 9V so you'd get 256 steps between 9V and 10V.
5708  Using Arduino / Sensors / Re: Problems with Paractical Arduino Water Depth Sensor project on: January 29, 2012, 06:54:56 pm
The datasheet for the MPX2053DP (and the MPX2010DP specified in the schematic) says that the normal supply voltage is 10V with a maximum of 16V.  They don't specify a lower limit so 5V might be OK.

The site is slow to load so I have not seen the article yet.

Without labels I can only guess that one of the pots is supposed to adjust for the +/-1 millivolt offset.  Near as I can tell, all of the op-amps are being run at unity gain so I would expect the output to be somewhere between 0V (no differential pressure) and 0.025V (full scale pressure differential).
5709  Using Arduino / Installation & Troubleshooting / Re: Upload causes compile... why? on: January 29, 2012, 06:22:46 pm
This behavior isn't new to 1.0.  As I remember it, all previous versions have behaved this way.  In fact, I just double-checked with 0022 and "verify then upload" results in being compiled twice.

Compiling libraries each time was added in version 0017 where the release notes say:

* Libraries are now compiled with the sketch, eliminating the delay when
  switching boards and the need to delete .o files when changing library
  source code.

Earlier, in 0008, they tried recompiling all libraries when changing boards, which caused that process to be slow:

* Now recompiling libraries when switching microcontrollers.  Report by
  Julian Bleecker; fix by Nicholas Zambetti.

Back before 0005 it sometimes didn't re-build the sketch when it should:

  Fixed bug that sometimes caused uploading of old versions of a sketch.
5710  Using Arduino / Programming Questions / Re: Serial port parity change on: January 29, 2012, 06:08:04 pm
It is one thing to enable the parity options for just sending characters with proper even or odd parity. However I don't think the existing serial functions will help you in detecting parity errors on incoming characters without modification of the serial library? Perhaps someone more knowledgeable can comment on that?

From my reading of the ATmega datasheet and the HardwareSerial.cpp source it looks like any receive overrun, parity, or framing error is ignored.  To check for such errors the code would have to read the UCSRnA register before reading the character from the UDRn register.  The receive interrupt service routines just read the data register (UDRn) and shoves the character into the buffer.
5711  Using Arduino / Programming Questions / Re: Serial port parity change on: January 29, 2012, 12:50:59 pm
Many thanks for the help. I assume I just drop this into the 'setup' part of the sketch and all should work?

I think it will probably work if you just put the setting of parity mode after .begin().
5712  Using Arduino / Installation & Troubleshooting / Re: Upload causes compile... why? on: January 29, 2012, 12:49:12 pm
All the IDE really needs to do is compare the timestamps of the .ino file and the .hex file. If .hex is later than .ino just upload w/o compiling.

To do that it would have to keep the .hex file for every compiled sketch.  The default is to delete the intermediate files after the upload/verify.  (You can change that default in preferences.txt.  export.delete_target_folder=false or preproc.save_build_files=true or something like that.)

Something like this could theoretically be done but it would take a good deal of work and is probably not worth it for the small number of people who are frequently uploading the same very large sketch.

A work-around is to change the options to NOT delete intermediate files, then use avrdude directly to re-upload your .HEX file.

Another work-around is to skip the Arduino IDE and use makefiles to directly drive the compiler and uploader.
5713  Using Arduino / General Electronics / Re: Alternative ideas for these switches on: January 29, 2012, 12:25:15 pm
If you want button height then the Panasonic EVQ11 or EVQ2 models might work:

You can get them in 9.5, 7.0, 5.0, and 4.3 mm button height.  They only have two pins instead of 4.

The FSM series from TE Connectivity have heights up to 17mm:
5714  Using Arduino / Installation & Troubleshooting / Re: Upload causes compile... why? on: January 29, 2012, 10:49:16 am
For each library you use the IDE would have to keep track of what compile-time options were selected last time it was compiled in order to be sure the resulting binary would not be different.  For most cases the compile doesn't take more than a few seconds.

No need to 'verify' your code is you plan to immediately upload it.  Just hit the upload button.  If the compile fails it won't upload.

(Verify is useful if you want to check the compile without having the target board connected.)
5715  Using Arduino / Programming Questions / Re: hex size versus sketch size on: January 29, 2012, 10:43:01 am
Thanks, this is some great information.

So does the Arduino IDE just basically use that formula when it spits out the sketch size?

No, the compiler knows how many bytes it is converting to hex and reports that. 

The formula will give you a way to estimate the memory footprint of a .hex file (divide by 44/16ths or multiply by 16/44ths).  That should get you within 20 bytes or so.

Oh, I forgot to mention that on a machine that uses CR/LF for line terminators (Windows) it's 45/16ths. 

20,910 * 16/45ths = 7434.666... which is very close to the actual reported binary size 7426.
Pages: 1 ... 379 380 [381] 382 383 ... 542