Show Posts
Pages: 1 ... 51 52 [53] 54 55 ... 68
781  Using Arduino / Programming Questions / Re: Pressure differential sensor, analog input issue on: June 29, 2012, 04:37:25 am
Due to function overloading, if the first parameter is a floating point number the second parameter is taken as the precision, not the base.  OCT is a macro equating to 8...

That's not how to use it, in my opionon. I thinks it's even erroneous misusage of something not ment for it.

About the octal usage, only people using octal think that way...  smiley-wink I have used this long time ago (just once):
782  Using Arduino / Project Guidance / Re: Arduino+arduinix+RTC on: June 29, 2012, 03:00:19 am
You could use any Real Time Clock (RTC) module. For example the DS1307, because there a lot of example code for that RTC.
Here is a nice tutorial :

Once you set the time, you need code to communicate with the RTC. You have to retrieve the current time from it to be able to display it.

Every nixie clock uses and RTC, so there are examples.
Your could check some links of user projects:
783  Using Arduino / Project Guidance / Re: 3 axis accelerometer ADXL345 - i have an example for uno, need mega on: June 29, 2012, 02:49:33 am
Please add a link to your sensor board. Is is this one:
That one hasn't got any pull-up resistors, so you have to set the levels to SDO and CS and you have to add your own I2C pull-up resistors.

Add pull-up resistors of 4k7 on the SCL and SDA to 3.3V.

Check the datasheet for SDO and CS.
Warning: I'm having problems with the example of Sparfun! The SDO and CS should not be connected to an Arduino output. That output could be +5V which is too much.
Connect CS to the 3.3V to select I2C communication.
Connect SDO to ground for the default I2C address.

Run a scanner sketch to detect if any I2C device is on the bus: I used this code by user RandallR for scanning. See here:,96952.msg738703.html#msg738703.

Please don't cross-post:,112156.0.html,112157.0.html
784  Using Arduino / Programming Questions / Re: Pressure differential sensor, analog input issue on: June 29, 2012, 02:36:02 am
Is the sensor a flow sensor ? Can you tell which one and add a link to it ?  (just copy the url in the message).
In your code, the flow sensor must output 0V if there is no flow.

You use octal ('OCT') notation for a double precision floating point.
But the octal notation is only used by old programmer pioneers with long white beards.
Just use "Serial.println(volFlow);" to print a floating point number, or "Serial.println(volFlow,3);" with 3 digits after the comma. The same goes for the 'tank' variable.

785  Using Arduino / Sensors / Re: MPU6050 + arduino nano + raw data over serial on: June 28, 2012, 10:43:48 am
That's it.
The reserved bits can (must?) be written with zeros.
786  Using Arduino / Motors, Mechanics, and Power / Re: HELP 4 motors 1 arduino on: June 28, 2012, 10:41:23 am
The Arduino makes it's own 5V. The Vin can be 6 ... 12V.

You can use the USB connector for the 5V.
Or you can supply an external +5V to the 5V pin of the Arduino.
Or you can supply an external 6...12V to Vin.
So I would prefer to connect the +12V to Vin.

Everything else is okay.

The PWM is able to switch fast, and by using different pulse widths the speed of the motor can be controlled.
The Arduino function for PWM output is called analogWrite().

analogWrite(11, 0); // motor off
analogWrite(11,128); // motor 50%
analogWrite(11,255); // motor on

Have fun!
787  Using Arduino / Sensors / Re: Animals motion sensor! on: June 28, 2012, 07:02:55 am
Let us know what motion sensor you use.

Is it a PIR motion sensor like the ones that are used in alarm systems ?
That should detect humans and animals, but how good it is depends on the quality.
Some PIR motion sensors can be set to 'high' or 'low' sensitivity. The 'lens' that creates the bundles in front of the PIR sensor has also a large influence on the sensitivity.

A good explanation is here:

edit: I misunderstood your question. After reading the post by Magician below, I got it. Perhaps you can use a special 'lens' or use tape to select a beam below 1m and another sensor for above 1m.

788  Using Arduino / Sensors / Re: accelerometer angle reading on: June 28, 2012, 06:57:24 am
...trace angles and control the rotation of a motor...

Please tell us more how you plan to do this. An accelerometer does not measure the rotation of a motor. I can measure how much something is tilted.
789  Using Arduino / Motors, Mechanics, and Power / Re: HELP 4 motors 1 arduino on: June 28, 2012, 04:10:14 am
No, the schematic is a little confusing.
In my attachted drawing I use the same 12V power supply for the Arduino and the motor. But you could use two different power supplies, as long as both grounds are connected to each other.

You could buy a motor shield. Have you thought about that?
I had fun with an Ebay clone of the Adafruit motor shield :
No soldering, but you need some program code to make it work.
790  Using Arduino / Sensors / Re: MPU6050 SparkFun Breakout to Arduino Uno - No Communication on: June 28, 2012, 03:52:11 am
...As far as i have understanded from the datasheet  ¿it auto calibrates to 0g right?, i mean, i don't need to substract any 0g value from my output ¿right?.

