Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Interfacing / Re: PHP Serial Communication on: October 18, 2010, 06:32:20 am
have you had a look at and other entries  on php and serial comms ?

main issue seems to be autoreset of arduino, which can be hacked by a resistor on the reset pin (or just buy a clone with a switch).

Good luck !
2  Forum 2005-2010 (read only) / Development / Re: 12v rgb led strip on: August 25, 2010, 06:23:57 am
I have a similar strip. The red leds have a fwd voltage of 2, and use the 330 ohm resistors per 3 leds. Blue and green are 3V and each use a 150 ohms resistor. Use to tinker with this. Now, about the amperage I made same calc as you did to arrive at 60mA*50 = 3A. Either the supply is beyond max or it isn't lighting the LEDs properly. In any case, it's a shame they didn't make the strings twice as long, in which case they could have left out the resistor on the red leds. Now, how do drive these with my arduino ?
3  Forum 2005-2010 (read only) / Development / Re: 12v rgb led strip on: August 25, 2010, 06:32:28 am
3 reds in series take a 330 ohm resitor, 3 blues and 3 greens each take a 150 Ohm resistor. The 3 series are likely connected to same +12V on their positive anode side. The resistors can be anywhere in the series, first, last, or in between the LEDs.
4  Forum 2005-2010 (read only) / Interfacing / Re: PH Probe Op Amp help on: April 14, 2010, 03:31:57 pm
If you are looking for a fast and easy solution : a reasonably cheap alternative that allows immediate interfacing between Arduino and pH probe is the costs 30$ and has ideal inverted signal, 525mV offset and 4.75 gain. I have to admit: I tried the self-build option and failed.
This phidget has good gain which allows for more precise A/D conversions by the Arduino. Other interfaces (Vernier) only have 2.2 gain, resulting in larger margins of error.
5  Forum 2005-2010 (read only) / Interfacing / Re: Arduino for 24V environment on: January 12, 2011, 01:22:28 am
One way to tackle this is with a solid state relay board (relay rack), and a bunch of IDC5 relays (Gordos, Grayhill, Opto22, ...). These relays will convert the 24V signal into 5VDC, while keeping the circuits optically isolated (ie very little chance on the 24V frying your arduino). You can get deals on these boards on ebay from time to time. Some boards have an IDC connector, others have edge connectors (like PC-cards). I guess you could solder wires on the edge connector and pull them straight to your arduino. I have not tried input DC relays thsi way, but am running 4x24=96 output relays through a tiny 8x10cm board that carries 12 shift registers 74HC595 and 4 IDC50 connectors. Works well.
6  Forum 2005-2010 (read only) / Interfacing / Re: SSR Rack on: October 13, 2010, 11:42:05 pm
Here are some more :

Sealevel also makes a small TA01 unit that serves as a testbed for relay racks, simulating I and O with led and small switches.

These racks are industry standard, you can use a number of relay brands that comply to the same standard, and even use diffrent types of SSR (any of the 4 combos between : I or O; DC or AC) on the same board. I think all of them are negative logic, ie to switch on the output relay you need to ground the signal line.

I am working on a driver for these based on an arduino an some cheap daisy-chained shift-registers.
7  Forum 2005-2010 (read only) / Interfacing / Arduino Toroidal EC Electrical Conductivity Probe on: October 13, 2010, 03:32:25 pm
Go easy on me, its my first contribution !

One of my Grand Ideas is to build an automated hydroponics setup. The water to feed my dear veggies needs to be decent quality : temperature, pH and amaount of nutrients need to be within a specific range.

Temperature is easy. pH became easy when Phidgets released their new pH phidget, which converts the minuscule currents from an industry standard pH probe into a 0-5V signal.

But EC has proven to be another level of challenge. I decided early on that I needed the toroidal type of sensor, and these babies cost serious money, even old ones on ebay. Then, a base station that supplies the probes and converts their output into 4-20mA and/or two NO/NC switches. Such stations don't come cheap either.

Another option was to self-build, but a toroidal probe is beyond my abilities, and the circuitry not easy to figure out.

