It consists of reading a Watermark sensor with a pic16, then use an embedded system STM32f with NuttxOS installed to send the data obtained from the sensor through an xbee device based on Zigbee to a server, then the server sends the data to the Altair Smartcore platform through Paho MQTT.
gcc -o server server.c -lxbee -ljson-c -lpaho-mqtt3c
gcc -o serialport serialport.c -lxbee -ljson-c
json-c
sudo apt-get install libjson-c-dev
libxbee
git clone https://github.com/attie/libxbee3
cd libxbee3
make configure
make all
sudo make install
paho mqtt
sudo apt-get install build-essential gcc make cmake cmake-gui cmake-curses-gui
sudo apt-get install fakeroot fakeroot devscripts dh-make lsb-release
sudo apt-get install libssl-dev
sudo apt-get install doxygen graphviz
git clone https://github.com/eclipse/paho.mqtt.c
cd paho.mqtt.c
make
sudo make install
Xbee modules configuration using XCTU
Firmware Zibgee th v4060
Coordinator (server side)
PANid 1234
CE 1
Api mode 1
Router(serialport side)
PANid 1234
JV 1
Transparent mode 0
Packages needed
sudo apt-get install automake bison build-essential flex gcc-arm-none-eabi gperf git libncurses5-dev libtool libusb-dev libusb-1.0.0-dev pkg-config minicom
mkdir nuttxspace/
cd nuttxspace/
OpenOCD needed
git clone http://repo.or.cz/r/openocd.git
cd nuttxspace/openocd/
./bootstrap
./configure --enable-internal-jimtcl --enable-maintainer-mode --disable-werror --disable-shared --enable-stlink --enable-jlink --enable-rlink --enable-vslink --enable-ti-icdi --enable-remote-bitbang
make
sudo make install
cd nuttxspace/
git clone https://bitbucket.org/nuttx/nuttx
git clone https://bitbucket.org/nuttx/apps
git clone https://bitbucket.org/nuttx/tools
cd nuttxspace/tools/kconfig-frontends/
./configure
make
sudo make install
sudo ldconfig
cd nuttxspace/nuttx/tools/
./configure.sh stm32f103-minimum/nsh
cd nuttxspace/nuttx/
make menuconfig
system type >>smt32 peripheral support >>usb device activado
board selection >>enable boardctl() interface activado, enable usb device controls activado
device drivers >>usb device driver support >>usb modem cdc/acd >>cdc/acd console device activado
device driver >>serial driver support >>no serial console
system type>>smt32 peripheral support >>usart1 activado
device drivers>>serial driver support>>usart1 configuration>>9600 baud rate
application support >>examples >>serial rx example activado, moisture app example activado
(moistureapp_main.c, Makefile, Kconfig and Make.defs need to be in a folder inside Nuttx examples)
cd nuttxspace/nuttx/
make
cd nuttxspace/openocd/contrib/
sudo cp 60-openocd.rules /etc/udev/rules.d/
sudo udevadm trigger
cd nuttxspace/nuttx/
openocd -f interface/stlink.cfg -f target/stm32f1x.cfg
openocd -f interface/stlink.cfg -f target/stm32f1x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx.bin 0x08000000"
sudo minicom -s
serial port setup>>
A-serial device /dev/ttyACM0
E-Bps/Par/Bits: 9600 8N1
F-hardware flow control no
save setup as dfl
nsh> ?
nsh> ls dev/
nsh> cat dev/ttyS0