Forum Replies Created
-
AuthorPosts
-
To answer your questions:
-I’m using platformio on VSCode. (I’m really not comfortable using it but these kind of problems is good for actually learning hands on. There is a lot of strange things in there that I don’t understand and I wish I could find a really good tutorial how to work with it.)
-Attached my “platformio.ini”
-I’ve tried both manual install and to let platformio do it.
-Now updated/upgraded/cleaned
– This is how the lib_dep folder looks like:
v libdeps\mayfly
>tmp_installing-kgja50_package
>AltSoftSerial
>NeoSWSerial
>SoftwareSerial_ExtInts
-I was pretty sure AltSoftSerial was the problem since I got some errors when including it when using the mayfly board both in Arduino
IDE and platformio but that seems to work now.
-If I now focus on the “data_saving”-example which I know I didn’t corrupt with my own programming I might be misinterpreting the output
based on my past problems with my own code (modified version of the Thingspeak example). When using your platformio.ini without the debugflags I get the output as attached in file “output1.txt”. Every 15 sec I get a new line of “Now running data_saving.ino on Logger XXXXX”
When using the debug flags I get whats in output2.txt
Then the Y504 seems to update. Maybe I was waiting for a output similar to the thingspeak-example? The testbutton didn’t work which made me assume something was wrong.The debug flags are very helpful. I totally missed to try them. The buffer setting in my terminal is probably to low to catch enough but i learned i can save the log to a text file with “pio device monitor > Filename.txt” in the terminal. Also very helpful.
Oh I forgot to replace the gprsbee which I removed the
Attachments:
I’m totally lost. Tried the “data_saving”-example as is and the logger restarts even if I keep the enable pin at -1. Doesn’t make a difference if I detach everything from the Mayfly and I tried both different usb-cables and FTDI-cable.
The “thingspeak” example works if I don’t add any Yosemitech libraries/sensors in the code. I wonder if I’m doing anything wrong with PlatformIO? I have to add https://github.com/SRGDamia1/NeoSWSerial.git and https://github.com/EnviroDIY/SoftwareSerial_ExternalInts.git
to the “platformio.ini” of the “data_saving”-example even if the .ini-file on github don’t use it.Tried the same code with a Sodaq Mbili and it behaves exactly the same.
Anyone who can help me where I should start with the debug?
Wow, I just realized I didn’t really post any real question and still you are helping=)I’m really thankful and impressed by all your effort.
I have ordered a module with automatic flow control from Amazon but I didn’t want to wait for it to arrive so I started with what I had.
The module I have has been working nicely before but this time I can’t get it to work. In the past the timing turning the Enable pin low has been tricky for me. For simple programs I’ve used delays but I tried something like Nick Gammon’s solution under “Flushing the output” RS485 communications. But not in this case.I using the “logging_to_ThingSpeak”-example with one Yosemitech Y504, AltSoftSerial (pins 5&6) and RE/DE on pin 4.
On my module the RE/DE are coupled together so you only need one pin. The restart happens even if I disconnect everything from the Mayfly logger. And the only way to stop it from happen is to set the “max485EnablePin” to -1. I will try some more examples to see if I can get it right with my coding.123456789101112131415161718192021222324252627282930313233343536// ==========================================================================// Settings for Additional Serial Ports// ==========================================================================// AltSoftSerial by Paul Stoffregen (https://github.com/PaulStoffregen/AltSoftSerial)// is the most accurate software serial port for AVR boards.// AltSoftSerial can only be used on one set of pins on each board so only one// AltSoftSerial port can be used.// Not all AVR boards are supported by AltSoftSerial.#include <AltSoftSerial.h>AltSoftSerial altSoftSerial;// ==========================================================================// Yosemitech Y504 Dissolved Oxygen Sensor// ==========================================================================#include <sensors/YosemitechY504.h>// Create a reference to the serial port for modbus// Extra hardware and software serial ports are created in the "Settings for Additional Serial Ports" section#if defined ARDUINO_ARCH_SAMD || defined ATMEGA2560HardwareSerial &modbusSerial = Serial2; // Use hardware serial if possible#elseAltSoftSerial &modbusSerial = altSoftSerial; // For software serial if needed// // NeoSWSerial &modbusSerial = neoSSerial1; // For software serial if needed#endifbyte y504ModbusAddress1 = 0x01; // The modbus address of the Y504//byte y504ModbusAddress2 = 0x05; // The modbus address of the Y504const int8_t rs485AdapterPower = sensorPowerPin; // Pin to switch RS485 adapter power on and off (-1 if unconnected)const int8_t modbusSensorPower = -1; // Pin to switch sensor power on and off (-1 if unconnected) TODO Change pinconst int8_t max485EnablePin = -1; // Pin connected to the RE/DE on the 485 chip (-1 if unconnected)const uint8_t y504NumberReadings = 10; // The manufacturer recommends averaging 10 readings, but we take 5 to minimize power consumption// Create a Yosemitech Y504 dissolved oxygen sensor objectYosemitechY504 y504_1(y504ModbusAddress1, modbusSerial, rs485AdapterPower, modbusSensorPower, max485EnablePin, y504NumberReadings);//YosemitechY504 y504_2(y504ModbusAddress2, modbusSerial, rs485AdapterPower, modbusSensorPower, max485EnablePin, y504NumberReadings);That is fantastic news! It will speed up my preparations for the coming field season. Thanks for all your work!
-
AuthorPosts