Show Posts
Pages: [1] 2 3 ... 5
1  Using Arduino / Project Guidance / Re: Arduino BLE pairing on iPhone on: January 09, 2014, 07:27:14 pm

hunh? I am not sure what your getting at here.
2  Using Arduino / Project Guidance / Re: Arduino BLE pairing on iPhone on: January 09, 2014, 07:03:17 pm
And cross posting is just not on!.

Mark

care to elaborate what you mean by this?
3  Community / Products and Services / Re: Are there any products that include Bluetooth? on: January 09, 2014, 04:04:38 pm
The Arduino BT has bluetooth onboard: http://arduino.cc/en/Main/ArduinoBoardBT?from=Main.ArduinoBoardBluetooth
But I'm not sure if it is still being made?

yeah I am pretty sure that board got discontinued a while back :/ ...don't ask me why though.

I recently picked up one of these, still trying to figure out the whole BLE programming thing though.
4  Using Arduino / Project Guidance / Re: Arduino BLE pairing on iPhone on: January 09, 2014, 03:41:38 pm
abhilash0001

I would check to see if you can at least "discover" your Bluetooth module using the iPhone app LightBlue and see if you can see your shield / module in peripheral mode.  You also might want to make sure you have both the module and the shield set in peripheral mode.  From reading the product website for the shield you posted, it states that the shield operates in peripheral mode, but does not say anything about working in central mode.  So for whatever reason, if your module happens to be configured as a central, I don't think your iPhone will discover the BLE device / module.
5  Using Arduino / Project Guidance / Re: Using arduino for BT module configuration on: January 09, 2014, 03:25:21 pm
Not sure if you have already purchased your hardware, but what your describing looks like you would want something similar to this.  I personally have one, and it allows the board to be switched into AT mode so you can send it it AT commands via a serial monitor.  I have successfully sent several commands to the board using the Arduino IDE serial monitor.
6  Using Arduino / Programming Questions / BLE microcontroller programming on: January 09, 2014, 03:12:58 pm
Hello, I recently purchased a Bluno micro controller which has BLE4.0 built in to it.  The micro controller can be used as a peripheral or a central, and am wondering should I set it up as the central or the peripheral.  Basically I have a simple Arduino sketch, and it interacts with an iOS device.  The iOS device sends commands to the Arduino board, and the board responds with an "action" based upon the command it receives.  The commands are simple ASCII strings.

Things are working great when I have everything wired up, but I want to convert the sketch to use the BLE 4.0 hardware, so I have been reading up on BLE.  I am currently thinking that I need to setup the micro controller as the central, and have the iOS device send the ASCII string as a "characteristic" of a "service".  Would it be possible for the iOS device acting a peripheral to receive data from the micro controller as a central or is that not how BLE operates?

Basically I am used to wiring things up and being able to send data back and forth in both directions but it appears BLE is a little different kind of animal :/
7  Using Arduino / Programming Questions / Re: How to count the pulse / pulses from a swiss flow sf800 flow meter / sensor? on: August 05, 2013, 12:12:04 pm
Yeah, I figured out one of problems.  I had faulty wiring (-.-)
8  Using Arduino / Programming Questions / Re: How to count the pulse / pulses from a swiss flow sf800 flow meter / sensor? on: July 29, 2013, 10:55:04 am
So I did a little more digging, and I found some sample code on the Arduino playground, http://playground.arduino.cc/Main/ReadingRPM and hacked out the following function.  Now my problem is that I am getting output from the function in the console of the iPhone, but not in the serial monitor of the Arduino IDE :-/

Code:
// flowmeter shit
void getFlow4() {
//  Serial.println("im here");
//  Serial.println(sensorPin);

  sensorPinState = digitalRead(sensorPin);
 
//  Serial.println(sensorPinState);
 
  if (millis() - lastmillis >= 1000){ //Uptade every one second, this will be equal to reading frecuency (Hz).
    detachInterrupt(0);//Disable interrupt when calculating
    rpm = rpmcount * 60; // Convert frecuency to RPM, note: this works for one interruption per full rotation. For two interrups per full rotation use rpmcount * 30.
    Serial.print("RPM =\t"); //print the word "RPM" and tab.
    Serial.print(rpm); // print the rpm value.
    Serial.print("\t Hz=\t"); //print the word "Hz".
    Serial.println(rpmcount); //print revolutions per second or Hz. And print new line or enter.

    rpmcount = 0; // Restart the RPM counter
    lastmillis = millis(); // Uptade lasmillis
    attachInterrupt(0, rpm_fan, RISING); //enable interrupt
  }
 
 
  if(sensorPinState == LOW) {
    flow_A_off();
    Serial.println("don't blink");
  }
  if(sensorPinState == HIGH) {
    flow_A_on();
    Serial.println("blink damnit");
  }
   
  if(stringComplete) {
    if(inputString.equals("{close_valve}\n")) {
      //      Serial.println("close vavle.");
      close_valve();
    }
    return;
  }
}

