element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum wirless display using Arduino and NRF24L01
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 32 replies
  • Answers 2 answers
  • Subscribers 394 subscribers
  • Views 3136 views
  • Users 0 members are here
  • help
  • nrf24l01+
  • led
  • arduino
Related

wirless display using Arduino and NRF24L01

billpenner
billpenner over 11 years ago

I am bogged down in this project

I'm using Arduino UNO.
I Have the keyboard data decoded and printing to the serial port (computer) fine.
I  want to send this data to a 16X2  LCD as soon as it is entered on the keypad.
  The LCD is working fine with serial input from computer to the Arduino but I cannot get the data to display on the
  LCD as soon as  a key is depressed. I have to send “enter”, then all three numbers are displayed.
I must have all three numbers sent to the transmitter as a group but the LCD should display them instantly as they are entered.
When the three numbers have been entered , the "*" key will send the string of numbers to a  NRF24L01.
Another  NRF24L01 and Arduino UNO will decode the data and display the numbers on a large 3 digit, 7 segment display.
The 7 segment display/decoder is working fine.
I can't seem to get the keyboard data into a form suitable for sending to either the 16X2  LCD or the  NRF24L01.
I can't even seem to get it into a string. I guess this is the form I need?
I think the  NRF24L01 will need a string of 3 digit numbers as a string? Right?
This is the code I have so far. Any help in getting me headed in the right direction would be greatly appreciated.
I gone over and over all the examples and tutorials on strings I can find but I can't seem to absorb it enough to make it work.
// key board to remote display.
#include <Keypad.h>
#include <LiquidCrystal.h>
int i;
String  A;                // Setup string to contain the data to transmit.
String  B;
String  C;
String  D;
                                          // set up the keypad decode
const byte ROWS = 4;       // Four rows
const byte COLS = 3;         // Three columns
                                          // Define the Keymap
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = { 5, 4, 3, 2 }; // keypad rows to Arduino pins
byte colPins[COLS] = { 6, 7, 8 }; //keypad columns to Arduino pins
                                                    // Create the Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
#define NRF2401                      // output pin to xmitter
void setup()
{
  Serial.begin(9600);
  }
void loop()
{
char key = kpd.getKey();
  delay(10);
  if(key)  // Check for a valid key.
     {
     switch (key)                            // check for transmit or clear keys
    {
      case '*':                                     //send data to transmitter
        Serial.print(key);                      // send data to xmitter
        Serial.println("  pressed");       //testing
      break;
    
                // digitalWrite(transmit); // for testing
                 // break;                          // for testing
      case '#':                                     // clear and reset data
       A,B,C="";                                   // clear strings
        Serial.print(key);    
        Serial.println(" Cleared");         // testing
       // Serial.println(C4);  // for testing
       break;                    
   
      default:    //accum max 3 char
        for(int i=0 ; i<4 ; i++){
         if (i==1)
           A = A + char(key);
           Serial.print (A);            // for testing
           Serial.print (key);        // for testing
         if(i==2)
           B = A +(key);               // for testing
           Serial.print(B);            // for testing
         if(i==3)  
           C = B +(key);
          Serial.println(C);          // for testing
           Serial.print(i);             // for testing
           Serial.print (A);           // for testing
        break;
         // Serial.println(C);         // for testing
       }
     }
     /*    Serial.print (A);
           Serial.print(char(B));                        // For testing
           Serial.print(char(C));
           Serial.print (char(A+B+C+D));
     */
          if(i==4)                                                    //Too many digits! Only three allowed
           Serial.print("   ERROR");
         // Serial.println(i) ;
    }
  }  
  • Sign in to reply
  • Cancel

Top Replies

  • bobcroft
    bobcroft over 10 years ago in reply to Former Member +1
    Hi Averil, Peter has posted some information for you that will help you. However, if you need anything else please send me your email address and I'll forward what I have. I used an Arduino and a LCD display…
