Show Posts
Pages: [1] 2 3 ... 9
1  Using Arduino / Microcontrollers / Re: Using ATTINY 85V-10PU with the 2.4 Ghz Nrf24L01 Transceiver. on: April 06, 2014, 09:32:34 pm
Ive had some luck with this tutorial:

http://nerdralph.blogspot.ca/2014/01/nrf24l01-control-with-3-attiny85-pins.html

I had discussed this exact project with a buddy, Jack Christensen who supplied also a modified schematic of the one mentioned on Ralphs blog.




Please post back with your progress/updates! It takes a bit of messing with the header files. Here is a list of steps I took following Ralphs blog and Jack's schematic:


Proper Attiny85 library installation for nrf24l01

First, Install:


https://code.google.com/p/arduino-tiny/

download the latest version, Arduino 1.5. Extract, and drag the  “avr” folder  (found inside the “tiny” folder) into a newly created folder located in the sketch folder  called “hardware”.

the avr folder should be the parent folder of the at tiny cores/etc due to the Arduino IDE directory tree hierarchy.

NOTE: you will need to rename the txt file called “Prospective Boards.txt” to simply “boards.txt” within  the “avr” folder



 A proper installation should indicate the attiny boards available to select in tools.  





 download the “door monitor” file containing libraries needed : https://github.com/samuelclay/doormonitor

the only folders of interests are within the “mirf “ folder are  the “Mirf” and the “SPI85” folders, that I dragged within the main libraries folder (not the sketch libraries folder)



according to http://nerdralph.blogspot.com/2014/01/nrf24l01-control-with-3-attiny85-pins.html, modify the Mirf.cpp as follows:

Code:
void Nrf24l::csnHi(){
 PORTB |= (1<<PINB2);  // SCK->CSN HIGH
 delayMicroseconds(64);  // allow csn to settle
}

void Nrf24l::csnLow(){
 PORTB &= ~(1<<PINB2);  // SCK->CSN LOW
 delayMicroseconds(8);  // allow csn to settle
}

unmodified, everything compiled. when i incorporated Ralphs suggestion:
2  Using Arduino / Networking, Protocols, and Devices / iOS 7 multipeer (mesh network topology) feature and Zig Bees on: March 28, 2014, 10:44:06 am
Hey all,

I may be late on the news, but it found a really interesting addition to iOS 7 involving a mesh network topology using Apples Multipeer library here:

https://developer.apple.com/library/ios/samplecode/MultipeerGroupChat/Listings/AdhocGroupChat_ImageView_m.html

And here is an article I came across creating a simple chat client :

http://www.technologyreview.com/news/525921/the-latest-chat-app-for-iphone-needs-no-internet-connection/?utm_campaign=socialsync&utm_medium=social-post&utm_source=twitter1

Extremely interested in seeing some uses with Multipeer connectivity soon. Also integrating a Zig Bee network to control devices. Jumping on board.
3  Using Arduino / Networking, Protocols, and Devices / Re: RF24Network Library / sending multiple messages on: February 08, 2014, 02:45:08 pm
Quote
The node numbers seem interesting. Both devices seem to think that they are 0 and that the other one is 1. Is that right?

I am confused on this front also. Should they be set to the same number address? This was in the default code, but I am not clear how this is being used in all honesty.

I have attempted to incorporate both of your suggestions, and I am receiving the error message from the default switch case.
I had to set the
Code:
payload_t payload
declaration outside of the switch case loop since it wasnt detecting it in the scope. I have made some revisions from this tutorial mentioned in the forums:  http://forum.arduino.cc/index.php?topic=138663.0  But I am having difficulty sending different packets at different points (not simultaneously)  when a button out of four buttons is pressed. I am receiving two out of the 4 values, but seeing a "77" continuously printed in the monitor.

code below:


transmitter

Code:
//TRANSMITTER


#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
int msg[1];


RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL;
int SW1 = 7;
int SW2 = 6;

int SW3 = 5;

int SW4 = 4;


 
void setup(void){
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(pipe);
}
 
void loop(void){
  if (digitalRead(SW1) == HIGH){
  msg[0] = 111;
  radio.write(msg, 1);


}
  if (digitalRead(SW2) == HIGH){
  msg[0] = 222;
  radio.write(msg, 1);


}
  if (digitalRead(SW3) == HIGH){
  msg[0] = 333;
  radio.write(msg, 1);


}
  if (digitalRead(SW4) == HIGH){
  msg[0] = 444;
  radio.write(msg, 1);


}


}



