Show Posts
Pages: 1 ... 22 23 [24] 25 26 ... 35
346  Using Arduino / Networking, Protocols, and Devices / Re: Switch Slave Select pin with Ethernet shield on: August 12, 2012, 09:44:02 pm
Did you set the default SS pin (digital pin 10) to OUTPUT and HIGH? Even tho you are using digital pin 8 for the w5100 SS, you must set the default SS to OUTPUT, or the SPI will not be in master mode. Normally, Ethernet.begin() does that, but it will now set digital pin 8 instead.

Yes, I tried that, it didn't help.
347  Using Arduino / Networking, Protocols, and Devices / Re: Switch Slave Select pin with Ethernet shield on: August 12, 2012, 07:12:17 pm
Maybe you might try connecting the SS signal to pin 5 of the SPI header.

Looking at the Ethernet shield schematic pin 5 on the SPI header is reset.  There is no SS pin on the header, it's connected to Digital pin 10 (ie pin 3 on J1 header).
348  Using Arduino / Networking, Protocols, and Devices / Re: Switch Slave Select pin with Ethernet shield on: August 12, 2012, 07:02:08 pm
Did you connect all the other data pins?  Power?  Ground?  Check the Ethernet Shield schematics to see which Arduino pins it connects to.

I didn't connect the other data pins, I did have power and ground connected.  As I said, this setup worked when pin 10 on the Arduino was connected to pin 10 on the Ethernet shield.  So I see no reason to hook up other pins. All I did was change 5100.h and recompiled and uploaded to the Arduino.  Physically, I moved the wire from pin 10 to pin 8 on the Arduino.
349  Using Arduino / Networking, Protocols, and Devices / Switch Slave Select pin with Ethernet shield on: August 12, 2012, 01:12:06 pm
I am trying to see if I can use a slave select pin other then pin 10 to control an Ethernet Shield (R3).  My end goal is to take an Ethernet shield and connect it to a panStamp (this is like an Arduino Pro Mini 3.3v Atmega328 with RF chip).  The panStamp uses SPI to communicate with the RF chip and it's hard wired to use pin 10 for SS. 

As a test just to see if I could get an Ethernet shield to work using a different SS pin, I took a Duemilanove and connected it to a Arduino Ethernet shield R3.  I didn't plug the shield into the headers, I just used wires to connect the two.  I had pin 10 on each connected, then pins 11-13 on the Duemilanove wired to the SPI connector on the shield. Plus 5v and Gnd.  This setup worked fine and I could use the Ethernet shield to upload to cosm.com.

I did some research on changing the SPI pin and found this forum post which was pretty informative.  Basically he says to change modify 5100.h file.  So I changed
Code:
inline static void initSS()    { DDRB  |=  _BV(2); }; 
inline static void setSS()     { PORTB &= ~_BV(2); };
inline static void resetSS()   { PORTB |=  _BV(2); };
to
Code:
inline static void initSS()    { DDRB  |=  _BV(0); }; 
inline static void setSS()     { PORTB &= ~_BV(0); };
inline static void resetSS()   { PORTB |=  _BV(0); };

This should change to SPI from pin 10 to pin 8.

For my test I connected pin 8 on the Duemilanove to pin 10 on the Ethernet shield.  But I couldn't get the Ethernet shield to work with this setup.  I also tried to set pin 8 low in my sketch with digitalWrite() before I made an Ethernet call, but that didn't help.  Is it even possible to use a pin other then 10?  If so, are their certain pins that will work and others that won't?  I'd appreciate any suggestions in getting this to work.

 
350  Using Arduino / Networking, Protocols, and Devices / Re: Low Cost RF Transmitter and Receiver setup on: August 12, 2012, 12:46:48 pm
I just got some panStamps which are pretty neat.  They have  a RF chip and Arduino Pro Mini together on one small PCB. 
http://www.panstamp.com/home
351  Using Arduino / Networking, Protocols, and Devices / Re: Leonardo + Ethernet R3 - need ICSP connector? on: August 12, 2012, 10:53:51 am
No. Digital pins 11-13 are not used on the Leonardo.
Digital pins 11-13 are not used on the ethernet shield.
All ICSP.