Parents
  • bobcroft
    0 bobcroft over 11 years ago

    Bill,

              I have a document that I produced that shows the connections from a 4 * 4 matrix keypad to the 8574 and the basic code to use it.  I do not lay claim to the originally of the code as it is what I pulled together from other peoples work on the web.  There are two versions of the 8574, the 'A' version has a different address range.  Therefore if you really wanted you could add 8 off 8574's and 8 off 8574A's to give a total of 16 * 8 128 extra I/O on 2 wires from the Arduino!

    There are variants of the keypads and there appears to be no standard for the pin outs.  However it is not difficult to determine what the connections are with a multimeter.  The code can then be easily changed to produce the output you want.

     

    I could probably convert the notes I have to a PDF if you wish and sent it via email.  I do not know how to add documents to my replies on this site. Actually I have never tried!

     

    Bob

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to bobcroft

    Bob;

     

    Could you email me you notes on this project.

    Do you have a library for the 8574 and a working example.

     

    Thanks Averil

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 10 years ago in reply to Former Member

    Try this, full description for using this chip with the keypad

     

    http://www.instructables.com/id/I2C-keypad/?ALLSTEPS

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • bobcroft
    0 bobcroft over 10 years ago in reply to Former Member

    Hi Averil,

                    Peter has posted some information for you that will help you.  However, if you need anything else please send me your email address  and I'll forward what I have.  I used an Arduino and a LCD display on my project.  There are also several modules that can be bought that cover both a matrix keypad and a LCD display functionality on a small PCB.  That said the 8574 chip is a very versatile device, fun to learn and be creative with.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • bozone44
    0 bozone44 over 10 years ago in reply to bobcroft

    Thanks for the info on the i2c keyboard.

    The example from instructables is for a PIC controller, Do you have a sketch for Arduino?

    If you have further info please send it to me.

     

    norm.heath@gmail.com

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • bozone44
    0 bozone44 over 10 years ago in reply to bobcroft

    Bob

    Thanks so much for the info you sent. The code is simple and short.

    I'm still having one problem as the code you sent and the i2c library I have will not compile.

    I get an error ( i2c_keypad does not name a type.) I don't know what this means.

    Iv'e done quite a bit of research and it seems to be related to the version of the IDE one is running.

    I am running 1.05 and the i2c_keypad library is for versions before version 1.

    Here is the link for the library,   http://arduino.cc/playground/Main/I2CPortExpanderAndKeypads

    Do you have a more current version? If so could you send it to me or a link to it.

    If not any advise as to how to update this library, that is not to complicated, as i am some what of a newbie.


    Thanks again


    Norm

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • bobcroft
    0 bobcroft over 10 years ago in reply to bozone44

    Norm,

     

                            I think you have the wrong library.  I have attached a zip of the library I have.  I am running Arduino IDE version 1.56r2.

     

                Hopefully you can unzip the file and look at the stuff in there, I am sure it will sort out your problem.  The error you are getting means the compiler can’t find the correct library content.

     

                Bob

    Attachments:
    Keypad_I2C.zip
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • bozone44
    0 bozone44 over 10 years ago in reply to bobcroft

    Bob:

     

    Once again thank you for helping with this.

    I upgraded to 1.5.8 and installed your library and it now complies.

     

    Norm

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • bobcroft
    0 bobcroft over 10 years ago in reply to bozone44

    Norm,

                That’s great news, if you need any further help please ask.

     

    Bob

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • bozone44
    0 bozone44 over 10 years ago in reply to bobcroft

    I have run into another problem I though I'd run by you and see if you have any ideas.

     

    When i run the sketch, I don't get any response in the serial monitor.

     

    The hardware is as follows.

    I'm using a i2c backpack off a 16 x 2  lCD.  This is a 8574 surface mount chip with the i2c and data lines brought out on headers.

    I ran a i2c scanner sketch and found the address is 0 x 27 and changed it in the sketch.

    There are 4.7k pull up  resistors on the SCA and SCL  pins.

    The i2c communications seem to be working as i get an address when I scanned the devise.

    I'm using a 4 x 4 membrane  keypad found on ebay.

    I've ohmed out the keypad and found pin 1-4 are the rows and 5-8 the columns.

    The keypad is wired pin 1 to d0 pin 2 to d1 etc.

    The are 10k pull ups on the 4 columns.

    Upon uploading the sketch and opening the serial monitor Iv'e pressed all the buttons, but there isn't any response.

     

    Any thoughts on what Iv'e missed?

     

    Norm

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • bobcroft
    0 bobcroft over 10 years ago in reply to bozone44

    Hi Norm,

                    I assume you have power to the 8574 and you have the library loaded correctly.  Have you set up the pin configuration for the library?  I have attached a zip file with one of my sketches so you can see how I set mine up with the key array and pin definitions.

     

    I have not got my key pad set up at the moment but as I recall I did not add the pull up resistors, I have a feeling that the library enables the Arduino internal pull ups on the appropriate pins.  Thus it is important to correctly define the pins.  I think this may be the cause of your problem.

     

    Bob

    Attachments:
    i2cKeypad1.zip
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 10 years ago in reply to bozone44

    Don’t use D0, D1 for IO if you want to be using the Serial monitor at the same time, the serial port uses these pins to communicate with the PC

     

     

     

    Peter

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Robert Peter Oakes
    0 Robert Peter Oakes over 10 years ago in reply to bozone44

    Don’t use D0, D1 for IO if you want to be using the Serial monitor at the same time, the serial port uses these pins to communicate with the PC

     

     

     

    Peter

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • bozone44
    0 bozone44 over 10 years ago in reply to Robert Peter Oakes

    Thanks for the input.

     

    Just to clarify The D0 ,D1 etc i am talking about are on the port expander, not the data lines on th Arduino.

     

    A lot of time they are labeled P0,P1 but on the back pack board i am using they are labeled D0, D1.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • bobcroft
    0 bobcroft over 10 years ago in reply to bozone44

    Norm,

                I had guessed the references were to the port expander.  As a thought if the device cam off an LCD display could you reconfigure the display to see if the I2C comms are OK?  Otherwise I would suggest checking, with a multimeter which expander pins are activated when pressing each button.  I would have thought that even if the keypad is wrongly configured you should get something returned via the I2C.

     

    I have an IKAlogic 4 channel USB logic analyser for checking I2C signals, this helps trouble shooting no end.  An alternative is the Saleae clone from China, the device is cheap but it depends how you feel about using the Saleae software without buying their genuine product.

     

    I am guessing your issues are with the I2C side.

     

    Bob

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube