Show Posts
Pages: [1]
1  Using Arduino / Project Guidance / Re: Connecting a 3.3v arduino mini pro to a Raspberry Pi on: October 02, 2012, 12:28:37 am
So what would the recommended way to communicate multiple Arduinos with one Raspberry Pi?
2  Using Arduino / Project Guidance / Re: Connecting a 3.3v arduino mini pro to a Raspberry Pi on: September 25, 2012, 10:17:31 am
Also I am using the 3.3v from the pi to power the Arduino.  I also tried only connecting the two i2c lines by themselves and using the usb to serial to power the arduino with the same results.
3  Using Arduino / Project Guidance / Re: Connecting a 3.3v arduino mini pro to a Raspberry Pi on: September 25, 2012, 10:12:57 am
I hooked up my 3.3 Arduino Pro mini directly to the Raspberry pi, SDA to SDA, SCL to SCL, GND to GND and 3.3v to 3.3v.  The arduino powers up and looks to be functional however when I run "i2cdetect -y -a 0", it does not show a connected i2c device.  I'm sure my i2c is working on the RPi because I hooked a separate i2c device and the i2cdetect command finds it no problem.  Do I need specific code to run on the arduino in order for it to respond to the i2cdetect command? 

I've done a lot of google searching and all I can find is examples of Raspberry Pi connected via shifter/bridge to a 5v Arduino.  I would be shocked if I was the only one that has ever tried connecting it to a 3.3v Arduino when it should be much simpler.
4  Using Arduino / Project Guidance / Connecting a 3.3v arduino mini pro to a Raspberry Pi on: September 23, 2012, 11:36:33 am
Is it possible to connect a 3.3v Arduino Mini Pro straight to a Raspberry Pi using the i2c pins?  I've done a bunch of searching but everyone talks about connecting to a 5v Arduino with a shifter/bridge between the two.  If it is possible then do you connect the SDA to SDA, SCL to SCL, GND to GND and 3.3v to 3.3v?  Only power the Raspberry Pi?
Thank you for any advice and/or guidance.
5  Using Arduino / Project Guidance / Re: Weather Station on: August 02, 2011, 05:43:28 pm
I think the switch is magnetically driven.  Tiny circuit board with a resistor and another resistor shaped shiny glass thing right beside it that the magnet passes by during the "tip".  I think the switch is normally open then when it tips it closes and is then open again.  I will try measuring the time it is closed during the tip.
6  Using Arduino / Project Guidance / Re: Weather Station on: August 01, 2011, 10:23:40 pm
Race condition ???

Per Wikipedia "A race condition or race hazard is a flaw in an electronic system or process whereby the output and/or result of the process is unexpectedly and critically dependent on the sequence or timing of other events. The term originates with the idea of two signals racing each other to influence the output first.
Race conditions can occur in electronics systems, especially logic circuits, and in computer software, especially multithreaded or distributed programs."

But thats all I got.  No clue how to fix it. I thought I was good to go with this. doh!
7  Using Arduino / Project Guidance / Re: Weather Station on: August 01, 2011, 07:55:59 pm
So I found a pretty good example of using an interrupt here http://www.dave-auld.net/index.php?option=com_content&view=article&id=107:arduino-interrupts&catid=53:arduino-input-output-basics&Itemid=107

I changed it a bit to suite my rain gauge by replacing the switch with the actually rain gauge trip switch.  The code I modified a bit just to better display the tip counts.

Code:
int pbIn = 0;                  // Interrupt 0 is on DIGITAL PIN 2!
int ledOut = 4;                // The output LED pin
volatile int state = LOW;      // The input state toggle
int tipped = 0;
int tipcount =0;
void setup()
{               
// Set up the digital pin 2 to an Interrupt and Pin 4 to an Output
pinMode(ledOut, OUTPUT);
 
//Attach the interrupt to the input pin and monitor for ANY Change
attachInterrupt(pbIn, stateChange, CHANGE);
Serial.begin(9600);
}
 
void loop()                   
{
//Simulate a long running process or complex task
for (int i = 0; i < 100; i++)
{
// do nothing but waste some time
delay(10);
}
if (tipped == 1)
{
  Serial.println("tipped");
  tipcount++;
  Serial.println(tipcount,DEC);
  tipped = 0;
}

}
 
void stateChange()
{
state = !state;
digitalWrite(ledOut, state);
tipped = 1;
}

Serial Monitor displays as follows ...

Code:
tipped
1
tipped
2
tipped
3
tipped
4
tipped
5
tipped
6
tipped
7

Now all I need  to do is add this sketch to my temperature sketch which should be pretty easy.  Thanks everyone for your advise and guidance. 