So this means when using Leonardo with Ethernet shield R3, I can use digital pins 10-13 for anything I want in my sketch. 
352  Using Arduino / Interfacing w/ Software on the Computer / Re: Posting to Weatherunderground (wunderground) via PHP on: August 11, 2012, 08:26:24 am
Dan,

I'm interested in sending data to Weather Underground.  Did you ever get your code to work?
353  Using Arduino / Project Guidance / 5V digital input on Pro Mini 3.3 volts on: August 09, 2012, 03:54:07 pm
Can I use 5 volts on the digital input pins of the Arduino Pro Mini 3.3 volts ATMega 328.  I'd be powering the mini with 3.3 volts, but I'd like to connect one of the digital input pins to 5 volts.  I'm asking because I want to connect a Pro Mini to an Ethernet shield.  I'm hoping the 3.3 volts coming from the pro mini is high enough for the Ethernet shield to see that as high.  If so, then I only have to worry about the MISO pin (12), which would be 5 volts coming from the shield going to the mini.  If the mini can handle a 5v input, I shouldn't need to do anything.  If not, I could put a voltage divider on that line or a level shifter.
354  Using Arduino / Networking, Protocols, and Devices / Re: Sudden unreliability with my network-enabled Arduino project on: August 07, 2012, 08:12:14 pm
Wow, you've done a lot of debugging so far.  You mentioned humidity as a potential problem. This is probably a long shot, but maybe the wood is absorbing moisture and causing a problem.  Do you have plastic stand-offs you could use to keep the circuit board from touching anything.  Another thing you might try is heat things up with a blow dryer - not too hot though - and see if things start failing.  You could also plug it into a UPS to make sure you have nice clean power.
Any chance the problem is with the garage door and not your circuit?
355  Using Arduino / Networking, Protocols, and Devices / Ethernet Shield + Pro Mini 3.3 v on: August 07, 2012, 07:55:28 pm
I want to take an Ethernet shield R3, and plug a proto shield on the top. The proto shield will have a Arduino Mini Pro 3.3v Atmel 328.  I know I need a 5v and 3.3 v power supply.  I think all I need to do is connect the D10-D13 pins to the Ethernet shield.  But normally these pins would all operate on 5v, but in this setup, I've got 5v and 3.3 volts.  So how should I deal with this?  Any other pitfalls I should be aware of?

The reason I'm doing this is the Pro Mini is actually a panStamp - it's a Pro Mini with an RF transceiver built in. 
356  Using Arduino / Networking, Protocols, and Devices / Re: Leonardo communicate with Pro Mini 3.3v on: August 05, 2012, 08:11:22 am
Thanks I'll try that.
357  Using Arduino / Networking, Protocols, and Devices / Leonardo communicate with Pro Mini 3.3v on: August 04, 2012, 08:51:05 pm
I want to get a Leonardo communicating with an Arduino Pro Mini 3.3v ATmega 328.  The two devices are only a couple inches apart.  I am leaning toward using I2C to do this.  What's the best way to deal with the different voltage levels between the two boards?
358  Using Arduino / Programming Questions / Re: Strange pushbutton behavior on: August 04, 2012, 09:32:36 am
Code:
    if(WaterFillTimer <= millis())  // need to check for pressure here becuse if valve is already open, pressure will be low
The comment has NOTHING to do with the code.
My original code had an input from a  pressure switch, when I took that out to do this test, I forgot to remove the comment.

Quote
Code:
      WaterFillTimer += WATER_FILL_BP_MIN;          // Timer is already on, add more minutes, but only if valve is already open
