Show Posts
Pages: [1] 2 3 ... 27
1  Using Arduino / Project Guidance / Re: Project too complicated ? on: June 22, 2014, 04:01:39 pm
My thought is "bugger the Arduino, protect the swimmers".
But hey! That's just my POV, as a swimmer.

Are you saying the cabling is safer when connected direct to the Arduino and using the internal pull-up resistors, or when using the 5V powered optocouplers ?

Since both systems are using 5V, would there be any difference ?

And YES, protecting the swimmers is of utmost importance. One of the kids is my own, and he has one heck of a bad a$$ mommy.
2  Using Arduino / Project Guidance / Re: Project too complicated ? on: June 21, 2014, 12:39:03 am
Thinking outside the box. Garden hose, when used normally, keeps water in. Run your cable through a new length of (dry) hose (use talc to make it slide through easier) to keep water out. Seal the ends of the hose with silicon sealant and keep them out of the water to keep your cable dry.

Herny_Best

Thanks for the idea about the hosepipe. Will also help to stop damage to the cable if someone accidentally stands on it, and will also prevent kinks.

I don't understand your need for optocouplers. One side of your switches will be ground, the other side will have a voltage on it, whether you use optocouplers or not.

OK. So the one side of the button / switch will be permanently connected to Ground, and the 'open' side will have a pull-up resistor. My thinking on the optocouplers was to use them to protect the Arduino.

But from your comment, it looks like Ground is Ground, so I can easily use a 5V supply for the optocouplers and the ground to the finish line and back.

Appreciate the input.
3  Using Arduino / Project Guidance / Re: Project too complicated ? on: June 20, 2014, 04:39:58 pm
run a simple cat cable to the other end with 5V and ground, 6 buttons to each wire.

Thanks shooter.

Sounds like the same as I was thinking, except I was planning to run the Vcc to the optocouplers, and then only the ground needs to go down the cat5e to the finish end for the buttons to return when pressed / circuit closed.

On that point, would there be any difference in the quality / strength of the Ground signal that has to go from the start, to the finish, and back again ( when a button is pressed ), a round distance ' there and back ' of about 90 meters ( 280 ft ), when selecting a 5V supply compared to a 12V supply.

5V supplies are laying around all over my office as discarded cell phone chargers, etc.  The first one I just picked up is 5VDC 0.7A.

The optocouplers ( SFH615A ), if I am reading correctly, have a forward voltage of 1.25V 60mA, so should easily be able to power 12 optocouplers from one of these.


4  Using Arduino / Project Guidance / Re: Project too complicated ? on: June 20, 2014, 06:40:18 am
Time measurement will be much easier with a single Arduino. It is not that easy to synchronize time between two devices.

...R

Thanks Robin2

Although the time calculation is not super serious if we lose a fraction of a second while communicating the start time between arduinos, I am concerned about the increased possibility of errors and faults with every additional device and comms line in the system.

Looks like the single Arduino is currently the preferred choice. Any advice on the pull-up resistors and optocouplers ?
5  Using Arduino / Project Guidance / Re: Project too complicated ? on: June 20, 2014, 06:37:40 am
Quote
The start is triggered by an Arduino which activates the start siren, tracks the start time millis, as well as uploads data to the PC using ethernet.
If the arduino only sounds a siren for start and logs the time and does not need to detect early jumpers off the start line then why not put the arduino at the finish end and maybe just run a cable for the siren to the other end if needed.

Thanks Riva

I had considered that, but the mains power is at the start line end of the pool, as is the PC and router. My thinking was the single Arduino at the start end, and only ground carrying cable along the ground to the finish line for the timer buttons. Sounds much safer than having to run power to the arduino at the finish ( either AC Mains or 12VDC ) and then still having to run a network cable all the way back to the router and PC at the start end.

6  Using Arduino / Project Guidance / Project too complicated ? on: June 20, 2014, 02:45:28 am
We are all 'outside the box' thinkers, but which side of the box are you looking from ?

I am busy with a swim pool timer project for the local kids club bi-annual gala.
We are not using the costly touch pads, but rather simply push buttons to end each timed event.

