Show Posts
Pages: 1 ... 464 465 [466] 467 468 ... 931
6976  Topics / Science and Measurement / Re: Manipulating the behavior of an exponential function (Math gurus needed!) on: July 23, 2012, 12:02:27 pm
I am currently using this function to achieve my goal: y = (1500 / ((4/3)^(1/670))^1080) • ((4/3)^(1/670))

Unfortunately, the effect of the exponential behavior is very minor and unnoticeable in the application I am using it for in my program. How can I exaggerate the exponential behavior of the function whilst maintaining the two points (1080, 1500) and (1750, 2000)?

Where is the x in the function? smiley

How would you implement the "basic" function if it was between the points (0,0) and (1,1) ? If you can define that the rest is scaling.

Easiest option is to use - - which can mimic all non linear functions

6977  International / Nederlands / Re: Bascom voor Arduino on: July 11, 2012, 01:29:46 pm

Hoi Dre,

Hoewel ik zelf niet snel in BASCOM zal gaan programmeren zie ik in elk geval wel een paar pareltjes.
- Toggle() is een vaak gebruikt iets dus daar wil ik wel een C-variant van,
- WaitMs() vind ik 10x duidelijker dan delay() vanwege de toevoeging ms.

Om de discussie aan te scherpen, in bladen als ELEKTOR staan vaak BASCOM listings, en deze zijn downloadbaar en mezelf kennende heb ik geen zin om deze in C++ te vertalen. Dus op een gegeven moment komt die BASCOM omgeving vanzelf.

Verder een vraag: Hoe werkt het met het zelf maken van libraries in BASCOM? bv voor een sensor of actuator of een statistical lib etc.

gr. Rob
6978  Using Arduino / Sensors / Re: read pulses from TSL250R on: July 11, 2012, 01:14:52 pm
I wonder if someone could help me with the code for counting the pulses when the laserbeam hits the detector.
wrote some proto-code for a TSL235R some time ago, assuming this is similar to the 250  it could get you started

 *    FILE: TSL235R.pde
 *  AUTHOR: Rob Tillaart
 *    DATE: 2011 05 16
 * PURPOSE: prototype TSL235R monitoring 
 * Digital Pin layout ARDUINO
 * =============================
 *  2     IRQ 0    - to TSL235R
 * PIN 1 - GND
 * PIN 2 - VDD - 5V

volatile unsigned long cnt = 0;
unsigned long oldcnt = 0;
unsigned long t = 0;
unsigned long last;
unsigned long msec = 0;
unsigned int cf = 1466;  // cf = 10^0.166 * 1000 (figure 1 datasheet)

void irq1()

void setup()
  pinMode(2, INPUT);
  digitalWrite(2, HIGH);
  attachInterrupt(0, irq1, RISING);

void loop()
  msec = millis() - last;
  if (msec >= 1000)
    last += msec;
    t = cnt;
    unsigned long hz = (t - oldcnt) * 1000 / msec;
    oldcnt = t;
    unsigned long mw = (hz * cf/1000 + 50)/100; // +50 == rounding last digit
    // smoothing possible...
    Serial.print("FREQ: ");
    Serial.print("\t ");
    Serial.println(" mW/m2");


6979  Topics / Science and Measurement / Re: Greenhouse monitoring system on: July 10, 2012, 04:13:22 am

For a greenhouse you might want to monitor CO2 levels too.

If so the cozir sensor might be interesting -,91467.0.html -
6980  Using Arduino / Project Guidance / car screen wiper and photo camera - OBD? on: July 09, 2012, 03:51:33 pm

A few weeks ago I made a photo from my car (in very slow traffic) because there was a beautiful double rainbow. The photo failed because the interval timing of the screenwiper was "perfectly" timed so the wiper was diagonally over the photo. Thanks to digital age I just made another one that looked better (wiper off).