Adding unsigned longs is not a good idea. WaterFillTime might be a good name. WaterFillTimer is not.
WaterFillTime is a better name.  What's wrong with adding unsigned longs?

Quote
Code:
  if(((long)(millis() - WaterFillTimer) <= 0))
Why are you casting an unsigned value to a signed value? The result of the computation will be unsigned, and therefore not at all what you expect, before the cast takes place. The result will NEVER be negative.
I'm pretty new at this, and certainly no expert in casting.  But the above code works.  If I add Serial.println((long)(millis() - WaterFillTimer)) to see what's going on, it prints out negative numbers.  The output turns on for the specified amount of time in WaterFillTimer then turns off.

359  Using Arduino / Programming Questions / Re: Strange pushbutton behavior on: August 04, 2012, 08:38:47 am
I put my own 150mS delay (debounceTimer) in and it works well now.

Code:
#include <Button.h>     // For pushbutton http://github.com/carlynorama/Arduino-Library-Button
#define WATER_FILL_BP_MIN    242000   // minutes added to water fill timer
#define WATER_FILL_PB    8            // Push-button for water fill
#define WATER_OUTPUT     7            // Adds water to pool
uint32_t WaterFillTimer;  // Timer to turn on water fill valve, adds 15 minutes every time pushbutton is pressed
Button btnWaterFill = Button(WATER_FILL_PB, LOW);  // Setup pushbutton for water fill

void setup()
{
  Serial.begin(9600); 
  pinMode(WATER_OUTPUT, OUTPUT);
  digitalWrite(WATER_OUTPUT, LOW);
  delay(100);
}

void loop()
{
  static uint32_t debounceTimer;
 
  // Check for water fill pushbutton, if detected and there is pressure in the line, add 15 minutes to timer
  btnWaterFill.listen();
  if ( btnWaterFill.onPress() && millis() > debounceTimer )
  {
    debounceTimer = millis() + 150;
    // Add time to water fill timer
    if(WaterFillTimer <= millis())  // need to check for pressure here becuse if valve is already open, pressure will be low
    {
      WaterFillTimer = millis() + WATER_FILL_BP_MIN;  // First time button is pushed
      Serial.println("Initial timer");
    }   
    else if(digitalRead(WATER_OUTPUT) == HIGH)
    {
      WaterFillTimer += WATER_FILL_BP_MIN;          // Timer is already on, add more minutes, but only if valve is already open
      Serial.println("Add more time");   
    }             
  } 

  if (digitalRead(WATER_OUTPUT) ==  HIGH)
  {
    Serial.print("water fill countdown:  ");
    Serial.println(((WaterFillTimer - millis()) / 60000.0));
    delay(100);
  }

  // Turn on water fill valve
  if(((long)(millis() - WaterFillTimer) <= 0))
  {
    digitalWrite(WATER_OUTPUT, HIGH);
  }
  else
  { // Turn Pump off
    digitalWrite(WATER_OUTPUT, LOW);
  } 
}
360  Using Arduino / Programming Questions / Re: Strange pushbutton behavior on: August 04, 2012, 08:16:50 am
Use btnWaterFill.getDebounceDelay() to find out what your current de-bounce delay is set to, and then use btnWaterFill.setDebounceDelay(<some value>) to increase it.

getDebounceDelay shows it's set at 30 (I assume this is milliseconds).  I tried increasing it in steps all the way to 200, but that didn't solve the problem. For fun I lowered it to 10 and 20, but that didn't help.  I even tried to set it for 1000 - most of the time it missed the button press altogether, but sometimes I'd get a triple bounce.  

Something seems wrong, if I have the delay set to 100 and press the button quickly, there I shouldn't get two button presses.  It seems I'm either using this library incorrectly, or the button.h library needs something fixed.

I think I'll just use millis() and a timer to do a little additional debouncing.
Pages: 1 ... 22 23 [24] 25 26 ... 35