and receiver


Code:
//RECEIVER

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
int msg[1];



RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL;
int LED1 = 7;
int LED2 = 6;

int LED3 = 5;

int LED4 = 4;

 
void setup(void){
  Serial.begin(9600);
  radio.begin();
  radio.openReadingPipe(1,pipe);
  radio.startListening();
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);

  pinMode(LED3, OUTPUT);

  pinMode(LED4, OUTPUT);



}
 
void loop(void){
  if (radio.available()){
    bool done = false;   
    while (!done){
      done = radio.read(msg, 1);     
      Serial.println(msg[0]);
       

   
   
   
      if (msg[0] == 111){
      delay(10);
    digitalWrite(LED4, HIGH);
      digitalWrite(LED1, LOW);
        digitalWrite(LED2, LOW);

    digitalWrite(LED3, LOW);
  }
      else {
        digitalWrite(LED4, LOW);
        digitalWrite(LED1, LOW);
        digitalWrite(LED2, LOW);

    digitalWrite(LED3, LOW);

    }
   
   
   
      if (msg[0] == 222){
      delay(10);
    digitalWrite(LED1, HIGH);
        digitalWrite(LED2, LOW);

    digitalWrite(LED3, LOW);
    digitalWrite(LED4, LOW);

  }
      else {
        digitalWrite(LED1, LOW);
        digitalWrite(LED2, LOW);

    digitalWrite(LED3, LOW);
    digitalWrite(LED4, LOW);
    }
   
   
   
   
      if (msg[0] == 333){
      delay(10);
    digitalWrite(LED2, HIGH);
     digitalWrite(LED1, LOW);

    digitalWrite(LED3, LOW);
    digitalWrite(LED4, LOW);
  }
      else {
        digitalWrite(LED2, LOW);
      digitalWrite(LED1, LOW);

    digitalWrite(LED3, LOW);
    digitalWrite(LED4, LOW);
    }
     
   
   
        if (msg[0] == 444){
      delay(10);
    digitalWrite(LED3, HIGH);
     digitalWrite(LED2, LOW);
     digitalWrite(LED1, LOW);

    digitalWrite(LED4, LOW);
  }
      else {
       digitalWrite(LED2, LOW);
     digitalWrite(LED1, LOW);

    digitalWrite(LED3, LOW);
    digitalWrite(LED4, LOW);
    }
    delay(100);
    }
  }
 
  else{
 
  Serial.println("No radio available");

  }
}
4  Using Arduino / Networking, Protocols, and Devices / RF24Network Library / sending multiple messages on: February 07, 2014, 08:17:04 pm
Hey all,

So I had recently purchased the nRF24L01 modules : http://www.amazon.com/gp/product/B00E594ZX0/ref=oh_details_o00_s00_i00?ie=UTF8&psc=1

