Go to Post My favorite is always "The Next One!" - Bill Moore [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rating: Thread Rating: 8 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 31-07-2013, 16:21
jwallace15's Avatar
jwallace15 jwallace15 is offline
What am I going to do with my life?
AKA: Wally
FRC #0068 (Truck Town Thunder)
Team Role: College Student
 
Join Date: Aug 2012
Rookie Year: 2013
Location: Michigan
Posts: 435
jwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud of
Re: Arduino + Ethernet Shield Help

Quote:
Originally Posted by ajlapp View Post
One simple option for testing...
I'll look into that. My Dad won't be too thrilled because he worked for ages getting out old router to be a bridge (or something like that). But thanks for the option!

Quote:
Originally Posted by techhelpbb View Post
Is the relay board pictured? Just curious.
Judging by the URL it seems like it. That website is blocked on my computer under the category of "Ecommerce".

This is it: http://www.amazon.com/SainSmart-8-Ch.../dp/B0057OC5WK
__________________
J Wallace IV
Truck Town Thunder
Just a college student now.

Last edited by jwallace15 : 31-07-2013 at 16:26.
  #2   Spotlight this post!  
Unread 31-07-2013, 22:03
jwallace15's Avatar
jwallace15 jwallace15 is offline
What am I going to do with my life?
AKA: Wally
FRC #0068 (Truck Town Thunder)
Team Role: College Student
 
Join Date: Aug 2012
Rookie Year: 2013
Location: Michigan
Posts: 435
jwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud of
Re: Arduino + Ethernet Shield Help

Quote:
Originally Posted by techhelpbb View Post
So you need to put something between your Arduino and that board if those numbers are even close to correct.
What sort of thing are you talking about? Resistor? Transistor? 1000µf capacitor?

(ok the capacitor was a joke but still, do you mean a transistor?)

I did notice when I first started using it that strange things would happen.. Such as when I'd try to close the circuit for all 8 relays that the LED's would dim and only 4 relays would click. I also had trouble with the digital input pins (I have emergency stop buttons on the control panels, and was trying to get it so that if the buttons were pressed it would turn on a relay that closed the circuit for a very bright red LED matrix to simulate a warning light) when the relay was activated.

I got my R3 from a kit off of Sparkfun and it included a toy motor to switched on by a transistor (but run off of the Arduino +5v output). It also had a temperature sensor. One day I was trying to simulate a thermostat by entering in a selected temperature into the Serial Monitor, and then if the current temperature was above the entered temperature it would turn on the motor. I'm not sure what happened but the temperature sensor started giving me bogus readings of 500+ degrees (it was not a programming error as I tested it with a code I had written before that worked fine). I think possibly I burnt out the sensor?

/tangent

Anyways, are you suggesting adding a transistor between the Arduino and the relay?

(and by the way for any of you wondering, "In that picture.. Is that an air pressure gauge on the left? And pneumatic tubing in the background?" well yes. I have pnuematics on my train set. Problem? )
__________________
J Wallace IV
Truck Town Thunder
Just a college student now.

Last edited by jwallace15 : 31-07-2013 at 22:09.
  #3   Spotlight this post!  
Unread 31-07-2013, 22:07
techhelpbb's Avatar
techhelpbb techhelpbb is offline
Registered User
FRC #0011 (MORT - Team 11)
Team Role: Mentor
 
Join Date: Nov 2010
Rookie Year: 1997
Location: New Jersey
Posts: 1,622
techhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond repute
Re: Arduino + Ethernet Shield Help

Quote:
Originally Posted by jwallace15 View Post
What sort of thing are you talking about? Resistor? Transistor? 1000µf capacitor?

(ok the capacitor was a joke but still, do you mean a transistor?)

I did notice when I first started using it that strange things would happen.. Such as when I'd try to close the circuit for all 8 relays that the LED's would dim and only 4 relays would click. I also had trouble with the digital input pins (I have emergency stop buttons on the control panels, and was trying to get it so that if the buttons were pressed it would turn on a relay that closed the circuit for a very bright red LED matrix to simulate a warning light) when the relay was activated.

I got my R3 from a kit off of Sparkfun and it included a toy motor to switched on by a transistor (but run off of the Arduino +5v output). It also had a temperature sensor. One day I was trying to simulate a thermostat by entering in a selected temperature into the Serial Monitor, and then if the current temperature was above the entered temperature it would turn on the motor. I'm not sure what happened but the temperature sensor started giving me bogus readings of 500+ degrees (it was not a programming error as I tested it with a code I had written before that worked fine). I think possibly I burnt out the sensor?

/tangent

Anyways, are you suggesting adding a transistor between the Arduino and the relay?
Sorry I am quite tired.
I deleted my post above because it was going off on a tangent of it's own.

http://www.amazon.com/SainSmart-8-Ch.../dp/B0057OC5WK
The PCB layout image at your Amazon link says something like:

Code:
Input control signal LOW state current:
2.5V at  0.1mA
3.3V at 0.18mA
  5V at 0.35mA
The Arduino use Atmel AVR MCU and they can sink and source a maximum of 40mA per I/O and generally a chip total of 200mA.
Look at the specification sheets for the Atmel AVR chips in question and this link:
http://forums.adafruit.com/viewtopic.php?f=24&t=17802

Here's the thing....it seems unlikely that board uses so little control current as it appears that the input goes through a resistor into the opto-isolator if you look at the blurry schematic.

From the pictures that board appears to have 817C opto-isolators (the close up shows B1312 and 817C).
The datasheet for that is likely here:
http://www.futurlec.com/LED/PC817.shtml

That part lists 50mA maximum forward current and is setup for a nominal 20mA current.

I suspect having thought about this that the numbers as shown on the layout provided are wrong.
How does one operate a 20mA LED with 20x less current and expect that to work?
So either I am wrong and those transistors are the buffer or there is no buffer and those specifications are wrong.

1. Wire that thing up.
2. Disconnect the Arduino.
3. Take a DC ammeter or a suitably configured DMM and measure the current when you close the circuit between one control input pin and the system ground.

If that current exceeds 30mA you do not want to drive it with the Arduino directly.
I suspect the inputs source more than that which is why the reviewers are complaining they can only turn on 5 with the Raspberry Pi.

The safe bet here, given how easy it is to test, is to test this.
If the measured current exceeds say 30mA greatly then drive the 8 relays with a ULN2803 (8 Darlington transistors) or 8 discrete transistors. Just remember to account for the junction voltage drops.
If the measured current is between 30mA and 40mA look at the TTL 7407 or 7417 chips.
Just keep in mind that TTL 7417s are rarely available from any company except Texas Instruments.
7407, 74LS07 and even 74HC07 (open-drain CMOS equivalent) are a bit easier to find these days.
If the measured current is around 20mA or less then it should be fine but just remember 20mA x 8 circuits = 160mA.
If you make all 8 Arduino outputs low then that 160mA will consume a large portion of total maximum drive the chip can handle. So be careful about what, besides that board, you put on there while it's like that.
If the potential for 160mA concerns you, then again, look at the 7407 because that will dramatically reduce the current demand on the Arduino (roughly 1/60 the current for all 8 circuits).

Last edited by techhelpbb : 01-08-2013 at 01:03.
  #4   Spotlight this post!  
Unread 01-08-2013, 02:37
BornaE's Avatar
BornaE BornaE is offline
Registered User
FRC #0842 (Formerly 39)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Gilbert, Arizona
Posts: 359
BornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant future
Re: Arduino + Ethernet Shield Help

Back to the code, what do you get printed on the serial port when you press the buttons?
__________________
-Borna Emami
Team 0x27
  #5   Spotlight this post!  
Unread 01-08-2013, 11:08
jwallace15's Avatar
jwallace15 jwallace15 is offline
What am I going to do with my life?
AKA: Wally
FRC #0068 (Truck Town Thunder)
Team Role: College Student
 
Join Date: Aug 2012
Rookie Year: 2013
Location: Michigan
Posts: 435
jwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud of
Re: Arduino + Ethernet Shield Help

Quote:
Originally Posted by BornaE View Post
Back to the code, what do you get printed on the serial port when you press the buttons?
Allow me to test (it did say something I just can't remember)

...

Alright testing now.

Accessed the webpage, serial printed...

Code:
 HTTP
favicon.i,,
Pressing "On"

Prints the same. No LED.

Pressing "Off"

Same thing. And no LED.

When I press the buttons, the TX and RX leds blink on both the ethernet shield and the R3, and an LED I connected to pin 13 (it is not in the code though, it's just there to show me if the Arduino LED blinks) gets a little bit brighter when the TX and RX leds blink.
__________________
J Wallace IV
Truck Town Thunder
Just a college student now.

Last edited by jwallace15 : 01-08-2013 at 11:14.
  #6   Spotlight this post!  
Unread 01-08-2013, 11:41
techhelpbb's Avatar
techhelpbb techhelpbb is offline
Registered User
FRC #0011 (MORT - Team 11)
Team Role: Mentor
 
Join Date: Nov 2010
Rookie Year: 1997
Location: New Jersey
Posts: 1,622
techhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond repute
Re: Arduino + Ethernet Shield Help

Quote:
Originally Posted by jwallace15 View Post
When I press the buttons, the TX and RX leds blink on both the ethernet shield and the R3, and an LED I connected to pin 13 (it is not in the code though, it's just there to show me if the Arduino LED blinks) gets a little bit brighter when the TX and RX leds blink.
What are you powering this assembly with?
What voltage and current is the power source rated for?
Are you using the USB port for power?

The potential code issues aside make sure that you are not fooling yourself by powering that assembly with a power source that is not sufficient.
  #7   Spotlight this post!  
Unread 01-08-2013, 11:46
jwallace15's Avatar
jwallace15 jwallace15 is offline
What am I going to do with my life?
AKA: Wally
FRC #0068 (Truck Town Thunder)
Team Role: College Student
 
Join Date: Aug 2012
Rookie Year: 2013
Location: Michigan
Posts: 435
jwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud of
Re: Arduino + Ethernet Shield Help

Quote:
Originally Posted by techhelpbb View Post
What are you powering this assembly with?
What voltage and current is the power source rated for?
Are you using the USB port for power?

The potential code issues aside make sure that you are not fooling yourself by powering that assembly with a power source that is not sufficient.
It is powered over my USB port.

I know that it is sufficient, I recently made a sketch with my MEGA that had 15+ LED's that would scroll in a marquee and the delay could be adjusted from a trim pot (all the way down to a ~10ms delay).

I also ran a servo off of the mega while doing that, and 3 more trim pots that could adjust the colour of an RGB LED.
__________________
J Wallace IV
Truck Town Thunder
Just a college student now.
  #8   Spotlight this post!  
Unread 01-08-2013, 12:14
daniel_dsouza daniel_dsouza is offline
does what needs to be done.
FRC #2449 (Out of Orbit Robotics)
Team Role: Alumni
 
Join Date: May 2011
Rookie Year: 2011
Location: Chandler, AZ
Posts: 231
daniel_dsouza has a spectacular aura aboutdaniel_dsouza has a spectacular aura about
Re: Arduino + Ethernet Shield Help

Can you add some print statements after the conditional logic steps in your code, and tell us what they give you?

I wonder if favicon.i is an icon? I hope not, because that would not make any sense.

It's good to see another person that loves trains.

Last edited by daniel_dsouza : 01-08-2013 at 12:14. Reason: i like trains
  #9   Spotlight this post!  
Unread 01-08-2013, 12:23
jwallace15's Avatar
jwallace15 jwallace15 is offline
What am I going to do with my life?
AKA: Wally
FRC #0068 (Truck Town Thunder)
Team Role: College Student
 
Join Date: Aug 2012
Rookie Year: 2013
Location: Michigan
Posts: 435
jwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud of
Re: Arduino + Ethernet Shield Help

Quote:
Originally Posted by daniel_dsouza View Post
Can you add some print statements after the conditional logic steps in your code, and tell us what they give you?

I wonder if favicon.i is an icon? I hope not, because that would not make any sense.
Do you mean add like an if-then statement, as in if the On button is pressed, serial.print("The Led is on");

and say the led is off if the Off button is pressed?

EDIT: ^ I added that sort of statement and when I press either the on of off buttons nothing is printed.

Quote:
Originally Posted by daniel_dsouza View Post
It's good to see another person that loves trains.


http://www.chiefdelphi.com/forums/at...9&d=1346106255 (as of last year. Much has changed since then. MUCH.)
__________________
J Wallace IV
Truck Town Thunder
Just a college student now.

Last edited by jwallace15 : 01-08-2013 at 12:34.
  #10   Spotlight this post!  
Unread 01-08-2013, 14:31
techhelpbb's Avatar
techhelpbb techhelpbb is offline
Registered User
FRC #0011 (MORT - Team 11)
Team Role: Mentor
 
Join Date: Nov 2010
Rookie Year: 1997
Location: New Jersey
Posts: 1,622
techhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond repute
Re: Arduino + Ethernet Shield Help

I put my Arduino Ethernet Shield R3 onto my Arduino Duo R3.

I cut a network cable in half.
Made an ethernet 'cross-over cable' like so:
Orange/White (one half) - Green/White (the other half)
White/Orange (one half) - White/Green (the other half)
Vice-versa
I used Scotch Tape as an insulator after twisting wires together.
MacGyvering during lunch....check.
Good thing that was a high quality dollar store cable ($1.34).

I put my 'cross-over cable' into my laptop (Dell E6400...yes I have several laptops) ethernet port.
I put the other end into the Arduino Ethernet Shield.

I disabled IPV6 (blah) on my laptop wired ethernet interface.
Set my wired connection in Windows 7 to: 192.168.1.131
Looked at the supplied code and it uses: 192.168.1.130
Set the gateway as: 192.168.1.1
Set the netmask to: 255.255.255.0

Loaded up your stored page in Firefox.
Regardless of what webpage button I press (On/Off) I get "HTTP" out the serial monitor.

When I get a chance I'll check the output pins.

However I do not get this:

Quote:
Originally Posted by jwallace15 View Post
Code:
 HTTP
favicon.i,,
Care to clarify if you are using Internet Exploder....I mean Internet Explorer

I have version 1.05 stable of the Arduino software.

Last edited by techhelpbb : 01-08-2013 at 14:48.
  #11   Spotlight this post!  
Unread 01-08-2013, 14:58
jwallace15's Avatar
jwallace15 jwallace15 is offline
What am I going to do with my life?
AKA: Wally
FRC #0068 (Truck Town Thunder)
Team Role: College Student
 
Join Date: Aug 2012
Rookie Year: 2013
Location: Michigan
Posts: 435
jwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud ofjwallace15 has much to be proud of
Re: Arduino + Ethernet Shield Help

Quote:
Originally Posted by techhelpbb View Post
Care to clarify if you are using Internet Exploder....I mean Internet Explorer
Nope, Chrome. I openly admitted to using IE at robotics last year and recieved a major lashing for such blasphemy. Then I downloaded Chrome.
__________________
J Wallace IV
Truck Town Thunder
Just a college student now.
  #12   Spotlight this post!  
Unread 01-08-2013, 15:42
techhelpbb's Avatar
techhelpbb techhelpbb is offline
Registered User
FRC #0011 (MORT - Team 11)
Team Role: Mentor
 
Join Date: Nov 2010
Rookie Year: 1997
Location: New Jersey
Posts: 1,622
techhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond repute
Re: Arduino + Ethernet Shield Help

I only get the 'favicon.i' if the serial monitor is open when the board first connects. Other than that just "HTTP" out of the serial monitor.

It did not appear on my DMM that either pin 7 or 8 was toggling with the webpage button presses (not sure if it's one or zero oriented).

Will look into it more later.

What I suspect is wrong here is that:

1. If you look there is only one call to serial to output from this code.
2. What you should see is what is in the buffer.
3. When you alter the form it fires a POST event.
4. That should cause the page to reload (with the same content).
5. During that post event parameters follow.
6. We both only see "HTTP".
7. However this is a POST so look at this link:
http://www.jmarshall.com/easy/http/#postmethod
(Link altered to something more related and friendly)
8. Therefore when the code reloads and tries to parse these parameters...it can not find what is not in the buffer.
9. Therefore the page simply reloads but does not change the pins (it thinks it's the first time you loaded it).
10. This *might* have worked for someone at some point but this is likely time sensitive.
11. The browser is doing all the work to display the HTML form.
12. When the browser toggles something it's just a silly drawing to the browser.
13. Even if this was a slider (it's a button) it would likely slide as you might expect.
14. Even if the browser does not successfully communicate the change it will tend to draw the changes.
15. HTTP is stateless so unless you put something more intelligent like Javascript in there you can't ask the browser after the fact what happened without another HTML form submission.
16. If your HTML forms never send valid data you are trapped in a vicious loop where things *appear* to be happening.

This is a typical problem for web applications of any sort.
Often form submissions recall the same code and that code needs to get parameters (either GET or POST).
If that code does not get parameters HTTP is stateless so it thinks you were *never there before*.

So since I am not the student here
Put a serial print statement *inside* the conditional that toggles the pin.
See if it ever prints.
You sort of did this already above just put *only* the print statement not any additional conditionals.

Then we can go from there.

BTW when was this book you have written? Look at the copyright date.
It's this book right: http://shop.oreilly.com/product/9780596802486.do

Whistles innocently:
https://bugzilla.mozilla.org/show_bug.cgi?id=260500

Last edited by techhelpbb : 02-08-2013 at 00:54.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 17:56.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi