This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Miniam Weather Sensor / baro & temperature calibration
#1
Hello All,

The question is about the Minimal Weather Sensor from Sean's store : what is the procedure to calibrate the offsets for the barometer and temperature sensor (BMP280).

The setup is as follows : the minimal weather sensor is pluged to USB on a linux box (openplotter) and identified as /dev/ttyUSB0 (cat /dev/ttyUSB0 shows the expected NMEA0183 output).

It seems from looking at the arduino code (https://github.com/pypilot/pypilot/blob/...ensors.ino) that sending "\r" character (carriage return) to /dev/ttyUSB0 is expected to lead to a configuration over serial but this seems to fail when I try (using the echo command or minicom).

Would someone have a hint on the subject ?

Best regards,

Xavier.
Reply
#2
I've not got one or used one, but I have had a quick look at the code.

What do you get if you send config <CR> ? i.e. the word config followed by a carriage return
Reply
#3
type "config" and hit enter should but only if up manage to update the software this is recently added.
Reply
#4
Hi,

Here follows the code used for testing:

Code:
#!/bin/bash

# Testing of Minimal Weather Sensor config

tmpFile=/tmp/ttyDump.dat
ttyOut=ttyUSB0
speed=38400

stty -F /dev/$ttyOut $speed raw -echo
exec 3</dev/$ttyOut
 cat <&3 > $tmpFile &
 sleep 2s
 PID=$! # Cat PID
   #echo -ne "config\r" > /dev/$ttyOut
   printf 'config\r' > /dev/$ttyOut
   sleep 2s
 kill $PID
 wait $PID 2>/dev/null

exec 3<&-
cat $tmpFile
And here follows the output:

Code:
Sensor type:1
Calibration valid  131  884
bmX280 setup
$ARMWV,4.08,R,0.00,N,A*22
$ARMWV,4.92,R,0.00,N,A*21
$ARMWV,4.98,R,0.00,N,A*2b
$ARMWV,5.02,R,0.00,N,A*29
$ARMWV,4.94,R,0.00,N,A*27
$ARMWV,5.05,R,0.00,N,A*2e
$ARMWV,4.93,R,0.00,N,A*20
$ARMWV,4.90,R,0.00,N,A*23
$ARMWV,4.82,R,0.00,N,A*20
$ARMWV,4.77,R,0.00,N,A*2a
$ARMWV,4.76,R,0.00,N,A*2b
$ARMWV,4.78,R,0.00,N,A*25
$ARMWV,4.84,R,0.00,N,A*26
$ARMWV,4.77,R,0.00,N,A*2a
$ARMWV,4.76,R,0.00,N,A*2b
$ARMWV,4.76,R,0.00,N,A*2b
$ARMWV,4.76,R,0.00,N,A*2b
$ARMWV,4.76,R,0.00,N,A*2b
$ARMWV,4.76,R,0.00,N,A*2b
$ARMWV,4.76,R,0.00,N,A*2b
$ARMWV,4.76,R,0.00,N,A*2b
$ARMWV,4.76,R,0.00,N,A*2b
$ARMDA,,,0.98875,B,,,,,,,,,,,,,,,,*3c
$ARMTA,26.92,C*29
$ARMWV,4.76,R,0.00,N,A*2b
$ARMWV,4.76,R,0.00,N,A*2b
$ARMWV,4.76,R,0.00,N,A*2b


From Sean's answer and should the printf command be correct, I guess I must load the updated code to the arduino. Will dive into this and report.

Best regards,

Xavier.
Reply
#5
I use minicom.. the configuration here is interactive.
Reply
#6
(2021-10-02, 06:10 PM)seandepagnier Wrote: I use minicom..  the configuration here is interactive.

Sean,

I used minicom too ; the result is the same : ignoring when typing config followed by return.

I tried to compile the last version of weathersensor.ino but run into troubles:
Code:
git clone https://github.com/pypilot/pypilot
cd ./pypilot/arduino/weathersensors

I edited the code to set LCD (the minimal weather sensor has no LCD)
Code:
#define LCD NONE
//#define LCD NOKIA5110L
//#define LCD JLX12864G

And then make (note: compilation on debian)
Code:
make
Various outputs but ended with the following:
Code:
cp weathersensors.ino obj/weathersensors.ino.cpp
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard  -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility  -I/usr/share/arduino/libraries/SPI -I. -c obj/weathersensors.ino.cpp -o obj/weathersensors.o
obj/weathersensors.ino.cpp: In function ‘void setup()’:
obj/weathersensors.ino.cpp:266:13: warning: variable ‘div’ set but not used [-Wunused-but-set-variable]
    uint8_t div = 1;
            ^
obj/weathersensors.ino.cpp: In function ‘void read_anemometer()’:
obj/weathersensors.ino.cpp:670:14: error: conflicting declaration ‘uint16_t count’
    uint16_t count = rotation_count;
             ^
obj/weathersensors.ino.cpp:516:13: note: previous declaration as ‘int16_t count [3]’
    int16_t count[3];
            ^
obj/weathersensors.ino.cpp:678:13: warning: the address of ‘count’ will always evaluate as ‘true’ [-Waddress]
    if(count) {
            ^
obj/weathersensors.ino.cpp:680:54: error: invalid operands of types ‘double’ and ‘int16_t [3] {aka int [3]}’ to binary ‘operator*’
            float newknots = .868976 * 2.25 * 1000 * count / period;
                                                     ^
make: *** [Makefile:67: obj/weathersensors.o] Error 1

I look at the code and indeed coutn is declared two times as an int array and then as unsigned int. Not sure why.

Sean, if you have some guidance, I'll take it.

Best regards,

Xavier.

OK ; very bad hack : I have replaced count by count1 in lines 670, 678 and 680 and compiled via make with only warnings ; make upload worked as expected upolading to the arduino.

minicom has been used and I now have access to config.

Sean, could you comment on the count variable ?

Best regards,

Xavier.
Reply
#7
sorry, thanks for reporting it.

I fixed it now.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)