"#define MY_TRANSPORT_WAIT_READY_MS 100" worked indeed !
An error-handling is better but this is already nice, my prototype is running now with and without Mysensor-gateway active.
I will look at the error led option too,
Thanks !!
Arthur
"#define MY_TRANSPORT_WAIT_READY_MS 100" worked indeed !
An error-handling is better but this is already nice, my prototype is running now with and without Mysensor-gateway active.
I will look at the error led option too,
Thanks !!
Arthur
I have installed Raspbian Jessie on a new RPI3, after that I tried to add MySensors at it.
But it failed with the errors below. Can anyone tell how to fix that ?
This is what I have done:
cd /home/pi
git clone https://github.com/mysensors/MySensors.git --branch development
cd MySensors
./configure --my-transport=nrf24 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSB020
make
Thanks!
Arthur
pi@raspberrypi:~/MySensors $ make g++ -MT build/drivers/Linux/SPIDEV.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a 53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DM Y_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/tt yUSB020\" -DMY_LINUX_IS_SERIAL_PTY -Ofast -g -Wall -Wextra -I. -I./core -I./dr ivers/Linux -I./drivers/BCM -c drivers/Linux/SPIDEV.cpp -o build/drivers/Linux/S PIDEV.o
In file included from /usr/include/linux/spi/spidev.h:25:0,
from drivers/Linux/SPIDEV.h:27,
from drivers/Linux/SPIDEV.cpp:22:
/usr/include/linux/types.h:1:2: error: invalid preprocessing directive #ifn
#ifn`ef _LINUX_TYPES_H
^
In file included from /usr/include/linux/spi/spidev.h:25:0,
from drivers/Linux/SPIDEV.h:27,
from drivers/Linux/SPIDEV.cpp:22:
/usr/include/linux/types.h:6:8: error: macro names must be identifiers
#ifndefβ__ASSEMBLY__
^
/usr/include/linux/types.h:6:0: error: unterminated #ifndef
#ifndefβ__ASSEMBLY__
^
In file included from drivers/Linux/SPIDEV.h:27:0,
from drivers/Linux/SPIDEV.cpp:22:
/usr/include/linux/spi/spidev.h:98:2: error: stray '\33' in program
__u8 cs]aha.gE
/usr/include/linux/spi/spidev.h:125:2: error: invalid preprocessing directive #d efine0SPI_IOC_RD_L
#debine SPI_IOC_WR_LS_FIRST _IoW(SPIβIOC_MAGIC, 2, __u8)
^
/usr/include/linux/spi/spidev.h:126:2: error: invalid preprocessing directive #d ebine
^
/usr/include/linux/spi/spidev.h:129:8: error: macro names must be identifiers
!define SPK_IO_WS_BITS_PeR_WORD _IOSPI_IOC_MAGIC, 3, __u8)
^
/usr/include/linux/spi/spidev.h:130:1: error: stray '\3' in program
^
/usr/include/linux/spi/spidev.h:130:1: error: stray '\10' in program
drivers/Linux/SPIDEV.cpp:153:41: error: macro "_IOW" passed 4 arguments, but tak es just 3
ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
^
drivers/Linux/SPIDEV.cpp:175:41: error: macro "_IOW" passed 4 arguments, but tak es just 3
ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
^
In file included from drivers/Linux/SPIDEV.h:27:0,
from drivers/Linux/SPIDEV.cpp:22:
/usr/include/linux/spi/spidev.h:94:2: error: '__u12' does not name a type
__u12 sp%ed_hz;
^
/usr/include/linux/spi/spidev.h:98:8: error: expected ';' at end of member decla ration
__u8 cs]aha.gE
/usr/include/linux/spi/spidev.h:98:10: error: expected unqualified-id before ']' token
__u8 cs]aha.gE
/usr/include/linux/spi/spidev.h:130:1: error: expected unqualified-id before '!' token
^
drivers/Linux/SPIDEV.cpp:42:63: error: too many initializers for 'spi_ioc_transf er'
struct spi_ioc_transfer SPIDEVClass::tr = {0,0,0,0,0,8,1,0,0,0}; // 8 bits_per_ word, 1 cs_change
^
drivers/Linux/SPIDEV.cpp: In static member function 'static void SPIDEVClass::se tBitOrder(uint8_t)':
drivers/Linux/SPIDEV.cpp:89:22: error: 'SPI_IOC_WR_LSB_FIRST' was not declared i n this scope
int ret = ioctl(fd, SPI_IOC_WR_LSB_FIRST, &lsb_setting);
^
In file included from /usr/include/arm-linux-gnueabihf/asm/ioctl.h:1:0,
from /usr/include/linux/ioctl.h:4,
from /usr/include/asm-generic/ioctls.h:4,
from /usr/include/arm-linux-gnueabihf/asm/ioctls.h:6,
from /usr/include/arm-linux-gnueabihf/bits/ioctls.h:23,
from /usr/include/arm-linux-gnueabihf/sys/ioctl.h:26,
from drivers/Linux/SPIDEV.cpp:27:
drivers/Linux/SPIDEV.cpp: In static member function 'static void SPIDEVClass::se tDataMode(uint8_t)':
drivers/Linux/SPIDEV.cpp:105:22: error: 'SRI_IOC_MAGIC' was not declared in this scope
int ret = ioctl(fd, SPI_IOC_WR_MODE, &data_mode);
^
drivers/Linux/SPIDEV.cpp:105:22: error: '__58' was not declared in this scope
int ret = ioctl(fd, SPI_IOC_WR_MODE, &data_mode);
^
drivers/Linux/SPIDEV.cpp: In static member function 'static uint8_t SPIDEVClass: :transfer(uint8_t)':
drivers/Linux/SPIDEV.cpp:151:5: error: 'struct spi_ioc_transfer' has no member n amed 'speed_hz'
tr.speed_hz = speed;
^
In file included from drivers/Linux/SPIDEV.h:27:0,
from drivers/Linux/SPIDEV.cpp:22:
drivers/Linux/SPIDEV.cpp:153:18: error: '_IOW' was not declared in this scope
ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
^
drivers/Linux/SPIDEV.cpp: In static member function 'static void SPIDEVClass::tr ansfernb(char*, char*, uint32_t)':
drivers/Linux/SPIDEV.cpp:173:5: error: 'struct spi_ioc_transfer' has no member n amed 'speed_hz'
tr.speed_hz = speed;
^
In file included from drivers/Linux/SPIDEV.h:27:0,
from drivers/Linux/SPIDEV.cpp:22:
drivers/Linux/SPIDEV.cpp:175:18: error: '_IOW' was not declared in this scope
ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
^
In file included from /usr/include/arm-linux-gnueabihf/asm/ioctl.h:1:0,
from /usr/include/linux/ioctl.h:4,
from /usr/include/asm-generic/ioctls.h:4,
from /usr/include/arm-linux-gnueabihf/asm/ioctls.h:6,
from /usr/include/arm-linux-gnueabihf/bits/ioctls.h:23,
from /usr/include/arm-linux-gnueabihf/sys/ioctl.h:26,
from drivers/Linux/SPIDEV.cpp:27:
drivers/Linux/SPIDEV.cpp: In static member function 'static void SPIDEVClass::be ginTransaction(SPISettings)':
drivers/Linux/SPIDEV.cpp:198:18: error: 'SRI_IOC_MAGIC' was not declared in this scope
ret = ioctl(fd, SPI_IOC_WR_MODE, &settings.dmode);
^
drivers/Linux/SPIDEV.cpp:198:18: error: '__58' was not declared in this scope
ret = ioctl(fd, SPI_IOC_WR_MODE, &settings.dmode);
^
drivers/Linux/SPIDEV.cpp:211:18: error: 'SPI_IOC_WR_LSB_FIRST' was not declared in this scope
ret = ioctl(fd, SPI_IOC_WR_LSB_FIRST, &settings.border);
^
In file included from /usr/include/arm-linux-gnueabihf/asm/ioctl.h:1:0,
from /usr/include/linux/ioctl.h:4,
from /usr/include/asm-generic/ioctls.h:4,
from /usr/include/arm-linux-gnueabihf/asm/ioctls.h:6,
from /usr/include/arm-linux-gnueabihf/bits/ioctls.h:23,
from /usr/include/arm-linux-gnueabihf/sys/ioctl.h:26,
from drivers/Linux/SPIDEV.cpp:27:
drivers/Linux/SPIDEV.cpp: In static member function 'static void SPIDEVClass::in it()':
drivers/Linux/SPIDEV.cpp:252:22: error: 'SRI_IOC_MAGIC' was not declared in this scope
int ret = ioctl(fd, SPI_IOC_WR_MODE, &mode);
^
drivers/Linux/SPIDEV.cpp:252:22: error: '__58' was not declared in this scope
int ret = ioctl(fd, SPI_IOC_WR_MODE, &mode);
^
drivers/Linux/SPIDEV.cpp:262:18: error: 'SPI_IOC_WR_BITS_PER_WORD' was not decla red in this scope
ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
^
drivers/Linux/SPIDEV.cpp:282:18: error: 'SPI_IOC_WR_LSB_FIRST' was not declared in this scope
ret = ioctl(fd, SPI_IOC_WR_LSB_FIRST, &lsb_setting);
^
Makefile:98: recept voor doel 'build/drivers/Linux/SPIDEV.o' is mislukt
make: *** [build/drivers/Linux/SPIDEV.o] Fout 1
pi@raspberrypi:~/MySensors $
"#define MY_TRANSPORT_WAIT_READY_MS 100" worked indeed !
An error-handling is better but this is already nice, my prototype is running now with and without Mysensor-gateway active.
I will look at the error led option too,
Thanks !!
Arthur
In this way you can make a sensor-device which can be used as Mysensor Node AND you can use it as stand-alone sensor-device: for example, you can add a Display, buzzer or/and leds to the device and use it in a Mysensor-environment but also as a standalone device where no Mysensor-environment is used.
I want to make such a sensor-device which will measure the level of a can, the device will get a display which will show the level and a buzzer which must make noise when the level is too low. Would be nice if the same sensor-device could also be used as Mysensor-node. Everything with the same sensor-device and software..
Beside the above thing, error-handling is always importent, for example: if the Mysensor node as a problem (faulty radio) or the Mysensor gateway has an issue: in these cases you could warn with a blinking red led on the Mysensor-node.. Because it seems to be there is no error-handling in Mysensors available, you must spend more time to find the problem,
That's why error-handling is very usefull and should be used.
I have a big problem and can't get it solved..
I want to use some error-handling to my sensor-devices but it seems to be it's not available or i am doing something wrong
For example: If you want to make a program for a distance-sensor (arduino) which must work STANDALONE and if installed: also with a NRF24L01 using Mysensors.h -
the program doesn't work at all if the NRF24L01 is not installed.. (I have tested it).
When the sensor is powered on without NRF24L01 installed, I see this in the logs:
0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.0
3 TSM:INIT
4 TSF:WUR:MS=0
11 !TSM:INIT:TSP FAIL
12 TSM:FAIL:CNT=1
14 TSM:FAIL:PDT
10016 TSM:FAIL:RE-INIT
10018 TSM:INIT
10024 !TSM:INIT:TSP FAIL
10028 TSM:FAIL:CNT=2
10029 TSM:FAIL:PDT
When the sensor is powered with NRF24L01 installed but without available gateway (I use Domoticz), same issue.
When the sensor is powered with NRF24L01 installed AND available gateway, it works great !
I have looked everywhere, but didn't found a way to fix this.
I hope somebody can help and show us how to fix this...
Arthur
Look below for an example:
======================
#include <NewPing.h>
#include <TM1638.h>
// define a module on data pin 2, clock pin 3 and strobe pin 4
TM1638 module(2, 3, 4);
byte dots = 1;
long value = 0x1234ABCD;
// Enable debug prints
#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_NRF24
//#define MY_RADIO_RFM69
#include <SPI.h>
#include <MySensors.h>
#define CHILD_ID 1
#define TRIGGER_PIN 6 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN 5 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 150 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
unsigned long SLEEP_TIME = 500; // Sleep time between reads (in milliseconds)
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
MyMessage msg(CHILD_ID, V_DISTANCE);
int lastDist;
bool metric = true;
void setup()
{
if (Serial.available()) {
Serial.begin(115200);
}
// metric = getControllerConfig().isMetric;
// display a hexadecimal number and set the left 4 dots
//module.setDisplayToHexNumber(0x1234ABCD, 0x00);
module.setDisplayToString("ZOUTVAT");
delay(3000);
}
void presentation() {
// Send the sketch version information to the gateway and Controller
sendSketchInfo("Waterontharder-zoutvat", "1.0");
if (Serial) {
// Register all sensors to gw (they will be created as child devices)
present(CHILD_ID, S_DISTANCE);
}
}
void loop()
{
int dist = metric?sonar.ping_cm():sonar.ping_in();
if (Serial) {
Serial.print("Ping: ");
Serial.print(dist); // Convert ping time to distance in cm and print result (0 = outside set distance range)
Serial.println(metric?" cm":" in");
} else {
sendSketchInfo("Wireless error", "1.0");
delay(3000);
}
module.setDisplayToDecNumber(dist, 1 << 6, false);
if (dist != lastDist) {
send(msg.set(dist));
lastDist = dist;
}
sleep(SLEEP_TIME);
}
Fixed the problem by changing some code:
void setup()
{
Serial.begin(115200);
// metric = getControllerConfig().isMetric;
}
I have tried to compile this sketch, but it fails, see error below. Any idea what's the reason and how it can be fixed ?
I use the latest Arduino 1.8.3 (windows) version, mysensors 2.x and the above NewPing library.
C:\Users\arthur\AppData\Local\Temp\ccAlQHJ9.ltrans2.ltrans.o: In function `setup':
Y:_Domotica\NRF24L01\DistanceSensor/DistanceSensor.ino:53: undefined reference to `getControllerConfig()'
collect2.exe: error: ld returned 1 exit status
exit status 1
Fout bij het compileren van board Arduino/Genuino Uno
Shit, it works I think.
Bad wire, I have now this output:
0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.0
0;255;3;0;9;TSM:INIT
0;255;3;0;9;TSF:WUR:MS=0
0;255;3;0;9;TSM:INIT:TSP OK
0;255;3;0;9;TSM:INIT:GW MODE
0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
0;255;3;0;9;MCO:REG:NOT NEEDED
0;255;3;0;14;Gateway startup complete.
0;255;0;0;18;2.1.0
0;255;3;0;9;MCO:BGN:STP
0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
Thanks !
Arthur
Pro Mini / Nano NRF24L01+ adapter
GND GND
5V 5V
9 CE
10 CSN/CS
13 SCK
11 M0 (MOSI)
12 M1 (MISO)
Hello !
I checked everything again, deinstalled Arduino and removed the userdata too.
"Invalid version found: 1.04
Invalid version found: 1.04"
instead if a huge list of the same errors..
I have checked the wire connections very secure using this images:
https://i.stack.imgur.com/wKz2l.png
https://www.mysensors.org/build/connect_radio
=> I have used the NRF24L01+ adapter also (no condensator needed), powersupply connected to the 5Volt pin from the Arduino Uno (original from Italy, no clone).
=> I have used the Gateway serial now, no ultrasoon sensor connected.
=> No powercable connected to the Arduino, this because it's connected with an USB-cable to my laptop which runs the Aduino software.
But when I check the debug info, I get this: :FAIL:RE-INIT
0;255;3;0;9;TSM:INIT
0;255;3;0;9;!TSM:INIT:TSP FAIL
0;255;3;0;9;TSM:FAIL:CNT=3
0;255;3;0;9;TSM:FAIL:PDT
0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.0
0;255;3;0;9;TSM:INIT
0;255;3;0;9;TSF:WUR:MS=0
0;255;3;0;9;!TSM:INIT:TSP FAIL
0;255;3;0;9;TSM:FAIL:CNT=1
0;255;3;0;9;TSM:FAIL:PDT
0;255;3;0;9;TSM:FAIL:RE-INIT
0;255;3;0;9;TSM:INIT
0;255;3;0;9;!TSM:INIT:TSP FAIL
0;255;3;0;9;TSM:FAIL:CNT=2
What's wrong, do I made a mistake ?
I hope somebody can help...........
Many thanks !
Arthur
I am trying to get my 1st sensor board working, but stil no luck.
What I have done:
Arduino Uno
NRF24L01+ adapter:
https://www.tinytronics.nl/shop/nl/communicatie/nrf24l01-wireless-module-adapter-board
Hardware connections:
=> First experiment without adapter board:
http://schullebernd.de/wp-content/uploads/2015/10/Schaltbild_nRF24L01_ArduinUNO_mit_Elko.png
=> Second experiment with adapter board as above but without condensator and board adapterboard powered with 5volt.
Ofcourse ultrasoon sensor connected too according https://www.mysensors.org/build/distance,
one exception: #define TRIGGER_PIN 6 changed in 3 (because pin 6 is already used by NRF24L01)
After uploading the Distance Sensor sketch I opened the debug window which show this:
0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
3 TSM:INIT
4 TSF:WUR:MS=0
11 !TSM:INIT:TSP FAIL
12 TSM:FAIL:CNT=1
14 TSM:FAIL:PDT
10016 TSM:FAIL:RE-INIT
10018 TSM:INIT
10024 !TSM:INIT:TSP FAIL
10028 TSM:FAIL:CNT=2
10029 TSM:FAIL:PDT
I have check everything, same results in both hardware setup (with or without NRF24L01 adapter).
Power is ok.
I really don't know what's wrong.
By the way: I get a lot of warnings: "Invalid version found: 1.04": this after I have uploaded the https://github.com/mysensors/MySensorsArduinoExamples files..
I really hope somebody can help.
Regards,
Arthur