I had downloaded the basic RF24 and the RF24Network (https://github.com/maniacbug/RF24Network) and compiled / wired everything fine according to this blog post:
http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo

My problem lies in using the RF24Network library for my needs. I essentially want to transmit different messages from the transmitter (I have 4 total push buttons... so if button A is pressed..send A, if button B pressed, send B..etc)  to be received from the other module. I found this code for the transmitter: http://maniacbug.github.io/RF24Network/helloworld_tx_8pde-example.html

and the code for the receiver: http://maniacbug.github.io/RF24Network/helloworld_rx_8pde-example.html

and attempted to do what I had mentioned without any luck. it seems the "up" section of my code continuously prints and then the "left" string becomes jumbled with the up string.

here is my code for the transmitter:
Code:
/*
 Copyright (C) 2012 James Coliz, Jr. <maniacbug@ymail.com>

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 version 2 as published by the Free Software Foundation.
 */

/**
 * Simplest possible example of using RF24Network
 *
 * TRANSMITTER NODE
 * Every 2 seconds, send a payload to the receiver node.
 */

#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>

const int leftPin = 3;     // the number of the pushbutton pin
const int upPin = 4;     // the number of the pushbutton pin

int upState = 0;         // variable for reading the pushbutton status

int leftState = 0;         // variable for reading the pushbutton status

// nRF24L01(+) radio attached using Getting Started board
RF24 radio(9,10);

// Network uses that radio
RF24Network network(radio);

// Address of our node
const uint16_t this_node = 1;

// Address of the other node
const uint16_t other_node = 0;

// How often to send 'hello world to the other unit
const unsigned long interval = 1000; //ms

// When did we last send?
unsigned long last_sent;

// How many have we sent already
unsigned long packets_sent;

// Structure of our payload
struct payload_t
{
  unsigned long ms;
  unsigned long counter;
};

void setup(void)
{
  
  Serial.begin(57600);
  Serial.println("RF24Network/examples/helloworld_tx/");
   pinMode(leftPin, INPUT);
   pinMode(upPin, INPUT);    
  

  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
}

void loop(void)
{
    leftState = digitalRead(leftPin);
    upState = digitalRead(upPin);

  // Pump the network regularly
  network.update();

  // If it's time to send a message, send it!
  unsigned long now = millis();
  if ( now - last_sent >= interval  )
  {
    last_sent = now;
packets_sent = 'R';
    Serial.print("Sending...");
  //  payload_t payload = { millis(), packets_sent++ };
    //payload_t payload = {packets_sent};
                  const char* left = "turn L";
               const char* up = "go forward";

        const char* right = "right";
        const char* down = "down";


    RF24NetworkHeader header(/*to node*/ other_node);
 // bool ok = network.write(header,&payload,sizeof(payload));
     if (leftState == HIGH) {    
 
  bool go = network.write(header,left,strlen(left));

     }
      if (upState == HIGH) {    
 
  bool go = network.write(header,up,strlen(up));

     }
    
    
    
    
}
}
// vim:ai:cin:sts=2 sw=2 ft=cpp


and code for my receiver


Code:
/*
 Copyright (C) 2012 James Coliz, Jr. <maniacbug@ymail.com>

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 version 2 as published by the Free Software Foundation.
 */

/**
 * Simplest possible example of using RF24Network,
 *
 * RECEIVER NODE
 * Listens for messages from the transmitter and prints them out.
 */

#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>

int readVal;
// nRF24L01(+) radio attached using Getting Started board
RF24 radio(9,10);

// Network uses that radio
RF24Network network(radio);

// Address of our node
const uint16_t this_node = 0;

// Address of the other node
const uint16_t other_node = 1;

// Structure of our payload
struct payload_t
{
  unsigned long ms;
  unsigned long counter;
};

void setup(void)
{
  Serial.begin(57600);
  Serial.println("RF24Network/examples/helloworld_rx/");
 
  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
}

void loop(void)
{
  

    
  // Pump the network regularly
  network.update();

  // Is there anything ready for us?
  while ( network.available() )
  {
    
    /*
    // If so, grab it and print it out
    RF24NetworkHeader header;
    payload_t payload;
    network.read(header,&payload,sizeof(payload));
    Serial.print("Received packet #");
    Serial.print(payload.counter);
    Serial.print(" at ");
    Serial.println(payload.ms);
    */
    
    
    
     // If so, grab it and print it out
    RF24NetworkHeader header;
    static char message[32];
    network.read(header,message,sizeof(message));
    //Serial.print("Received: ");
    Serial.println(message);
    
if(message=="turn L"){
  
  Serial.println("LEFT PRESS");
}

if(message=="go forward"){
    Serial.println("UP PRESS");

  
}

  
  }
  
}
// vim:ai:cin:sts=2 sw=2 ft=cpp


5  Using Arduino / Networking, Protocols, and Devices / Re: Sparkfun nRF2401A issues with hardware on: February 02, 2014, 11:57:36 pm
Hey crofter,

after discussing with a couple others, and referring to the datasheet, my assumptions are correct.

The Arduino outputs 5v I/O, when the nRF2401A can only handle max 3v...so it is incorrect to plug it directly to the Arduino I/O without some form of bidirectional filter to drop down the voltage.

scroll down to page 4:  https://www.sparkfun.com/datasheets/IC/nRF2401A.pdf
6  Using Arduino / Networking, Protocols, and Devices / Sparkfun nRF2401A issues with hardware on: February 01, 2014, 03:45:48 pm
I had recently purchased the nRF2401A module (https://www.sparkfun.com/products/152)

I am having a bit of difficulty getting the modules to work. Let me begin with where I am up to now:

referencing the Arduino site: http://playground.arduino.cc/InterfacingWithHardware/Nrf2401

I have properly installed the c++ / header files (in a properly named folder) in the library folder of the Arduino IDE. Everything compiles and uploads fine.

I then placed a 1.5Ω resistor from the Arduino 3.3 v to the vcc of the modules (since the sparkfun info page recommends 3v).

I have read in numerous other locations such as http://www.instructables.com/id/Arduino-Fart-O-Meter/step4/Transceiver-nRF2401A/ (if only these people used their power for good), and http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo (this is a slightly different module), that these transceivers may require higher current for power, and their I/O pins should not take the full 5v that Arduino is supplying (as I have been doing). I'd assume I would need to purchase the logic level converter from sparkfun.

I am a unsure on all these fronts, so I wanted to confirm if these two issues are the reason, or if i am overseeing something completely. Thanks for your time.
7  Community / Gigs and Collaborations / Arduino developer here, looking for work. on: October 09, 2013, 12:20:02 pm
Greetings!

My name is Danny  and I am a physical computing developer who uses many open source IDE's/platforms such as Arduino, Raspberry Pi, Processing, openFrameworks, Kinect and Android to create interactive installations/kinetic sculptures, electronic hardware devices, software and everything in between. Refer to my site below my signature to see my portfolio (personal work in the "art/installation" tab and contracted work in the "commissions/hardware" tab. I have worked alongside many hardware startups, interactive agencies, and new media artists. I am located in Chicago, IL. I can supply references if needed of past clients.

I am currently looking for work, so any recommendations, references, send me an email, danbertner(at)gmail(dot)com

Cheers!


Daniel Jay Bertner
http://danbertner.com/
8  Using Arduino / Networking, Protocols, and Devices / Re: GY80 I2C Bus on: September 10, 2013, 07:55:21 pm
Well, I have multiple i2c modules (GY80 IMU) in this case needing to be read simultaneously. I guess how this would look with this particular board is the i2c devices connected to appropriate pins, the SDA/SCL pins on left side to the arduino i2c, then reading from INT1, INT2, etc correct?
9  Using Arduino / Networking, Protocols, and Devices / Re: GY80 I2C Bus on: September 10, 2013, 12:07:05 pm
Thanks Nick,

Let me elaborate my understanding/issue for a moment; bare with me.

the GY80 IMU has a few onboard i2c sensors that i've found numerous info/datasheets/etc for. What I am concerned about is each of these sensors can only have 1-2 different addressable addresses max.

This is an issue because I need access simultaneously   to the incoming values from each sensor on the GY80.

From my understanding of the multiplexer you linked me; you can each I2C device to the appropriate pins, to the arduino, and use the interrupts to trigger between modules. What I am concerned with is reading all of the modules simultaneously and if this is possible with this MUX.
10  Using Arduino / Networking, Protocols, and Devices / Re: Multiplexing I2C on: September 08, 2013, 11:07:50 pm
Quote
I did it the same way you mention; hardwire all SCL lines but multiplex the SDA lines.

Would you be able to elaborate on "hardwire" all the SCl lines and multiplex the SDA lines of the IMU  with the MUX board referenced?
11  Using Arduino / Networking, Protocols, and Devices / GY80 I2C Bus on: September 08, 2013, 08:22:05 pm
Greetings all!

I recently picked up a handful of these multi-axis compass/gyro, etc modules here:  http://dx.com/p/gy-80-bmp085-9-axis-magnetic-acceleration-gyroscope-module-for-arduino-145912


I am trying to run 4+ of these i2c modules in a bus, but was informed that they probably will have the same address and this isnt possible. Any suggestions on how to run a bus system with multiple i2c devices of the same model?
12  Using Arduino / Networking, Protocols, and Devices / GY80 I2C device + Arduino Fio on: July 02, 2013, 05:11:13 pm
Greetings all!

So I am having a bit of trouble getting the GY80 I2C device (http://www.arduiner.com/en/su-ordinazione-12-giorni/423-GY-80-BMP085-9-9-axis-IMU-magnetic-field-accelerat.html)    to output anything in the serial monitor.

I had wired (and triple checked the wiring) like so: 

Arduino 5V to sensor VCC_IN
GND to GND
A4 to SDA
A5 to SCL


I tried running the basic I2C scanner code on the arduino site: http://playground.arduino.cc/Main/I2cScanner

and nothing was detected. Wondering what possible issues I am overseeing.
13  Using Arduino / Programming Questions / Re: RFID module software serial + serial read on: June 15, 2013, 04:44:41 pm
Thanks Grumpy Mike,

I had inserted your bit of code but it seems to not find the variable "token" in scope. is token suppose to be my incoming byte variable?

code below:

Code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); //pin2 Rx, pin3 Tx

int CMD[64];
int comlen =0;
int out_flag =0;
long number = 0;
const unsigned long resulting = 0x4D085C49UL;

const int led = 13;
byte C;

void setup()
{
  pinMode(led,OUTPUT);
  Serial.begin(9600);
  mySerial.listen();
  Serial.println("Serial number will be displayed here if a card is detected by the module:\n");
  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  delay(10);
  mySerial.write(0x02); //Send the command to RFID, please refer to RFID manual
}
void loop() // run over and over
{

  while (Serial.available())
  {
    int a = SerialReadHexDigit();
    //Serial.println(a);
    if(a>=0){
      CMD[comlen] = a;
      comlen++;
    }
    delay(10);
  }

  for(int i=0; i<comlen; i+=2){
    int c = mySerial.write( CMD[i]*16 + CMD[i+1]);



  }
  comlen =0;

  byte C;
  while (mySerial.available()) {
    C = mySerial.read();




    if (C<16) Serial.print("0");
    Serial.print(C ,HEX); //Display the Serial Number in HEX
    //Serial.print(" ");



    out_flag =1;

    if (C == number){

      Serial.println("IM IN");
      digitalWrite(led,HIGH);

    }
  }

  if (out_flag >0) {
    Serial.println();
    out_flag = 0;
  }


}

int SerialReadHexDigit()
{
  byte c = (byte) Serial.read();
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  else if (c >= 'a' && c <= 'f') {
    return c - 'a' + 10;
  }
  else if (c >= 'A' && c <= 'F') {
    return c - 'A' + 10;
  }
  else {
    return -1;   // getting here is bad: it means the character was invalid
  }
}


long int tokenInVar(){
  //long number = 0; declared in scope
  // int token[8];
  for(int i=0; i<8; i++) number = (number << 4) | convertFromHex(int(token[i]));
  return(number);

}

long int convertFromHex(int ascii){
  if(ascii > 0x39) ascii -= 7; // adjust for hex letters upper or lower case
  return(ascii & 0xf);
}


14  Using Arduino / Programming Questions / Re: RFID module software serial + serial read on: June 15, 2013, 04:18:07 pm
Quote
You need to read the data in, one byte at a time, and combine to create an unsigned long.

So to clarify, I will take the bytes of data, i.e. 4D085C49
 which converted to HEX  = 0x340x440x300x380x350x430x340x39

am I on the right path?
15  Using Arduino / Programming Questions / Re: RFID module software serial + serial read on: June 15, 2013, 02:31:36 pm
Code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); //pin2 Rx, pin3 Tx

int CMD[64];
int comlen =0;
int out_flag =0;

const unsigned long resulting = 0x4D085C49UL;

//byte C;



void setup()
{
  Serial.begin(9600);
  mySerial.listen();
  Serial.println("Serial number will be displayed here if a card is detected by the module:\n");
  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  delay(10);
  mySerial.write(0x02); //Send the command to RFID, please refer to RFID manual
}
void loop() // run over and over
{

  while (Serial.available())
  {
    int a = SerialReadHexDigit();
    //Serial.println(a);
    if(a>=0){
      CMD[comlen] = a;
      comlen++;
    }
    delay(10);
  }

  for(int i=0; i<comlen; i+=2){
    int c = mySerial.write( CMD[i]*16 + CMD[i+1]);



  }
  comlen =0;

  byte C;
  while (mySerial.available()) {
    C = mySerial.read();




    if (C<16) Serial.print("0");
    Serial.print(C ,HEX); //Display the Serial Number in HEX
    //Serial.print(" ");



    out_flag =1;

 if (C == resulting){

        Serial.println("IM IN");
       
      }
  }

  if (out_flag >0) {
    Serial.println();
    out_flag = 0;
  }
 

}

int SerialReadHexDigit()
{
  byte c = (byte) Serial.read();
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  else if (c >= 'a' && c <= 'f') {
    return c - 'a' + 10;
  }
  else if (c >= 'A' && c <= 'F') {
    return c - 'A' + 10;
  }
  else {
    return -1;   // getting here is bad: it means the character was invalid
  }
}
Pages: [1] 2 3 ... 9