Recent Posts

Pages: [1] 2 3 ... 10
Deutsch / Re: Dekodieren Temperatursenso...
Last post by HotSystems - Today at 09:25 am
welchen RF433 Receiver hast Du denn verbaut....?
Nimm lieber den besseren, damit gibt es weniger Probleme.
Die billigen sind sehr störempfindlich und in Städten fast nicht zu verwenden.

Ich empfehle diese hier: 433 MHz Empfänger
Project Guidance / Re: NRF24L01 Tx Failed many ti...
Last post by Robin2 - Today at 09:24 am
Only in free air...   on FR4 it'll be about 2/3 that.
Sounds like you may know the answer to something I have been wondering about recently.

I have other 2.4GHz transceivers that have a short piece of flexible wire for the antenna.

I wonder if I cut through the antenna track on the nRF24 PCB and soldered on a short piece of wire (31mm ?) would it work as an antenna?

The reason I ask is because it would be a means to get the antenna outside a metal enclosure (on a model train).

Project Guidance / Re: Feasibility of mounting , ...
Last post by Chagrin - Today at 09:23 am
This would be a much more straightforward problem if you used a Raspberry Pi.

With an Arduino you can read/write SD cards easily enough but USB is a much more complicated problem. I don't think this would be practical without a USB Host Shield.
Sorry, but you cannot change the frequency of that buzzer.  You could increase the volume by using an Arduino output to switch an external 12V supply to the buzzer using a transistor.
Project Guidance / Re: keypad password = output
Last post by sterretje - Today at 09:21 am
Cost some amount of money to have someone do it for you. Costs even more money to have someone hold your hand through it.
A bit of mental exercise does not hurt me :)

Code: [Select]

#include <Keypad.h>

#define KP_TIMEOUT 5000
#define UNLOCKDURATION 10000

const byte lockPin = 13;

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns

byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad

// Define the keymaps.  The blank spot (lower left) is the space character.
char numberKeys[ROWS][COLS] =
  { '1', '2', '3' },
  { '4', '5', '6' },
  { '7', '8', '9' },
  { ' ', '0', '#' }

Keypad kp( makeKeymap(numberKeys), rowPins, colPins, sizeof(rowPins), sizeof(colPins) );

void setup()
  pinMode(lockPin, OUTPUT);

void loop()
  // the state of the lock
  static bool unlockState = false;

  // the unlock start time
  static unsigned long unlockStartTime = 0;

  // pointer to password
  char *pwd;

  // read a keystroke
  char ch = kp.getKey();
  //char ch = 0;
  //if (Serial.available() > 0)
  //  ch =;

  // if not unlocked
  if (unlockState == false)
    // add to user entry
    pwd = addToPwd(ch);

    // if pwd does not equal NULL, the password is complete
    if (pwd != NULL)
      // compare
      if (strcmp(pwd, "1234") == 0)
        Serial.println("Valid password");
        // indicate unlocked
        unlockState = true;
        // set the unlock start time
        unlockStartTime = millis();
        Serial.println("Unlock timeout 'timer' started");
        Serial.println("Invalid password");
  // when user pressed any key while unlocked
  else if (ch != NO_KEY)
    Serial.println("User locked");
    // indicate locked
    unlockState = false;

  // check if unlock 'timer' started if unlock lasted more than N seconds
  if (unlockStartTime != 0 && (millis() - unlockStartTime >= UNLOCKDURATION))
    Serial.println("Unlock timeout");
    // reset the unlock start time
    unlockStartTime = 0;
    // set the state to locked
    unlockState = false;

  if (unlockState == true)
    // unlock
    digitalWrite(lockPin, LOW);
    // lock
    digitalWrite(lockPin, HIGH);

  add received character to password
    received character (NO_KEY wiill be ignored)
    NULL if entry not complete, else pointer to entered password
char *addToPwd(char ch)
  // variable to store 4 character password and terminating nul character
  static char password[5];
  // index in the password array; where to store the next received character
  static byte index = 0;

  // start time of first keypress
  static unsigned long startTime = 0;

  // if timeout 'timer' not started, start it
  if (ch != NO_KEY && startTime == 0)
    Serial.println("Keypad timeout 'timer' started");
    startTime = millis();

  // check N second keypad timeout
  if (startTime != 0 && (millis() - startTime >= KP_TIMEOUT))
    Serial.println("Keypad timeout");
    // reset startTime
    startTime = 0;
    // reset index
    index = 0;
    // indicate password not complete
    return NULL;

  // handle the keypress
  switch (ch)
    // no key pressed
    case NO_KEY:
    // user canceled entry
    case '*':
      Serial.println("User canceled");
      // reset startTime
      startTime = 0;
      // reset index
      index = 0;
      // indicate password not complete
      return NULL;
    // user indicate entry complete
    case '#':
      Serial.println("Password complete");
      // add string terminator
      password[index] = '\0';
      // reset the index for the next time that we enter a password
      index = 0;
      // reset the startTime
      startTime = 0;
      // return the (pointer to the) password
      return password;
      // do not allow more than N characters (prevents buffer overflow and leaves space for the string terminator)
      if (index >= sizeof(password) - 1)
        Serial.println("Buffer overflow prevented");
        return NULL;

      // store the character
      password[index++] = ch;
      Serial.println("Character added");

  // entry not complete yet, return NULL pointer
  return NULL;

You can remove the Serial.print statements; they are there for debugging.

Analyse it and learn from it.
Project Guidance / Re: NRF24L01 Tx Failed many ti...
Last post by Robin2 - Today at 09:21 am
Can't see a 10uf cap but they are all set so hard to tell...
You must supply that.

When you have double quotes into a string they need to be escaped with \

client.println("<button onclick = \"myFunction()\">Reload I/O</button>");
Programming Questions / Re: HC-05
Last post by J-M-L - Today at 09:18 am
The Rx to Rx and Tx to Tx thingy is a bad idea as is having the console opened - too many devices jamming your serial com.

Use separate serial ports - hardware ones when you can on the MEGA , Rx goes to Tx and Tx to Rx. On the UNO, use pin 0 and 1 but don't connect to the console or use software serial.

The tutorial you are looking at is not a best practice - might want to loook elsewhere
Project Guidance / Re: Measure distance object is...
Last post by Robin2 - Today at 09:18 am
I don't understand your Option 2.

Putting a rotary encoder on the pulley should allow or very accurate measurements if the rope does not slip on the pulley.

You mention 11 feet but you don't give the range of movements you want to measure. I don't know if an ultrasonic sensor would work over that distance or whether it would be sufficiently accurate.

Hi PaulMurrayCBr

Thanks for the reply, I really appreciate your help as I'm really a mechanical engineer just trying my hand at programming. I gave it a try but I'm still getting an error message (see attached), any ideas?


Pages: [1] 2 3 ... 10

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131