The project consists of a web based event management system run on a local PC using xampp as the server.
Swimmers are captured, record times stored in the database, lane allocations and multiple heats scheduled, etc, etc.
The web side is just about completed and busy with testing.

The start is triggered by an Arduino which activates the start siren, tracks the start time millis, as well as uploads data to the PC using ethernet.

Each of the 6 lanes has 2 timer buttons at the finish end.

Question : from the 2 possible options below, which would you consider to be the most reliable :

Both option require the laying of an ethernet cable from one end of the pool to the other. Wireless / RF is not an option at the moment due to cost and availability.


option 1 :
----------
2 Arduinos, 1 at each end of the pool ( distance 45 meters / 140 ft ), both connected to an ethernet router ( PC also connected to router ) , with the 'starter' unit telling the 'finish' unit the millis ( A ) when the event was started, as well as the millis ( B ) when the data is sent to the 'finish' unit ( so the finish unit can receive the data, calculate that the start time was ' CurrentMillis - ( B - A ) ' ) and then wait for the input pin for each lane to be pressed ( LOW ) and calculate the actual swim time. Then upload the finished times to the PC over ethernet.

Is this too complicated / complex ?
A mountain out of a mole-hill ?
Using the second Arduino where it is not needed ?
Too many steps making system failure more possible ?

option 2 :
----------
Run 2 lengths of cat5e cable from the finish back to the start, and have only 1 Arduino at the start end, connected to the router to upload data to the PC. Floating Lines in the cat5e cable would need to be pulled HIGH, and the press of each button would Ground the line back to the input pin.

Of the 8 core in each cat5e cable, 2 can be ground, and the other 6 to each of the 6 lane buttons. Running 2 cables means that we have 2 sets of ground lines, and each of the 2 buttons for each lane are connected back to the Arduino on different cables - so if one cable is damaged, we only lose 1 button on each lane, and still have the second button for timing.

My thought is that this option does not require me to run any power to the other end of the pool, as the lines for the buttons are all Ground lines. Sounds safer to me.

If this is the more simple and reliable option, would you :

1. Use a separate 12VDC power supply ( at the Starter end ) for the Ground signal and return inputs that has to go the 140ft ( and back to the start unit ), and connect the ground signals from the buttons to optocouplers ( to trigger the input pins on the arduino ) ?

2. What size pull-up resistors should I be looking at on the floating return lines while the button is 'open' ?
Does length of the cable affect this resistor size ?

Any other factors that you can think of that would / could affect the viability of these options ?

Maybe I am looking at the options with blinkers on, so all input greatly appreciated.
7  Using Arduino / Networking, Protocols, and Devices / Re: ENC28J60 modules conflicting on: June 19, 2014, 03:42:36 am
Hi PaulS

Thinking about your comment on the size of the char :


Code:
char XXbuffer[200]; /* local buffer into which strings are encoded and from which they're output'd */
sprintf (XXbuffer, "U1txStart=1&U1millis=%ld&U1txEnd=1", millis());
It's worth taking your shoes off, if you need to, and count the number of characters you really need in the array. 200 is far too many. You don't have the resources to waste.


would it not be better to use a String that will expand as more data is added to it ?

I have seen code online that includes this :
Code:
String txData =""; // This is the Data that will be sent to the PHP page. It will have variable names and data in it.

txData = "DataToSend1=" + (String ( '__some integer or long value__' )) + "&DataToSend2=" + (String ( '__some integer or long value__' ));

client.print(txData);    // send the String to the php script

and if so, would it make any difference to the resources after the data is sent to the php script, if the String was reset, say with :
Code:
String txData ="";
8  Using Arduino / Networking, Protocols, and Devices / Re: ENC28J60 modules conflicting < solved > on: June 18, 2014, 04:58:04 pm
Finally with some pointers and direction from the guru's, I have a working solution that appears stable after 2 hours of testing.

My mistake was to assume that, because I was running xampp on my PC as a web server so that I could host php files on my PC and have the Arduinos interact with the PC based data, that the IP address of the xampp web server ( in my case 192.168.1.100 ) should be used as the Gateway and DNS server when setting the UIPEthernet.begin