I was lucky to hit upon solumetrix in the UK, who supply an all-in-one probe with a serial output. I connected this to my mega and with some help from them managed to read the values with the arduino. There is an RX option as well to change some settings in the probe, but that is as of yet untouched (default settings work fine for me).

So, below please find my code for reading the Solumetrix BK probe with the arduino mega, should be easy enough to convert the code to an UNO or other single serial model and output via an LCD, it's the reading of the probe values that had me puzzled more.

Good luck.

byte inbyte[9];      // for incoming serial data
byte htrap[2];
int i = 0;
float temp =0;
float uc =0;
float cc =0;
int checksum = 0;

void setup() {
      Serial1.begin(9600);      // opens serial port, sets data rate to 9600 bps


void loop() {

 if( Serial1.available() > 28 )  // command length is 14 bytes,
                                 //so to be sure we have a full transmission in the cache,
                                 //and haven't just captured the end of one message and the start of another
                                 //we await until we are sure to have at least 1 full message
                                 //later on, if there is a tail of a message at the start of the buffer, we fill first drop that
                findheader(); //drop any tail of a message in the buffer, ensure we start reading from the status byte (4)
                checksum = 170+85+1; //AA+55+01=170+85+1
                  for (int i=0; i <= 8; i++)
                     inbyte =;
                     if (i < smiley-cool checksum+=inbyte;//the other 8 bytes for the checksum
                checksum = 256 - (checksum%256);
                if (checksum != inbyte[8])
                    Serial.println("Failed Checksum");
                temp = (inbyte[2]+inbyte[3]*256)/10;
                uc = float(inbyte[4]+inbyte[5]*256)/1000;
                cc = float(inbyte[6]+inbyte[7]*256)/1000;
                Serial.println("I received: ");
            Serial.println(inbyte[0], HEX); //status
            //Serial.print(inbyte[1], HEX); //version
            //Serial.print(inbyte[2], HEX); //01 - type
                //Serial.print(inbyte[3], HEX); //02 - continuous
                //Serial.println(inbyte[4], HEX); //3F - version 6.3
            //Serial.print(inbyte[5], HEX); //temp low
            //Serial.println(inbyte[6], HEX); // temp high
                Serial.print("temp \t");
                //Serial.print(inbyte[7], HEX); //uc low
                //Serial.println(inbyte[8], HEX); //uc high
                Serial.print("uc \t");
                //Serial.print(inbyte[9], HEX); //cc low
                //Serial.println(inbyte[10], HEX); //cc high
                Serial.print("cc \t");
                //Serial.print(inbyte[11], DEC); //checksum
                //Serial.print(inbyte[12], HEX); //55
                   //Serial.println(inbyte[13], HEX); //AA
                //inbyte[0]= 0;
                //inbyte[1]= 0;

void findheader(){ //
    htrap[0] =;
    if (htrap[0] == 170)  //header or footer AAh = 170
      htrap[1] =;
      if (htrap[1] == 85) //can only be header 55h = 85
; // flush the fixed "01" indicating probe type

To connect the probe, I put 12V on the red and black wires (it handles 10 to 24), connected the black wire to the arduino gnd as well, and then connected the orange wire to the megas pin 19 (serial1 RX).

To test, just put a little wire loop with a 1k ohm resistor through the probes hole and around the outside. The value should be 4.550mS. Mine reads 4.61, I guess that's resistor error...
8  Forum 2005-2010 (read only) / Interfacing / Re: wind charge controller/regulator on: May 11, 2010, 11:26:47 pm
@noob : Did you ever find any info on arduino-based charge controlling ? Would love to get some tips...
9  Forum 2005-2010 (read only) / Interfacing / Re: Cheap yet functional pH-meter - questions on: April 14, 2010, 03:29:11 pm
Finally a fast and reasonably cheap alternative that allows immediate interfacing between Arduino and pH probe. The costs 30$ and has ideal inverted signal, 525mV offset and 4.75 gain. I have to admit: I tried the self-build option and failed.
Just wire up with Arduinos 5V, GND and an analog input and done.
10  Forum 2005-2010 (read only) / Interfacing / Re: Another Arduino pH question on: April 14, 2010, 03:27:42 pm
Finally a fast and reasonably cheap alternative that allows immediate interfacing between Arduino and pH probe. The costs 30$ and has ideal inverted signal, 525mV offset and 4.75 gain. I have to admit: I tried the self-build option and failed.
You can just connect the phidget to GND, +5V and an analogin and voila !
11  Forum 2005-2010 (read only) / Interfacing / Re: Interfacing with 0-10v input AC dimmers on: October 27, 2009, 02:01:38 am
This topic is of great interest to me. Can I ask what AC dimmers you are using ? Velleman has the K8064 kit that is marketed as 0-10V but is capable of 0-5V as well. I was going to try tonight to see how well it handles the PWM input directly.

As for your schematic, how stable is the voltage at the 10V side ? Is that what C1 is for, to flatten the signal a bit ?

I will try this out tonight, thanks again.
12  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Serial communication with PHP on: October 18, 2010, 06:23:43 am
@Paul : as mentioned, seeeduino clones (like my mega) come with a switch that enables you to toggle between autoreset and manual reset. I guess this is a cheap but nice feature (even a jumper would do) that all arduinos should have, given that communications seem so much easier with this option.
Anyone speak italian ?   :-)

Thanks for the hints on the open/close and reset. The open/close : I think I would prefer to open/close since I intend to use an xbee (or some other wireless system) to get readings only every 15 minutes or so. Unless I am overlooking anything ?
13  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Serial communication with PHP on: October 16, 2010, 01:50:56 pm
Sweet : I have a seeeduino mega, which has a toggle switch for the reset function : auto or manual, so that issue isn't one here.

I downloaded the php serial class mostly because I am interested in reading values from the arduino into a mysql database. My first trial was with the example.php that comes with the class. I made some really small changes.

- comment out the write line
- check arduino interface for port name, was /dev/ttyUSB0, so change portname to that string
- add html header and footer
- add : echo $serial; after tthe readport() line, this gives me instant feedback, once this works it should easy to direct the output to mysql and then schedule a cron job that calls this php script every 15 minutes or so.

On the arduino, I ran the serial print demo sketch (that prints values in all formats). I verified arduino functionality through serial monitor, than closed that. As you close that, the red tx led on the arduino goes dark.

The first run of the php script failed, the arduino led never gave any sign of life.
I needed to  chmod 777 /dev/ttyUSB0, and then I started to get gibberish in my php page, which means success !

Next up : make the arduino respond to a specific call with readings in a specified format. Or maybe I will do one value depending on which call it gets : pc sends A, arduino response is temperature value, pc sends B, response is hunidity etc.

pc code

include "php_serial.class.php";

echo "<html>
       <head><title>Test MySQL</title></head>

// Let's start the class
$serial = new phpSerial;

// First we must specify the device. This works on both linux and windows (if
// your linux serial device is /dev/ttyS0 for COM1, etc)


// Then we need to open it

// To write into
$serial->sendMessage("Hello !");

// Or to read from
$read = $serial->readPort();

echo "here it is";
echo $read;
echo "here it was";


// If you want to change the configuration, the device must be closed

// We can change the baud rate

// etc...

arduino code =
14  Forum 2005-2010 (read only) / Bar Sport / Re: best place/price to buy sensors?? on: October 13, 2010, 03:02:19 pm
I am working on something very similar.

The pH phidget from converts a standard pH probe into a 0-5V signal : sweet !

As for EC Electrical Conductivity, I tried hard to look at building my own circuit for an inductive aka toroidal ec sensor, but the circuit is a bit difficult and a probe and station cost hundreds, even on ebay.

I was happy to find solumetrix, who sell serial-interface ec probes. I will post my arduino code for this in a separate thread (my first code contribution!). The probes are about 130GBP, which is steep, but if anyone can beat this in any way I am happy to learn. BTW, I have a Rosemount toroidal probe for sale from my earlier efforts.

Good luck !
Pages: [1]