Problem with Nrf24L01+ and arduino mega
I have two Arduino (a mega and nano) and two nRF24L01 + to communicate them.
The connection of the wires according to the library and using the SPI pins modeled on arduino.
NANO 328:
MISO -> 12
MOSI -> 11
SCK -> 13
CE -> 8
CSN -> 7
GND -> GND
VCC -> 3.3v
MEGA 2560:
MISO -> 50
MOSI -> 51
SCK -> 52
CE -> 8
CSN -> 7
GND -> GND
VCC -> 3.3v
Use the library "Mirf" found in the playground (
http://www.arduino.cc/playground/InterfacingWithHardware/Nrf24L01) and the examples ping_server and ping_client (without changing anything).
The problem is that the communication fails. If I connect the nano as a server and a mega as a client, mega sends the message to the nano, it receives and sends the replay although but mega not receives and displays a timeout.
If I do the contrary, the mega as a server and nano as a client, the nano sends the message and the mega does nothing.
At the time I thought of any of the Nrf24L01 + bad but I have exchanged and error remains the same so it is clear that the problem has to be in the mega arduino that is unable to receive any message.
And after that summarize, someone has managed to use an arduino Nrf24L01+ with and mega with the library "Mirf" or with another library.
Thank you.
can we interface a webcam and a PIR motion sensor to an arduino...???
Can we interface a webcam and a PIR motion sensor with an Arduino…?
I want to connect a PIR motion sensor and a webcam to an Arduino…
when a human enters a specified region…the PIR motion sensor will send a signal to the Arduino…
the Arduino then sends an actuating signal to the webcam so that it switches ON and starts recording…
when the human moves out of the specified region…the PIR motion sensor will send another signal to the Arduino
the Arduino then controls the webcam by turning It OFF…
also is it possible to store the recorded video in a storage device (preferably SD card)…?
please help me…
How to display ADC voltage on LCD Display
Good Day All.
I am still very new to the Arduino microcontroller so please bear with me.
I have got a LCD connected to my Arduino UNO, and I would like to be able to display the raw ADC voltage on the LCD Display to three decimal places.
Could someone please give me an example code, or a link to a post that would help me on my way?
Thanks for your time.
Best Regards.
Windows 7 -> driver installation -> code 10
hi, (im using a Dell laptop, with Windows 7, x64)
Yesterday i used my new Arduino UNO for the first time. I've downloaded the Arduino Software on the official website, and unzipped the folder. I plugged in the USB cable with my Arduino UNO board. I opened the Arduino.exe and i opened the Blink example. I uploaded it and it seems it was successfull. The LED was blinking on/off. But after that, i've changed the code in the Blink example (i would let blink 2 leds) and tried to upload it. Then i get the error: Serial port 'COM3' can't be found. I looked in the menu at extra--> serial port. This is unclickable and grey.
I searched on the Arduino site (and forum and Google) for errors and troubleshooting but i can't get it working. But i know, i forgot to installate the driver for the Arduino UNO. So i went to the Configuration Window of my laptop, choose Hardware & Sounds --> Device Manager. In the list with devices i tried to find the Ports (COM & LPT), but it was in my list. I neither found 'Unknown devices' in the list. I enabled in the Menu --> View --> View hidden devices. It doesnt work. After that I tried in the menu 'Add older hardware'. There i chose 'Looking for hardware and installate automatically. In the following list i clicked on Ports (COM & LPT). In that list i see Arduino LLC (
www.arduino.cc). I clicked on Browse and chose the arduino-1.0.3/drivers/Arduino UNO.inf . In the following list i clicked on Arduino UNO and then on Next.
The installation began and then came the following message: The next hardware is installed: Arduino UNO. The software for this device is installated, but it seems it does not correctly work. This device does not start (Code10).
I have tried everything. I tried it on another computer + Laptop (both with Windows 7), and nothing happened. It seems the Arduino (or usb cable) is not recognized. The LED on my Arduino is still working and the ON light is green. An orange light (L) is ON/OFF/ON/OFF.. I've pressed the RESET button on the Arduino but nothing helps me...
Please, can somebody help me? Thanks in advance. (Sorry for my bad English)
Arduino Yun: no connection and linux not work
Hi to everyone,
I buy Arduino Yun from arduino.org and I used the IDE 1.7. For a while everything works well but some days ago my Arduino stop to work and I don't understand why.
These are my symptoms:
- USB LED always ON;
- No Wifi;
- No Ethernet;
- Can't access to Linux part with ssh;
- Reset buttons not works;
- I follow this guide but nothing happened:
http://www.arduino.org/learning/tutorials/advanced-guides/rescue-guide-for-microcontroller-atmega-32u4
I stopped a project because of that and I don't know how to restore my Arduino and what is the problem.
I use MAC OSX Yosemite and the IDE Arduino 1.7.
Please, help me.
Thanks in advance.
TEMPERATURE SENSOR 18B20 WITH ARDUINO
I am currently writing this simple code to check the temp sensor
[code]#include <One Wire . h>
int DS18S20_Pin = 2; //DS18S20 Signal pin on digital 2
//Temperature chip i/o
OneWire ds(DS18S20_Pin); // on digital pin 2
void setup(void) {
Serial.begin(9600);
}
void loop(void)
{
float temperature = getTemp();
Serial.println(temperature);
delay(100); //just here to slow down the output so it is easier to read
}[/code]
I m getting "sketch_feb27a:14: error: 'getTemp' was not declared in this scope"
can someone tell me why?
ds18b20 temperature sensor and arduino
I am currently writing this simple code to check the temp sensor
[code]#include <One Wire . h>
int DS18S20_Pin = 2; //DS18S20 Signal pin on digital 2
//Temperature chip i/o
OneWire ds(DS18S20_Pin); // on digital pin 2
void setup(void) {
Serial.begin(9600);
}
void loop(void)
{
float temperature = getTemp();
Serial.println(temperature);
delay(100); //just here to slow down the output so it is easier to read
}[/code]
I m getting "sketch_feb27a:14: error: 'getTemp' was not declared in this scope"
can someone tell me why?
Help with Multiple Ultrasonic Sensors
Hi guys,
I'm trying to create a robot using three HC-SR04 ultrasonic sensors and my Arduino Pro Mini but I've run into a few problems. In short the robot's function is as follows:
1. The robot is dual wheeled, with an H-bridge (SN754410) driving each wheel.
2. There's one HC-SR04 sensor on each side of the robot, the left one activates the left wheel motor when it detects a hand in front of it, vice versa for the right side.
i.e. To make the robot go forward, we place our hands near the left and right side of the robot, to make it turn right, we remove the right hand and keep the left one in place, vice versa for turning left, etc.
3. A third HC-SR04 is located the top of the robot, such that it activates a third motor when the user's hand is hovering above the robot.
My test code is as follows:
[code]
#include <NewPing.h>
#define SONAR_NUM 3 // Number of sensors.
#define MAX_DISTANCE 20 // Maximum distance (in cm) to ping.
NewPing sonar[SONAR_NUM] = { // Sensor object array.
NewPing(4, 5, MAX_DISTANCE), // Each sensor's trigger pin, echo pin, and max distance to ping.
NewPing(6, 7, MAX_DISTANCE),
NewPing(8, 9, MAX_DISTANCE)
};
#define ena1 10 //trigger for left motor H-bridge
//#define ena2 11 //trigger for right motor
//#define ena3 12 //for top motor
long sensors[3]; //array to store sensor distances
void setup() {
Serial.begin (115200);
pinMode(ena1, OUTPUT);
//pinMode(ena2, OUTPUT);
//pinMode(ena3, OUTPUT);
}
void loop() {
for (uint8_t i = 0; i < SONAR_NUM; i++) { // Loop through each sensor and display results.
delay(50); // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
sensors[i] = sonar[i].ping_cm();
}
Serial.println(sensors[0]);
if (sensors[0] > 0 && sensors[0] <= 20){
Serial.println("detected");
digitalWrite(ena1, HIGH);
}else{
Serial.println("NA");
digitalWrite(ena1,LOW);
}
}[/code]
As you can see, I'm using the NewPing.h library to collect the sensor data. After each iteration of the for loop, the distances detected by the sensors are stored in a sensor array. When a hand is placed about 15-20 cm away from a sensor, the arduino sends a digital "HIGH" trigger signal to the respective H-bridge, activating the respective motor (I only have one of these pins, "ena1", enabled in my code, the other two are commented for the test).
To test my code, I simply connected the H-bridge trigger pin "ena1" to an LED, this pin is activated by the sensor whose distance data is stored in variable "sensors[0]". However, after I compile and upload my code, I notice that the LED simply flickers faintly as I put my hand in front of the sensor. As if the LED is being turned on and off very fast.
The output from the serial monitor is as follows:
[code]15
detected
0
NA
16
detected
0
NA
14
detected
0
NA[/code]
As you can see, by putting my hand about ~15cm in front of the sensor, the sensor returns the correct distance and the "ena1" pin is set to high (as evidenced by "detected" being printed to the screen).
However, the sensor always returns a "0" value at the next iteration of the main loop (while my hand is still in front of the sensor), subsequently setting the "ena1" pin to LOW again, which might explain why the LED is being turned on and off so fast.
I'm not sure why this is happening... Interestingly, by removing the digitalWrite lines from the code, the sensor returns the correct values (i.e. no "0" value when my hand is in front of the sensor).
Any ideas on how I can fix this?
Thanks in advance!
Driving two Ultrasonic sensor with Arduino
everyone. I've got a problem while I try to use Arduino uno to drive two HC-SR04 ultrasonic sensor. While a try to display two measured value from each sensor, one of them work fine but the other displays value 0.
[code]int trigPin=12; // this pin work as the output of the two trig pin of the two sensor
int echoPin1=8;
int echoPin2=13;
void setup()
{
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin1, INPUT);
pinMode(echoPin2, INPUT);
}
void loop()
{
float duration1, distance1, duration2, distance2;
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW); //trig:10 microsecond TTL pulse
duration1 = pulseIn(echoPin1, HIGH);
duration2 = pulseIn(echoPin2, HIGH);
distance1 = duration1/2/29.1;
distance2 = duration2/2/29.1;
Serial.print(distance1);
Serial.print(',');
Serial.println(distance2);
delay(20);
}[/code]
The situation is that on the Serial Monitor, "distance1" shows correct value however "distance2" is always 0.
I've found that while "duration1" and "duration2" exchange their order(which means duration2 runs first, then duration1 runs.), the result becomes that distance1 shows 0 but distance2 shows correct value.
It seems there are some problems while I using the function "pulseIn", is that right?
Could anyone help me fix this problem, thanks!