void rpm_fan(){
  rpmcount++;
}

The entire sketch can be found here, http://pastie.org/8187081
9  Using Arduino / Programming Questions / Re: How to count the pulse / pulses from a swiss flow sf800 flow meter / sensor? on: July 25, 2013, 12:55:22 am
Code:
  sei(); // enable interrupts
  delay(1000); // wait 1 second
  cli(); // disable interrupts
Absolute rubbish. This is NOT even close to the way to count interrupts for one second.

I am using that method for counting interrupts because I found a code example here, http://forum.arduino.cc/index.php?topic=8548.0;wap2
10  Using Arduino / Programming Questions / Re: How to count the pulse / pulses from a swiss flow sf800 flow meter / sensor? on: July 23, 2013, 06:54:59 pm
So I tried the following sketch example with the following "getFlow4" function, but I am still not getting any values for output.  It's just printing "0L/hour" repeatedly.  Any suggestions?

Code:
byte sensorInterrupt = 0;
byte sensorPin = 2;

// getFlow4 variables
volatile int NbTopsFan; // measuring the rising edges of the signal
int Calc;

void setup() {

// initialize serial
  Serial.flush(); // flush the serial buffer on setup.
  Serial.begin(115200); // open serial port, sets data rate to 9600bps
  Serial.println("Power on test");

// flowmeter shit
pinMode(sensorPin, INPUT);
digitalWrite(sensorPin, HIGH); // Need to set these HIGH so they won't just tick away

attachInterrupt(0, rpmCount, RISING);
}

void getFlow4() {
  NbTopsFan = 0; // SetNbTops to 0 ready for calculations
  sei(); // enable interrupts
  delay(1000); // wait 1 second
  cli(); // disable interrupts
  Calc = (NbTopsFan * 60 / 7.5); // pulse frequency x 60) / 7.5Q = flow rate in L/hour
 
  Serial.print(Calc,DEC); // Prints the number calculated above
  Serial.print("L/hour\r\n"); // prints "L/hour" and returns a new line
}

void rpmCount() {
  NbTopsFan++; // this function measures the rising and falling edge of the hall effect sensor signal
}

void loop() {
  if(stringComplete) {
    //    Serial.println(inputString);

    if(inputString.equals("{open_valve}\n")) {
//      Serial.println("inputString equates :)");
      open_valve();

    }

    if(inputString.equals("{close_valve}\n")) {
      //      Serial.println("close vavle.");
      close_valve();
    }

    // clear the string:
    inputString = "";
    stringComplete = false;
  }

  if(valve_open == true) {
    //Serial.println("valve_open = true");
    getFlow4();
    // close the valve after a certain RPM value is met
    //    if(rpmcountsum = 800) {
    //    close_valve();
    //    }
  }
}

/*
 SerialEvent occurs whenever a new data comes in the
 hardware serial RX.  This routine is run between each
 time loop() runs, so using delay inside loop can delay
 response.  Multiple bytes of data may be available.
 */

void serialEvent() {
  while(Serial.available()) {
    // get the new byte:
    char inChar = (char)Serial.read();
    // add it to the inputString:
    inputString += inChar;
    // if the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n') {
      stringComplete = true;
    }
    // Serial.println(inputString.length());
  }
}



11  Using Arduino / Project Guidance / Re: Electronic valve on beer tap on: July 22, 2013, 03:10:55 pm
You might want to look at the kegbot.org project.  There's a forum post with all the parts used to build a kegbot.  https://kegbot.org/kegbb/index.php?p=/discussion/comment/762  In short I'm using the McMaster Carr solenoid cut off valve.  You can see me controlling it with an iPhone and an Arduino,
12  Using Arduino / Programming Questions / Re: How to count the pulse / pulses from a swiss flow sf800 flow meter / sensor? on: July 20, 2013, 01:29:52 pm
So I thought the following sketch would surely work, but it doesn't.  I am not receiving any values concerning the RPM's or Hz :/

http://pastie.org/8159173
13  Using Arduino / Programming Questions / Re: How to count the pulse / pulses from a swiss flow sf800 flow meter / sensor? on: July 20, 2013, 01:05:44 pm
Hi,

You can learn how to count pulses from this code.

http://elimelecsarduinoprojects.blogspot.com/2013/06/measure-rpms-arduino.html

Thank you very much for the code example and the link, I was able to incorporate the code into my project, and compile it to the Arduino, but it's not printing the flow valves, i.e. rpms and what not.  I think I know what the problem is, but as it stands, my current sketch looks like the following, http://pastie.org/8159110

