|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Arduino + Ethernet Shield Help
Well you need to look at what the arduino can source power at, and look at what you are trying to control on the train set to see if they are compatible, both volts and amp wise. Typically, to do anything but drive a led, or ttl level components, which I doubt the train set is, you will need to develop either isolation relay or triac interface between the arduino and the real world devices on the train. On the input side, again you are working with 0-5v analog on the arduino, so you may need some voltage division resistor network to get the voltage down to a range you can read.
We have our breakaway bot running on an arduino, and if you look at the picture, on the left you will see an eight relay interface board that we use to control the solenoids at 24vdc and the compressor at 12vdc. http://www.mcbride4.org/wp-content/u...-55-33_765.jpg Also some trains run on ac, so you may have an issue there too. |
|
#2
|
|||||
|
|||||
|
Re: Arduino + Ethernet Shield Help
I have this relay board that I was planning on using to turn things on and off. There are miscellaneous things all over my layout that I'm going to turn on and off with the relay board (blue thing).
I understand how everything will work electrically, I'm worried about the programming. |
|
#3
|
||||
|
||||
|
Re: Arduino + Ethernet Shield Help
Quote:
You do not want to put an inductive load on your Arduino pins directly. Use the pins to drive a transistor or suitable IC to drive those relay coils. The picture does not show any drivers but they might be on the other side of the PCB. |
|
#4
|
|||||
|
|||||
|
Re: Arduino + Ethernet Shield Help
The relay board has a VCC and GND pin. The Arduino outputs drive transistors on the board that power the relays.
|
|
#5
|
||||
|
||||
|
Re: Arduino + Ethernet Shield Help
Ok, I was just trying to see if you can control something with a basic sketch, to confirm it was working and wired, then add the ethernet control to the system.
I don't have the ethernet shield to play with, so I won't be of much help. Googling around, there appears to be a significant rewrite to the ethernet library, from the .002x to the 1.0.x versions, so it may be that code in the book, is worked with the pre 1.0 release of the IDE. That being said, I did a search online, for some example code that was written post 1.0 and found the following examples. http://bildr.org/2011/06/arduino-ethernet-pin-control// and http://startingelectronics.com/tutor...r-LED-control/ both look to be good examples of what you are trying to accomplish. Last edited by tr6scott : 29-07-2013 at 18:00. Reason: cut and pasted the same url twice, doh! |
|
#6
|
||||
|
||||
|
Re: Arduino + Ethernet Shield Help
One simple option for testing...
Download and install the RobotOpen Driver Station App... www.robotopen.biz Then download the RobotOpen Library from the same area. There are many example programs. This code base will let you talk to the Arduino via wifi and control the outputs from a game pad. It's a good place to start without actually understanding the underlying code. |
|
#7
|
||||
|
||||
|
Re: Arduino + Ethernet Shield Help
Quote:
Just curious. http://www.dhgate.com/product/new-5v...114459520.html |
|
#8
|
|||||
|
|||||
|
Re: Arduino + Ethernet Shield Help
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!
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 Last edited by jwallace15 : 31-07-2013 at 16:26. |
|
#9
|
|||||
|
|||||
|
Re: Arduino + Ethernet Shield Help
Quote:
(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? )Last edited by jwallace15 : 31-07-2013 at 22:09. |
|
#10
|
||||
|
||||
|
Re: Arduino + Ethernet Shield Help
Quote:
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 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. |
|
#11
|
||||
|
||||
|
Re: Arduino + Ethernet Shield Help
Back to the code, what do you get printed on the serial port when you press the buttons?
|
|
#12
|
|||||
|
|||||
|
Re: Arduino + Ethernet Shield Help
Quote:
... Alright testing now. Accessed the webpage, serial printed... Code:
HTTP favicon.i,, 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. Last edited by jwallace15 : 01-08-2013 at 11:14. |
|
#13
|
||||
|
||||
|
Re: Arduino + Ethernet Shield Help
Quote:
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. |
|
#14
|
|||||
|
|||||
|
Re: Arduino + Ethernet Shield Help
Quote:
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. |
|
#15
|
|||
|
|||
|
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 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|