Today I came accross a similar question to synchronize with the wiper-position (can't tell details here, but the question is similar)

So the question is simple: - how to synchronize the wiper and the camera?

To make it a bit difficult, my car wiper increases speed when it rains harder ... adaptive system ...

My first idea would be to measure the last interval and assume the next one is equally in

Q: is the wiper position available in the OBD interface?

all ideas are welcome!

6981  Development / Other Software Development / Re: Class for both DHT11 and DHT 22 (temperature & humidity) on: July 09, 2012, 01:50:11 pm
updated the code to 0.1.03;

+ added code to reflect faulty reading in temperature (-999)  and humidity (-999)  if there is a timeout. So if a sketch does not test the return value of read11() or read22() you will still see it clearly.

As allways comments still welcome
6982  Using Arduino / Sensors / Re: Grove - Humidity & Temperature sensor on: July 01, 2012, 04:14:03 am
Although DHT11 and DHT22 are similar they are not the same. You cannot use a DHT22 library to read values from the DHT11 but also not a library which is for both and read the value for a DHT22 as you do in your posted code.
The lib here - - supports both dht11 and dht22. It has separate read functions per sensortype which use the same handshake for the 5 bytes but interpret these differently.

Can you post actual output, including the CRC check output?
6983  Community / Bar Sport / Project Glass on: June 25, 2012, 01:50:30 pm

stumbled upon a video of project glass (augmented reality), looks like it becomes fun to wear some glasses  smiley

- -

- -
6984  Using Arduino / Programming Questions / Re: Using "Falling" Outside of Interrupt on: June 24, 2012, 03:47:57 am
FALLING is just a predefined number, to set the behaviour of the interrupt. From wiring.h
#define CHANGE 1
#define FALLING 2
#define RISING 3

So yes you can use FALLING but it would probably not do what you expect. It's just a replacement for the number 3
6985  Using Arduino / Programming Questions / Re: creating a library - general help needed on: June 23, 2012, 02:50:47 pm

make all constants at least explicit unsigned long by adding UL after the number e.g. 86400000UL
6986  Topics / Robotics / Re: timing loop control on: June 23, 2012, 05:00:03 am

not tried but my first guess is that you need to cast STD_LOOP_TIME to unsigned long

#define STD_LOOP_TIME 10000UL

6987  Development / Suggestions for the Arduino Project / Re: Documentation request: operator precedence on: June 23, 2012, 04:46:42 am
I double DuaneB,

use as much () as possible or use "simple C notations" by using additional variables.

e.g  if ((x&15)>9)....


t = x & 15;
if (t > 9)

(x&15>9) for intended
6988  Topics / Science and Measurement / Re: Sortest pulse on: June 23, 2012, 03:49:15 am
Good points!
do you have a code sample that does this all?
6989  Using Arduino / Sensors / Re: HIH-4030 Humidity Sensor and Arduino on: June 21, 2012, 02:21:54 pm

from - - the NOAA reference algorithm and the fast variation

// dewPoint function NOAA
// reference:
double dewPoint(double celsius, double humidity)
        double A0= 373.15/(273.15 + celsius);
        double SUM = -7.90298 * (A0-1);
        SUM += 5.02808 * log10(A0);
        SUM += -1.3816e-7 * (pow(10, (11.344*(1-1/A0)))-1) ;
        SUM += 8.1328e-3 * (pow(10,(-3.49149*(A0-1)))-1) ;
        SUM += log10(1013.246);
        double VP = pow(10, SUM-3) * humidity;
        double T = log(VP/0.61078);   // temp var
        return (241.88 * T) / (17.558-T);

// delta max = 0.6544 wrt dewPoint()
// 5x faster than dewPoint()
// reference:
double dewPointFast(double celsius, double humidity)
        double a = 17.271;
        double b = 237.7;
        double temp = (a * celsius) / (b + celsius) + log(humidity/100);
        double Td = (b * temp) / (a - temp);
        return Td;
6990  Community / Gigs and Collaborations / Re: coder is needed .... please help on: June 21, 2012, 12:47:04 pm

Do you have a link to the datasheet of the thermostat and the other hardware?

Please be aware that for relays and servos you need a secondary power supply (COnnect grounds of the both power supplies to keep one reference ground).

I advice you to go through

it great to see a forum that help us understand electricity and arduino
Some free books about electronics to read - -

since we don't have a hacker space here in saudi arabia
That is a good reason to start one! place a call for people in the local groups corner.

Furthermore you can contact the KIng Abdullah University for science and technology to get support - -
they might have some budget and /or material to get you started, they are quite openminded  just make sure you have a decent proposal.

Pages: 1 ... 464 465 [466] 467 468 ... 931