Also I think it makes a difference because I am using the kegboard-mini shield, https://github.com/Kegbot/kegboard/tree/master/hw/kegboard-mini
14  Using Arduino / Programming Questions / How to count the pulse / pulses from a swiss flow sf800 flow meter / sensor? on: July 19, 2013, 01:08:03 pm
I'm trying to figure out how I can count the pulses of a swiss flow 800 flow meter.  I came across this last night, and incorporated the code into the project that I am working on, but I didn't see any values printed out to the console.

The sketch I'm working with looks like the following, http://pastie.org/8156329  I could open the valve, but when liquid started going through the flowmeter no values were being printed out via the console.  Also I couldn't close the valve once it was opened, so I commented out the "getFlow" function, and I was able to open / close the valve the way I should be, so for whatever reason the program execution is getting stuck in the "getFlow" function.  Any help / code suggestions would be great.
15  Using Arduino / Programming Questions / Re: how to measure flow volume using swiss flow 800 meter and kegbot.org shield on: July 07, 2013, 12:45:50 pm
here is the sketch that I am currently working with,

Code:
/*
 * kegboard-clone-4-KegCop
 * This code is public domain
 *
 * This sketch sends a receives a multibyte String from the iPhone
 * and performs functions on it.
 *
 * This Arduino sketch is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Public License
 * along with this sketch.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Examples:
 * http://arduino.cc/en/Tutorial/SerialEvent
 * http://arduino.cc/en/Serial/read
 * http://stackoverflow.com/questions/16532586/arduino-sketch-that-responds-to-certain-commands-how-is-it-done/
 * http://davebmiller.wordpress.com/2011/01/18/arduino-flowmeter/
 * http://forum.arduino.cc/index.php?topic=52003.0
 *
 *
 * TODO:
 * - spend more time understanding keboard source code
 * - eventually get code working with the SF800 flow sensor / flowmeter
 *
 */
 
 
 // global variables should be identified with _
 
 // flow_A LED
 int led = 4;
 
 // relay_A
 const int RELAY_A = A0;
 
 // variables from sketch example
 String inputString = ""; // a string to hold incoming data
 boolean stringComplete = false; // whether the string is complete
 
 // variables from SO thread
 boolean LED_state = false;
 boolean vavle_open = false;

// flowmeter shit
unsigned long totalCount = 0;
unsigned long previousCount = 0;
int pin = 2;
unsigned long duration;

// storage variable for the timer
unsigned long previousMillis=0;
int interval=1000; //in milliseconds

// counters for each flowmeter
unsigned long countA = 0;
 
 void setup() {
   
   Serial.begin(9600); // open serial port, sets data rate to 2400bps
   Serial.println("Power on test");
   inputString.reserve(200);
   
   pinMode(RELAY_A, OUTPUT);
   
   // flowmeter shit
   pinMode(pin, INPUT);
   
}

void open_valve() {
 
  digitalWrite(RELAY_A, HIGH); // turn RELAY_A on
 
  // set the boolean value for "vavle_open" to true
  //valve_open = true;
  Serial.println("Valve Open");
 
}

void close_valve() {
  Serial.println("2");
  digitalWrite(RELAY_A, LOW); // turn RELAY_A off
  //valve_open = false;
  Serial.println("3");
  Serial.println("Vavle Closed");
}

void controlValve(bool open)
{
 
}

void flow_A_blink() {
 
  digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for one second
  digitalWrite(led, LOW);   // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second
}

void flow_A_blink_stop() {
 
  digitalWrite(led, LOW);
}

void getFlow() {
 
  duration = pulseIn(pin, HIGH);
  Serial.print(duration);
  Serial.println("");
  delay(200);
}

/*
 * Main program loop
 */
 
void loop() {
  if(checkForCorrectCommand("{open_valve}") == true) {
    open_valve();
    Serial.println("OPENING");
    getFlow();   
  }
  else if(checkForCorrectCommand("{close_valve}") == true)
  {
    close_valve();
    Serial.println("CLOSING");
  }
}

bool checkForCorrectCommand(String cmd) { 
 
    //Serial.println(inputString);
    //Serial.println(cmd);
   
    if(inputString == cmd) {
     // reset String variables for serial data commands
     Serial.println("1");
     inputString = "";
     stringComplete = false;
     return true;
      // reset String variables for serial data commands
      inputString = "";
      stringComplete = false;
      return false;
    }
}

//SerialEvent occurs whenever a new data comes in the
//hardware serial RX.  This routine is run between each
//time loop() runs, so using delay inside loop can delay
//response.  Multiple bytes of data may be available.

void serialEvent() {
  while(Serial.available()) {
    // get the new byte:
    char inChar = (char)Serial.read();
    // add it to the inputString:
    inputString += inChar;
    // if the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n') {
      stringComplete = true;
    }
  }
}

Also, the kegboard mini shield specs can be found here,https://github.com/Kegbot/kegboard/tree/master/hw/kegboard-mini
Pages: [1] 2 3 ... 5