Next step is to find a good inexpensive anemometer to measure wind speed and direction. Anybody know a good source?
8  Using Arduino / Project Guidance / Re: Weather Station on: July 31, 2011, 02:31:37 pm
umm ... WOW.  Thanks everyone.  Now just to figure out exactly how to implement an interrupt.  I have a general idea, but its going to take some serious trial and error experimenting.
9  Using Arduino / Project Guidance / Weather Station on: July 31, 2011, 10:50:24 am
Hoping someone can advise.  I working on an arduino based weather station.  So far I only have temperature sensing and now working on a rain gauge.  I purchased a Rainwise tipping bucket rain gauge.  My problem is that the tipping bucket trigger is a very quick on/off each time the bucket tips my arduino sketch can very easily miss a tip count while off reading the temperature sensor.  Would using an interrupt be the best way to go about solving this issue?  Any advise is greatly appreciated.
10  Using Arduino / Project Guidance / Re: Help with PCF8574 port expander and relay on: May 16, 2011, 10:16:37 am
I was able to get the example circuit below to work off the arduino pin but not a pin off the PCF8574.



I'm able to blink an LED from a pin off the the PCF8574 by connecting it like this ...

+5 ------- (+)LED(-) ------330 ohm Resistor-------- PCF8574 P0 pin 4

Using the following code ...

Code:
#include <Wire.h>

#define expander 0x20 //expander address with 3 address pins grounded

void setup() {
  Wire.begin();
}

void loop() {
  expanderWrite(B11111111); //turn all ports high
  delay(1000);
  expanderWrite(B00000000); //turn all ports low
  delay(1000);
}


void expanderWrite(byte _data ) {
  Wire.beginTransmission(expander);
  Wire.send(_data);
  Wire.endTransmission();
}
 

I think I understand why its working this way, but please someone correct me if I'm wrong.  When the arduino turns an i/o port high it is sourced to positive and when the PCF8574 turns the i/o port high it sinks it to ground.  (hope my terminology is correct as well). 
If my thinking is correct then what do I need to change in order to get the relay circuit above to work with the PCF8574?
11  Using Arduino / Project Guidance / Re: Help with PCF8574 port expander and relay on: April 17, 2011, 04:05:02 pm
Kind of tried that circuit, but probably did something wrong and didn't have the exact components.  Couple guestion I have is what is all the stuff to the right of the diode, and will this work with these parts with the PCF8574?  Or would it need to be modified?  If it will work I'll order the exact parts right now.
12  Using Arduino / Project Guidance / Help with PCF8574 port expander and relay on: April 17, 2011, 10:11:25 am
Can anyone point me to an example of a PCF8574 port expander circuit that controls a number of relays with a coil of 5 volts.  I can get the arduino to control an led without a problem but not a relay.  I'm sure it is because the PCF8574 doesnt have enough juice to activate the coil.
Any help or advise would be greatly appreciated.
13  Using Arduino / Displays / Re: lcdi2c keypad problems on: March 15, 2011, 10:43:25 am
Thanks for the reply.  The idea behind the delay is to give the user time to input the entire 4 digit passcode before it automaticlly exits the routine and goes back to the main loop.  Also, I haven't yet put into the function is that if 4 keys are pressed then it will automaticlly return to the main loop.  I will continue to work on it, I have made a little more progress since my orginal post.  Thanks again.
14  Using Arduino / Displays / lcdi2c keypad problems on: March 13, 2011, 10:28:00 pm
I have an lcd from web4robot.com with a 4x3 keypad hooked up to it.  The lcd and keyboard are working, the only issue I'm having is getting the timing right on the key pushes.  The way I have written my code it seems I have to push the buttons just right in order to get a single character.  Basically what I'm trying to do is enter a passcode of x amount of characters in a given amount of time.  I pretty much have it working the only issue is the timing.  Maybe my method is all wrong and someone can correct me or point me in the right direction. The code below watches for a key to be pressed, then branches off to a function that will wait roughly 7 seconds for another key to be pressed before returning to the main loop.

Code:
// keypad code

#include <Wire.h>
#include <LCDI2C.h>

LCDI2C lcd = LCDI2C(2,16,0x4C,1);             // Number of lines and i2c address of the display

void setup() {

  lcd.init();                          // Init the display, clears the display
  lcd.setCursor(0,0);                      // Place the cursor on the 2nd line
  lcd.print("Keypad = ");
  Serial.begin(9600);
}


void loop()
{
 int keyInput;
  keyInput=lcd.keypad();
  delay(10);
  lcd.setCursor(0,10);
  lcd.print("   ");      // Clear prev entry
  lcd.setCursor(0,10);
  lcd.print(keyInput,DEC);// Print the value we got back from the keypad

  if (keyInput > 0)
    {
      int result = getPassCode(keyInput);
    }

}



int getPassCode(int keyInput)
{
  int charCount = 0;
  int inputtime = 0;
  Serial.print("start input");

  while (inputtime < 7)
  {
    if(keyInput != 0)
    {
      Serial.print("\n");
      Serial.print(keyInput);
      Serial.print("\n");      
      inputtime =0;
    }
    keyInput = lcd.keypad();
    delay(1000);
    Serial.print(inputtime);
    inputtime++;
  }

  Serial.print("\n");
  Serial.print("end input");
  lcd.setCursor(1,8);
  lcd.print("done");
}
Pages: [1]