And at +-2g scale the sensitivity is 16384 LSB/g so, to get acceleration in g's, at 16bits, (rawAxis - 32767)/16384 ¿am i right?

My sketch is ment to give a quick start. On this page I mention to use the library by Jeff Rowberg for serious use.

The MEMS sensors are a great invention, but they have a large offset and the sensitivity is inaccurate.
Lucky for us, the sensitivity of the MPU-6050 is calibrated. The gyro sensitivity scale and the accelerometer scale are factory calibrated.
But not the offset (I can't read it in the datasheet).
So when using the raw values, the offset could be taken care of in software. Or by using the undocumented offset registers in the MPU-6050.
When using DMP firmware, the offset compensation could be in the firmware.

Accelerator with +/-2g range = 16384 LSB/g. So a value of 16384 is 1 g.
Get the accelerator value during setup(), and save it in rawOffset.
In the loop() get the value and calculate the 'g' value:
double g;
g = (double) (rawAxis - rawOffset ) / 16384.0;
And that for all 6 values (3 gyro, 3 accel).

During setup() the z-axis gets 1 'g' of the earth gravity. So you have to add 1 'g' after the offset compensation.
791  Using Arduino / Sensors / Re: MPU6050 + arduino nano + raw data over serial on: June 28, 2012, 03:16:17 am
I used a function to write multiple bytes, and used that to write a single byte.
For someone used to handle data and pointers is looks standard, but it looks weird the first time.

This is how it was:
uint8_t c;           // an unsigned character of 8 bits

c = 0x08;           // the value to write to the register

// Use address of 'c', by using '&c'.
// Third parameter if '1', that is the number of bytes to write.
MPU6050_write (MPU6050_GYRO_CONFIG, &c, 1);

But now I have added a function to write a single byte. Get the new code :
It is now like this:
MPU6050_write_reg (MPU6050_GYRO_CONFIG, 0x08);
That's a lot easier.
792  Using Arduino / Sensors / Re: Linear potentiometer on: June 27, 2012, 07:52:19 pm
You could add some links, just copy the url in the message.
Is this your sensor :  ?
Is it the same as the MicroNav Strip ?
The datasheet can be found by googling for "Force Sensing Linear Potentiometer (FSLP) Integration Guide".

For example the Arduino Uno has 13 digital inputs/outputs (sometimes called GPIO = General Purpose Input/Output) and 6 analog inputs. The 6 analog inputs can also be configured as digital inputs/outputs.
I think you have to be able to switch between analog input and digital output for the sensor.

There are no analog outputs, but some digital outputs can be used with PWM to be able to dim leds, lights, motors, etc. What is PWM ?, see Wikipedia:

If a digital output is low, it's output is 0V. That's ground level.

A high impedance is a high resistance. If a pin of the Arduino is set as an digital or analog input, it's input resistance is extremely high. That's called "high impedance".

The 4k6 resistor is a used for a nifty trick to be able to be able to distinguish between position and pressure. It has to do with impedance and charge of the sensor. I don't understand how exactly it is done, but just follow the instructions.
You need only one Arduino. You have to implement both instructions in code to get the position and the pressure. They cannot be measured at the same time, but that's okay. A few milliseconds between them should be no problem I assume.

For example:
sensor pin 1 : connect to Arduino analog input, for example A0.
via Ro of 4k6 : connect to Arduino digital pin, for example 3  (pin 1 and 2 are used for Serial output to the computer).
sensor pin 2 : connect to Arduino digital pin, for example 4.
sensor pin 3 : connect to Arduino analog input, for example A1.
793  Using Arduino / Sensors / Re: MPU6050 SparkFun Breakout to Arduino Uno - No Communication on: June 27, 2012, 07:32:51 pm

My sketch should work now without any problem.
If the sketch needs more comment, or more explanation or so, please let me know.
For serious use, you could use Jeff Rowberg's library.
794  Using Arduino / Motors, Mechanics, and Power / Re: HELP 4 motors 1 arduino on: June 27, 2012, 07:30:14 pm
No problem.
The motor and the 'flyback' diode can be connected to 12V.
The ground of the 12V has to be connected to the ground of the Arduino.

The transistor gets it's base current from the Arduino (through a resistor), and it controls the motor which is connected to 12V.

Instead of transistors, resistors and flyback-diodes, you could use a ULN2803. The ULN2803 has the resistors and flyback-diodes build-in.
795  Using Arduino / Sensors / Re: Sonar range finders in ANALOG input pins or DIGITAL pins? on: June 27, 2012, 07:24:09 pm
If you have this: than the output signal of the sensor is digital.
Every analog input can also be configured as an digital input or output.
Pages: 1 ... 51 52 [53] 54 55 ... 68