TOP Contributors

  1. MIKROE (2750 codes)
  2. Alcides Ramos (372 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139018 times)
  2. FAT32 Library (71552 times)
  3. Network Ethernet Library (56936 times)
  4. USB Device Library (47294 times)
  5. Network WiFi Library (43002 times)
  6. FT800 Library (42291 times)
  7. GSM click (29727 times)
  8. mikroSDK (27834 times)
  9. PID Library (26845 times)
  10. microSD click (26093 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
Project

Remote Weather Station II

Rating:

0

Author: MIKROE

Last Updated: 2019-10-11

Package Version: 1.0.0.0

Category: Other Codes

Downloaded: 681 times

Followed by: 3 users

License: MIT license  

Build a small remote weather station on your beaglebone. Internet connection needed only for setup. Weather station reports current conditions via SMS, on request sent also via SMS.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Remote Weather Station II" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Remote Weather Station II" changes.

Do you want to report abuse regarding "Remote Weather Station II".

  • Information
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
Other Compiler
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

Project Blog

 

INTRODUCTION

This is a step by step tutorial how to make a remote weather station.

For this tutorial you will need :
    1. Beaglebone black
    2. MikroBUS Cape for Beaglebone
    3. Pressure2 Click board
    4. HDC1000 Click board
    5. RTC2 Click board
    6. GSM Click board (GSM2, GSM3 are useable too)

All of these things, except first the one, you can find and purchse on mikroe.com.

1. BUILDING DEVICE TREE FOR MIKROBUS CAPE

    First of all, you need to setup the device tree (DT) on your beaglebone. If you know how to do that you can skip to next section. The MikroBUS cape can support up to four Click boards at the same time.
http://www.mikroe.com/click/mikrobus-cape/

Building the DT begins with compiling a .dts file with the dtc compiler.  The output should be a .dtbo file which is a definiton of our DT :

    $ dtc -O dtb -o BB-MIKROBUS-01-00A1.dtbo -b 0 -@ BB-MIKROBUS-01-00A1.dts

Copy BB-MIKROBUS-01-00A1.dtbo file to /lib/firmware :

    $ cp BB-MIKROBUS-01-00A1.dtbo /lib/firmware

Before activating the device tree you will need to disable the HDMI port. To do that, edit /boot/uEnv.txt
    
    $nano /boot/uEnv.txt

and write the following:

     cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN

Now reboot the system and verify the HDMI is disabled by :

    $ cat /sys/devices/bone_capemgr.9/slots
    
output should be :
        
            0: 54:PF---
            1: 55:PF---
            2: 56:PF---
            3: 57:PF---
            4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
            5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
            6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN

            
No L means that device is not loaded.
    
To activate our DT without system restart :

    $ cd /lib/firmware
    $ echo BB-MIKROBUS-01:00A1 > /sys/devices/bone_capemgr.9/slots

The DT can also be activated during the boot process. If you want to do that, you will need to edit
/etc/default/capemgr :

    $nano /etc/default/capemgr

and change CAPE= line to:

    CAPE=BB-MIKROBUS-01:00A1
    
Reboot

If all has proceeded without errors, you should see the following:

    $ cat /sys/devices/bone_capemgr.9/slots

should output something like this :

            0: 54:PF---
            1: 55:PF---
            2: 56:PF---
            3: 57:PF---
            4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
            5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
            6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
            8: ff:P-O-L Override Board Name,00A1,Override Manuf,BB-MIKROBUS-01

As you can see, there is new line with our device tree. Also you sould have new
devices in /dev folder:

    $ ls /dev/spi*

 should output :

            /dev/spidev1.0  /dev/spidev1.1

    $ ls /dev/i2c*

should output :
            
            /dev/i2c-0  /dev/i2c-1

    $ ls /dev/ttyO*

should output :
            
            ttyO0  ttyO1  ttyO2  ttyO4

Now we have loaded the DT and we can proceed to the next section.

2. SETUP REAL TIME CLOCK (RTC)

    For this example we use a RTC2 click board, which is easy to setup because
the beaglebone kernel already supports the ds1307 natively.

We need to update the time on our beaglebone :

    $ cd /etc/bin
    $ ntpdate -b -s -u pool.ntp.org
    
Now load the module for RTC2 :

    $ echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device

So after the module is loaded we can write the system time to our RTC2 :

    $ hwclock -w -f /dev/rtc1
    
We can also create a service that will run each time the Beaglebone boots.

    $ mkdir /usr/share/rtc2_ds1307

and copy clock_init.sh into that folder. Then copy rtc-ds1307.service
into /lib/systemd/system/ folder, and now we can enable service :

    $ systemctl enable rtc-ds1307.service

Reboot.

3. SETUP GSM CLICK AND SMSTOOLS

    Smstools is a SMS Gateway, and best of all, free software.
    
    Setup smstools:

    $ apt-get install smstools
    
Copy provided configuration, eventheandler and binary file :

    $ cp sendsms /usr/sbin/
    $ cp smsd.conf /etc/
    $ mkdir /home/RWS
    $ cp received.sh /home/RWS/

File smsd.conf should be edited depending on which socket the mikroBUS cape you have
attached GSM click board. Under the [GSM1] part change device= to one of this

        - socket 1 - device=/dev/tty02
        - socket 2 - device=/dev/tty01
        - socket 3 - device=/dev/tty04
        - socket 4 - device=/dev/tty03

Now restart smsd :

    $ killall smsd
    $ smsd

We need to edit /etc/rc.local. Add this line before "exit 0" line :

    /usr/sbin/smsd &

This means that smsd deamon will be started on every system start.
And you should be able to a send SMS :

    $ sendsms

If you can't send a sms, you should check the /var/log/smsd.log for details.

4. INSTALL RWS APPLICATION

Copy all content of RWS folder to /home/RWS/

    $ cp * /home/RWS/

You can test the application with :

    $ node /home/RWS/index.js
    
Our application should return the current weather conditions.

When a new SMS message arrives, received.sh script will be executed.
Script call executing index.js and sends back SMS with current weather
conditions.

ALSO FROM THIS AUTHOR

Smart Sens 2 Click

0

Smart Sens 2 Click is a compact add-on board that contains a smart sensor system with an integrated IMU sensor. This board utilizes the BHI260AP, BME688, BMP390, and BMM150, an ultra-low-power programmable smart sensor, environmental and pressure sensor, and a magnetometer from Bosch Sensortec. The BHI260AP includes a powerful 32-bit MCU and a 6-axis IMU (3-axis accelerometer and 3-axis gyroscope) alongside an event-driven software framework. In addition to its internal functions also perform signal data processing from several onboard sensors performing measurements of various parameters such as an environmental and magnetic field. In addition to these primary functions, this Click board™ allows users to select the desired serial interface, use the debug interface, and select BOOT mode.

[Learn More]

DC MOTOR 7 click

6

DC MOTOR 7 click is a dual brushed DC motor driving Click board, featuring the advanced PWM chopper-type integrated DC motor driver, labeled as TB67H400AFTG.

[Learn More]

DC Motor 2 Click

0

DC MOTOR 2 Click carries the TB6593FNG driver IC for direct current motors. With two pairs of screw terminals (power supply and outputs), the Click board can drive motors with voltages from 2.5 to 13V (output current of up to 1.2 amps with peaks up to 3.2 amps) . The PWM signal drives the motor while the IN1 and IN2 pins provide binary direction signals that set the direction of the motor (clockwise or counter clockwise), or apply stop or short brake functions.

[Learn More]