Rocketscream Mini Ultra Pro V3 as gateway
-
Is anyone using a Mini Ultra Pro v3 as a gateway? I have a few of them lying around and I want to use one as a gsm gateway
I tried getting the nRF24 radio up and running before adding other components, but I seem unable to get it working.
20128 TSM:FAIL:DIS 20138 TSF:TDI:TSL 30149 TSM:FAIL:RE-INIT 30159 TSM:INIT 30174 !TSM:INIT:TSP FAIL 30184 TSM:FAIL:CNT=4
I found a post about the Arduino Zero, which uses the same chip, as wel as the sensebender gateway.
I tried using the spi pins (22-23-24), defined soft spi pins and tried using the pins used by sensebender gateway (found in the schematic).
Also used 2 different radios, used both vbus pin, as wel as bat pin with li-ion battery connected. radio has cap soldered to it and is working on pro mini and nano.
-
@robbie-deloose I have rocketscream mini ultra pro v3, but it has got rfm95 module, which I'd like to use as a gateway. I have not tried to connect it yet. I'll let you know, but I think your problem is soft spi or pins definition.
-
thx! I'm thinking along the same lines, as the chip is in use for the sensebender gateways. I give it another try today, but still no luck.
schematic for mini ultra: https://github.com/rocketscream/MiniUltraPro/raw/master/MINI-ULTRA-PRO.pdf
schematic for arduino zero: https://www.arduino.cc/en/uploads/Main/ArduinoZero-schematic.pdf
schematic for sensebenderGW: https://www.openhardware.io/dl/5691595329c41a296a5d0fd3/design/MysensorsGW.pdfI've tried using pins 19,20,21 and 11,12,13
I tried using softSPI, but this seems to give errors when used on arm:
Compiling .pioenvs\zeroUSB\src\main.cpp.o Compiling .pioenvs\zeroUSB\libf5a\SPI\SPI.cpp.o In file included from C:\Users\robbi\.platformio\lib\MySensors_ID548/hal/architecture/AVR/drivers/DigitalIO/DigitalIO.h:31:0, from C:\Users\robbi\.platformio\lib\MySensors_ID548/MySensors.h:341, from src\main.cpp:130: C:\Users\robbi\.platformio\lib\MySensors_ID548/hal/architecture/AVR/drivers/DigitalIO/DigitalPin.h:32:25: fatal error: util/atomic.h: No such file or directory #include <util/atomic.h> ^ compilation terminated. *** [.pioenvs\zeroUSB\src\main.cpp.o] Error 1
compelete code:
#include "arduino.h" /* * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2019 Sensnology AB * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * 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. * ******************************* * * REVISION HISTORY * Version 1.0 - Rait Lotamõis * * DESCRIPTION * The TinyGSM MQTT gateway sends radio network (or locally attached sensors) data to your MQTT broker using a GSM modem or optionally an ESP8266 as a WiFi modem. * The node also listens to MY_MQTT_TOPIC_PREFIX and sends out those messages to the radio network * * LED purposes: * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly * - ERR (red) - fast blink on error during transmission error or recieve crc error */ // Enable debug prints to serial monitor #define MY_DEBUG // Enables and select radio type (if attached) #define MY_RADIO_RF24 //#define MY_RADIO_RFM69 //#define MY_RADIO_RFM95 #define MY_RF24_CHANNEL 120 #define MY_RF24_PA_LEVEL RF24_PA_LOW #define MY_RF24_CE_PIN 5 #define MY_RF24_CS_PIN 6 #define MY_SOFTSPI #define MY_SOFT_SPI_SCK_PIN 14 #define MY_SOFT_SPI_MISO_PIN 16 #define MY_SOFT_SPI_MOSI_PIN 15 #define MY_GATEWAY_MQTT_CLIENT // Enable GSM modem support #define MY_GATEWAY_TINYGSM // Define your modem #define TINY_GSM_MODEM_SIM800 // #define TINY_GSM_MODEM_SIM808 // #define TINY_GSM_MODEM_SIM900 // #define TINY_GSM_MODEM_A6 // #define TINY_GSM_MODEM_A7 // #define TINY_GSM_MODEM_M590 // #define TINY_GSM_ESP8266 // leave empty anything that does not apply #define MY_GSM_APN "hologram" //#define MY_GSM_PIN "1234" #define MY_GSM_USR "" //If using a GSM modem, this stands for your GSM connection password. If using WiFi, it's your wireless password. #define MY_GSM_PSW "" //#define MY_GSM_SSID "" // Use Hardware Serial on Mega, Leonardo, Micro #define SerialAT Serial1 // or Software Serial on Uno, Nano //#include <SoftwareSerial.h> //#define MY_GSM_RX 4 //#define MY_GSM_TX 5 // If your Mosquitto is old fashioned and does not support 3.1.1 //#define MQTT_VERSION MQTT_VERSION_3_1 // Set this node's subscribe and publish topic prefix #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway2-out" #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway2-in" // Set MQTT client id #define MY_MQTT_CLIENT_ID "mygateway2" // Enable these if your MQTT broker requires username/password #define MY_MQTT_USER "" #define MY_MQTT_PASSWORD "" // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP) //#define MY_IP_ADDRESS 192,168,32,220 // If using static ip you can define Gateway and Subnet address as well //#define MY_IP_GATEWAY_ADDRESS 192,168,32,1 //#define MY_IP_SUBNET_ADDRESS 255,255,255,0 // MQTT broker if using URL instead of ip address. #define MY_CONTROLLER_URL_ADDRESS "-----" // The MQTT broker port to to open #define MY_PORT ---- /* // Enable inclusion mode #define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway //#define MY_INCLUSION_BUTTON_FEATURE // Set inclusion mode duration (in seconds) #define MY_INCLUSION_MODE_DURATION 60 // Digital pin used for inclusion mode button //#define MY_INCLUSION_MODE_BUTTON_PIN 3 // Set blinking period #define MY_DEFAULT_LED_BLINK_PERIOD 300 // Flash leds on rx/tx/err // Uncomment to override default HW configurations //#define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin //#define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin //#define MY_DEFAULT_TX_LED_PIN 16 // the PCB, on board LED */ #include <MySensors.h> void setup() { // Setup locally attached sensors } void presentation() { // Present locally attached sensors here } void loop() { // Send locally attached sensors data here }
-
@robbie-deloose I cannot compile your sketch under any board. There is a problem somewhere, perhaps MY_PORT and MY_CONTROLLER_URL_ADDRESS are not defined?
Try to compile and upload this sketch:// Enable debug prints to serial monitor #define MY_DEBUG // Enables and select radio type (if attached) #define MY_RADIO_NRF24 #define MY_RF24_CHANNEL 120 #define MY_RF24_PA_LEVEL RF24_PA_LOW #define MY_RF24_CE_PIN 5 #define MY_RF24_CS_PIN 6 #define MY_SOFTSPI #define MY_SOFT_SPI_SCK_PIN 14 #define MY_SOFT_SPI_MISO_PIN 16 #define MY_SOFT_SPI_MOSI_PIN 15 #define MY_GATEWAY_MQTT_CLIENT // Enable GSM modem support #define MY_GATEWAY_TINYGSM // Define your modem #define TINY_GSM_MODEM_SIM800 // #define TINY_GSM_MODEM_SIM808 // #define TINY_GSM_MODEM_SIM900 // #define TINY_GSM_MODEM_A6 // #define TINY_GSM_MODEM_A7 // #define TINY_GSM_MODEM_M590 // #define TINY_GSM_ESP8266 // leave empty anything that does not apply #define MY_GSM_APN "internet" //#define MY_GSM_PIN "1234" #define MY_GSM_USR "" //If using a GSM modem, this stands for your GSM connection password. If using WiFi, it's your wireless password. #define MY_GSM_PSW "" //#define MY_GSM_SSID "" // Use Hardware Serial on Mega, Leonardo, Micro //#define SerialAT Serial1 // or Software Serial on Uno, Nano #include <SoftwareSerial.h> #define MY_GSM_RX 4 #define MY_GSM_TX 5 // If your Mosquitto is old fashioned and does not support 3.1.1 //#define MQTT_VERSION MQTT_VERSION_3_1 // Set this node's subscribe and publish topic prefix #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out" #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in" // Set MQTT client id #define MY_MQTT_CLIENT_ID "mysensors-1" // Enable these if your MQTT broker requires usenrame/password //#define MY_MQTT_USER "username" //#define MY_MQTT_PASSWORD "password" // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP) //#define MY_IP_ADDRESS 192,168,32,220 // If using static ip you can define Gateway and Subnet address as well //#define MY_IP_GATEWAY_ADDRESS 192,168,32,1 //#define MY_IP_SUBNET_ADDRESS 255,255,255,0 // MQTT broker ip address or url. Define one or the other. //#define MY_CONTROLLER_URL_ADDRESS "mymqttbroker.com" #define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68 // The MQTT broker port to to open #define MY_PORT 1883 /* // Enable inclusion mode #define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway //#define MY_INCLUSION_BUTTON_FEATURE // Set inclusion mode duration (in seconds) #define MY_INCLUSION_MODE_DURATION 60 // Digital pin used for inclusion mode button //#define MY_INCLUSION_MODE_BUTTON_PIN 3 // Set blinking period #define MY_DEFAULT_LED_BLINK_PERIOD 300 // Flash leds on rx/tx/err // Uncomment to override default HW configurations //#define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin //#define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin //#define MY_DEFAULT_TX_LED_PIN 16 // the PCB, on board LED */ #include <MySensors.h> void setup() { // Setup locally attached sensors } void presentation() { // Present locally attached sensors here } void loop() { // Send locally attached sensors data here }
It does compile for mega2560, but does not for Arduino Zero. There is a problem with
#include <util/atomic.h>
Please see this -> https://forum.arduino.cc/index.php?topic=371122.0
-
@robbie-deloose For whatever season, the compiler does not see the following directory:
C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include\util
Very strange. @hek - any ideas please?
I am talking about this...Arduino\libraries\MySensors/drivers/AVR/DigitalIO/DigitalPin.h
There are several references to atomic.h, but the above location cannot be seen.
-
@robbie-deloose OK, success! I did not notice it, but before you define softSPI in SAMD, you have to have a line
#if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
Otherwise, it does not compile.
This sketch works fine for Arduino Zero (Native USB port):
/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * 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. * ******************************* * * REVISION HISTORY * Version 1.0 - Rait Lotamõis * * DESCRIPTION * The TinyGSM MQTT gateway sends radio network (or locally attached sensors) data to your MQTT broker using a GSM modem or optionally an ESP8266 as a WiFi modem. * The node also listens to MY_MQTT_TOPIC_PREFIX and sends out those messages to the radio network * * LED purposes: * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly * - ERR (red) - fast blink on error during transmission error or recieve crc error */ // Enable debug prints to serial monitor #define MY_DEBUG // Enables and select radio type (if attached) #define MY_RADIO_NRF24 #define MY_RF24_CHANNEL 120 #define MY_RF24_PA_LEVEL RF24_PA_LOW #define MY_RF24_CE_PIN 5 #define MY_RF24_CS_PIN 6 #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD) #define MY_SOFTSPI #define MY_SOFT_SPI_SCK_PIN 14 #define MY_SOFT_SPI_MISO_PIN 16 #define MY_SOFT_SPI_MOSI_PIN 15 #endif #define MY_GATEWAY_MQTT_CLIENT // Enable GSM modem support #define MY_GATEWAY_TINYGSM // Define your modem #define TINY_GSM_MODEM_SIM800 // #define TINY_GSM_MODEM_SIM808 // #define TINY_GSM_MODEM_SIM900 // #define TINY_GSM_MODEM_A6 // #define TINY_GSM_MODEM_A7 // #define TINY_GSM_MODEM_M590 // #define TINY_GSM_ESP8266 // leave empty anything that does not apply #define MY_GSM_APN "internet" //#define MY_GSM_PIN "1234" #define MY_GSM_USR "" //If using a GSM modem, this stands for your GSM connection password. If using WiFi, it's your wireless password. #define MY_GSM_PSW "" //#define MY_GSM_SSID "" // Use Hardware Serial on Mega, Leonardo, Micro #define SerialAT Serial1 // or Software Serial on Uno, Nano //#include <SoftwareSerial.h> //#define MY_GSM_RX 4 //#define MY_GSM_TX 5 // If your Mosquitto is old fashioned and does not support 3.1.1 //#define MQTT_VERSION MQTT_VERSION_3_1 // Set this node's subscribe and publish topic prefix #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out" #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in" // Set MQTT client id #define MY_MQTT_CLIENT_ID "mysensors-1" // Enable these if your MQTT broker requires usenrame/password //#define MY_MQTT_USER "username" //#define MY_MQTT_PASSWORD "password" // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP) //#define MY_IP_ADDRESS 192,168,32,220 // If using static ip you can define Gateway and Subnet address as well //#define MY_IP_GATEWAY_ADDRESS 192,168,32,1 //#define MY_IP_SUBNET_ADDRESS 255,255,255,0 // MQTT broker ip address or url. Define one or the other. //#define MY_CONTROLLER_URL_ADDRESS "mymqttbroker.com" #define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68 // The MQTT broker port to to open #define MY_PORT 1883 /* // Enable inclusion mode #define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway //#define MY_INCLUSION_BUTTON_FEATURE // Set inclusion mode duration (in seconds) #define MY_INCLUSION_MODE_DURATION 60 // Digital pin used for inclusion mode button //#define MY_INCLUSION_MODE_BUTTON_PIN 3 // Set blinking period #define MY_DEFAULT_LED_BLINK_PERIOD 300 // Flash leds on rx/tx/err // Uncomment to override default HW configurations //#define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin //#define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin //#define MY_DEFAULT_TX_LED_PIN 16 // the PCB, on board LED */ #include <MySensors.h> void setup() { // Setup locally attached sensors } void presentation() { // Present locally attached sensors here } void loop() { // Send locally attached sensors data here }
-
@alexsh1 , Thx for checking!
Code does compile, but i'm still getting!TSM:INIT:TSP FAIL
Tried different pins as well, but no luck. Did you managed to get the radio to initialise?
-
@robbie-deloose Most likely you have a wiring or pin number issue.
I have RFM95 hooked up to Mini Ultra Pro V3 and use the following setting:#define MY_RADIO_RFM95 #define MY_DEBUG_VERBOSE_RFM95 #define MY_RFM95_FREQUENCY RFM95_868MHZ #define MY_RFM95_CS_PIN 5 #define MY_RFM95_ATC_MODE_DISABLED #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD) #define MY_SOFTSPI #define MY_SOFT_SPI_SCK_PIN 24 #define MY_SOFT_SPI_MISO_PIN 22 #define MY_SOFT_SPI_MOSI_PIN 23 #endif
It works like a charm. And this is from my log:
0;255;3;0;9;20890 MCO:BGN:INIT GW,CP=RLNGS---,VER=2.3.0 0;255;3;0;9;20900 TSF:LRT:OK 0;255;3;0;9;20910 TSM:INIT 0;255;3;0;9;20920 TSF:WUR:MS=0 0;255;3;0;9;20930 RFM95:INIT 0;255;3;0;9;20940 RFM95:INIT:PIN,CS=5,IQP=2,IQN=2 0;255;3;0;9;20960 RFM95:PTX:LEVEL=13 0;255;3;0;9;20970 TSM:INIT:TSP OK 0;255;3;0;9;20980 TSM:INIT:GW MODE 0;255;3;0;9;20990 TSM:READY:ID=0,PAR=0,DIS=0 0;255;3;0;9;21000 MCO:REG:NOT NEEDED 0;255;3;0;14;Gateway startup complete. 0;255;0;0;18;2.3.0 0;255;3;0;9;21010 MCO:BGN:STP 0;255;3;0;9;21020 MCO:BGN:INIT OK,TSP=1
-
@robbie-deloose BTW, it works even with the following minimum settings:
#define MY_RADIO_RFM95 #define MY_RFM95_FREQUENCY RFM95_868MHZ #define MY_RFM95_CS_PIN 5
given that SCK, MOSI, MISO are wired to standard pins for ATSAMD21
-
@alexsh1 I've put this aside for a few days to clear my head. Changed to another breadboard started froms cratch and reconnected all the wiring. Now it does works! probably a bad connection or a miswiring.
Thx for the help!