I changed these to the IP address of the router ( 192.168.1.254 ) and guess what -- worked !   I can't believe I didn't think of trying that earlier.  It was only after an earlier reply from PaulS, that I stripped the code down to the bare minimum, and went so far as to remove the code that he mentioned was wasting space / resources. The problem still existed, but at least I was dealing with a lot less code to try and find the cause in.

Once I had each of the Arduinos communicating with the PC individually, I connected them both to the ethernet hub, and found out something else :

In the code :
I had to change .print to .println at the end before the delay, and
I also had to add the ' User-Agent' line, otherwise it just would not transmit.

Code:
client.print("GET /test/RXard.php?");
client.println(XXbuffer);
client.println("HTTP/1.1");
client.println("Host: http://192.168.1.100");
                                client.println("User-Agent: arduino-ethernet");
client.println("Connection: close");
client.println();
delay(250);
client.stop();

I still have to re-examine the code that extracts the keys and values from the incoming http data ( as PaulS suggested ), but in case anyone else can make use of this, the working code that I have at the moment is in the attachment.
9  Using Arduino / Networking, Protocols, and Devices / Re: ENC28J60 modules conflicting on: June 18, 2014, 09:34:49 am
Hi PaulS

Thanks for the detailed reply and the length that you have gone to in your reply. I say this in the most sincere way and must add that your input on the forum, together with the other highly experienced members, is so greatly appreciated and valued by those of us still trying to learn what you have already forgotten.

Looking at your reply, the points you mentioned don't seem to have relevance to the ethernet problem, unless you are saying that they would cause a memory problem that would break the sketch ?

Either way, your points are taken, and I will spend some time trying to better understand the code and how to make it more 'friendly'.

Your last point about the GET command : OK, so it may not be the 'usual way' ( and I am still to find the correct way to do this ), but my question is that if this code is working some of the time, it would appear to work as it is in the sketch, what could be causing the sketch to break ?
10  Using Arduino / Networking, Protocols, and Devices / Re: ENC28J60 modules conflicting on: June 18, 2014, 08:32:05 am
OK. I have stripped down the code as much as I can, and have a 'working' faulty sketch.

At the moment, I only have unit 1 connected to the ethernet, but am still getting erratic results.

I have added the IP and MAC addresses into the router 'Static ARP' table, and also added the MAC addresses to the router firewall 'MAC Filter' as 'always on'

Ping from the PC is now giving constant replies, mostly < 2ms

Only when the Mega is receiving data from the PC and replying back to the PC does the ping time increase to around 500ms ( just for 1 ping )

Although the ping is still working, the test that I am running from the PC browser ( first URL commented in the code ) is still erratic. Sometimes it works in about 2 seconds, other times it runs for over a minutes and the browser gives up.

It seems like the sketch is busy doing something and not listening to the incoming data.

Am I missing something simple here ?
11  Using Arduino / Networking, Protocols, and Devices / Re: ENC28J60 modules conflicting on: June 18, 2014, 06:07:48 am
Hi PaulS.

Thanks for the reply and apologies for wasting your time - not the intention.

The code is quite long, so I will have to strip down until it contains just the relevant code and still produces the error.

The selection of the "which Arduino" I am trying to do with a Ground connected to input pin 23 on the second board only, so if the digitalread on pin 23 = high, then it is unit 1, and 23 = LOW is unit 2.

Since posting, I have separated the sketches and hard coded the MAC address and IP address different for each.

I am now seeing to different addresses, but still not PINGing reliably.

So I am thinking that maybe I can't have 2 boards running as servers on the same network with the same port 80, or it could be a router firewall issue.

Regards
12  Using Arduino / Networking, Protocols, and Devices / Re: ENC28J60 modules conflicting on: June 18, 2014, 05:32:02 am
Also, is it possible that the EthernetServer server(80) on both Arduinos could cause a problem ?

Do they each need unique port numbers ?
13  Using Arduino / Networking, Protocols, and Devices / Re: ENC28J60 modules conflicting on: June 18, 2014, 05:16:39 am
OK. Just found this on google.

I ran a ping on the PC : ping 192.168.1.100
then typed : arp -a

Although the 2 arduino boards are powered off, it shows the 2 IP addresses ( 192.168.1.115 and 192.168.1.116 ) but both with the same MAC address.

Is there a something wrong with the code, or is there a fault in the library ?

I know the conditional 'if' statement in the code is working, because the 2 IP addresses are being shown.
14  Using Arduino / Networking, Protocols, and Devices / ENC28J60 modules conflicting <solved> on: June 18, 2014, 05:10:33 am
I have a PC and 2 Arduino Mega 2560 boards with ethernet modules, all connected to a central router / hub.

There appears to be some conflict in the modules, as I am not getting reliable comms.

I have tried swapping the boards, and also the ethernet modules, cables, etc.

If I disconnect either one of the 2 modules from the hub, the remaining unit PINGs from the PC perfectly.
As soon as I connect the other module, the PING becomes erratic, with 'destination host unreachable'

I am using the UIPethernet library.

I assume that the MAC address for each module is set in the code ( or do I have to read the MAC from the attached module ? ) and I have specified separate IP addresses for each board.

Any suggestions please ?

Extract from the code :
Code:
char XamppOnPC[] = "192.168.1.100";
IPAddress gateway(192,168,1,100);  // IP of the PC running xAMPp as the server
IPAddress subnet(255,255,255,0); //subnet mask
IPAddress dnsServerIP(192,168,1,100);  // IP of the PC running xAMPp as the server
EthernetServer server(80);
EthernetClient client;

IPAddress myIP1(192,168,1,115);
byte mac1[] = { 0xDE, 0xAD, 0xEE, 0xBB, 0xBB, 0xED };

IPAddress myIP2(192,168,1,116);
byte mac2[] = { 0xDE, 0xAD, 0xEE, 0xFF, 0xAA, 0xED };

if(DeviceType == 1) {    // this is set from a digital read on a pin. No Gnd for unit 1, Gnd for unit 2
Serial.println("Device Type = Unit 1");
UIPEthernet.begin(mac1, myIP1, dnsServerIP, gateway, subnet);
}

if(DeviceType == 2) {
Serial.println("Device Type = Unit 2");
UIPEthernet.begin(mac2, myIP2, dnsServerIP, gateway, subnet);
}

char XXbuffer[200]; /* local buffer into which strings are encoded and from which they're output'd */
sprintf (XXbuffer, "SUGCtxStart=1");
Serial.println ("Sending Data to PC :");
Serial.println (XXbuffer);
if (client.connect(XamppOnPC, 80)) {
client.print("GET http://192.168.1.100/testCode/RXard.php?");
client.print(XXbuffer);
client.println(" HTTP/1.1");
client.println("Host: http://192.168.1.100");
client.println( "Connection: close" );
client.println();
delay(250);
client.stop();
Serial.println ("Ethernet Operation Completed");
}else{
Serial.println("Not Connected to PC Control Unit");
}


15  Using Arduino / Networking, Protocols, and Devices / Re: UIPethernet myIP not changing <solved> on: June 17, 2014, 11:44:03 am
OK. Looks like I managed to solve this working from a different direction :

Code:
IPAddress myIP1(192,168,1,115);
byte mac1[] = { 0xDE, 0xAD, 0xEE, 0xFF, 0xAA, 0xED }; //physical mac address of the EN module
IPAddress myIP2(192,168,1,116);
byte mac2[] = { 0xDE, 0xAD, 0xEE, 0xBB, 0xBB, 0xED }; //physical mac address of the EN module

if(DeviceType == 0) {
UIPEthernet.begin(mac1, myIP1, dnsServerIP, gateway, subnet);
    }

if(DeviceType == 1) {
        Serial.println("Device Type = Unit 2");
UIPEthernet.begin(mac2, myIP2, dnsServerIP, gateway, subnet);
    }
Pages: [1] 2 3 ... 27