sketchbook
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
BlinkingSwitch_SWBB-TL.ino File Reference

Switch/Tunnel for ThroughLoRa-SoftwareBitBang. More...

#include <avr/wdt.h>
#include <PJONInteractiveRouter.h>

Macros

#define BUILTIN_LED   LED_BUILTIN
 
#define SERIAL   Serial
 
#define OWPJON_PIN   4
 
#define PJON_INCLUDE_TL
 
#define PJON_MAX_PACKETS   3
 

Functions

PJONInteractiveRouter
< PJONVirtualBusRouter
< PJONSwitch > > 
router (2,(PJONAny *[2]){&bus1,&bus2})
 
void setup ()
 
void loop ()
 
void sendnotification_function (const uint8_t *const payload, const uint16_t length, const uint8_t receiver_bus, const uint8_t sender_bus, const PJON_Packet_Info &packet_info)
 

Variables

unsigned long time_last_message
 
StrategyLink< SoftwareBitBang > link1
 
StrategyLink< ThroughLora > link2
 

Detailed Description

Switch/Tunnel for ThroughLoRa-SoftwareBitBang.

Author
drtrigon
Date
2018-08-08
Version
1.1
  • added missing default to switch cases
  • added watchdog for recovery from heavy failures
  • changed LoRa frequency/channel
1.0
See Also
https://github.com/gioblu/PJON/tree/master/src/strategies/ThroughLoRa
* OneWire PJON Generic "OWPG" scheme:
*   @ref OWPJON/LINUX/Local/LocalUDP/RemoteWorker/DeviceGeneric/DeviceGeneric.cpp
* For isolated remote SWBB networks on the same bus use e.g. LoRa and setup 2 tunnels/switches
*   OWPJON/ARDUINO/Local/SoftwareBitBang/Tunneler/BlinkingSwitch_SWBB-TL/ (this sketch)
*
* Compatible with: atmega328 (Uno, Nano, Uno/Yun combo Dragino LG01-S), atmega32u4 (Yun)
*
* Pinout:
*   1wire PJON data bus (OWPJON SWBB):
*        1WIRE DATA    -> Arduino Pin D4
*        GND black     -> Arduino GND
*   1wire Sniffer/Master/Client Shield
*   Dragino Lora Shield Shield or Dragino LG01-S
*   @see https://github.com/gioblu/PJON/tree/master/src/strategies/ThroughLoRa#supported-shieldsmodules
*
* Dragino LG01-S:
*   - Dragino is recognized as "Yun" but contains an "Uno" (m328p); select "Arduino/Genuino Uno"
*     @see http://192.168.11.16/cgi-bin/luci//admin/sensor/mcu
*     correct but not needed would be to use
*     http://www.dragino.com/downloads/downloads/YunShield/package_dragino_yun_test_index.json
*     and select "Dragino Yun + UNO or LG01/OLG01"
*   - Disable Dargino wifi; like Yun use WebInterface to configure LAN, DHCP, DISABLE WIFI
*     also see comments, hints, etc. in @ref Yun_Dragino_Server_LoRa_WAN/Yun_Dragino_Server_LoRa_WAN.ino
*   - Bidirectional Level Shifting 3.3V<->5V needed for SWBB; 3v6 Zener and 4k7 resistor voltage divider
*     (consider using @ref OWPJON/ARDUINO/Local/SoftwareBitBang/Tunneler/BlinkingSwitch_3way/BlinkingSwitch_3way.ino
*     to isolate 3.3V and 5V bus from each other - also consider LUDP-SWBB-TL 3way tunnel)
*     @ref OWPJON/README.md
*     @see http://vusb.wikidot.com/hardware
*     @see http://www.partsim.com/simulator/#148247
*   - LoRa tx power 10..17 dBm; @see https://www.digitalairwireless.com/articles/blog/wifi-transmit-power-calculations-made-simples
*   - LoRa settings vs. datarate; @see http://www.rfwireless-world.com/calculators/LoRa-Data-Rate-Calculator.html
*   - LoRa settings for max. datarate; lowest SF, CR - highest BW. For max. range; highest SF, (CR for reliability) - lowest BW
*   - LoRa frequency and debug; scan for free before using, @see Uno_Serial_LoRa_Sniffer/Uno_Serial_LoRa_Sniffer.ino
*   - Debug Dragino; @see http://www.dragino.com/downloads/downloads/YunShield/YUN_SHIELD_QUICK_START_GUIDE_v1.0.pdf
*                    For reboot via network @see http://192.168.11.16/cgi-bin/luci//admin.
*
* Test on Ubuntu or Raspberry Pi Server (owpshell) confer the docu of
* following files:
*   - @ref OWPJON/LINUX/Local/LocalUDP/RemoteWorker/DeviceGeneric/DeviceGeneric.cpp
*   - @ref OWPJON/LINUX/Local/ThroughSerial/RemoteWorker/DeviceGeneric/DeviceGeneric.cpp
*
* Thanks to:
* gioblu - PJON 11.0 and support
*          @see https://www.pjon.org/
*          @see https://github.com/gioblu/PJON
* fredilarsen - support
* Matheus-Garbelini - support
* 

Macro Definition Documentation

#define BUILTIN_LED   LED_BUILTIN
#define OWPJON_PIN   4
#define PJON_INCLUDE_TL
#define PJON_MAX_PACKETS   3
#define SERIAL   Serial

Function Documentation

void loop ( void  )

OneWirePJON device status update function.

Returns
(void)
PJONInteractiveRouter<PJONVirtualBusRouter<PJONSwitch> > router ( ,
(PJONAny *[2]){&bus1,&bus2}   
)
void sendnotification_function ( const uint8_t *const  payload,
const uint16_t  length,
const uint8_t  receiver_bus,
const uint8_t  sender_bus,
const PJON_Packet_Info &  packet_info 
)
void setup ( void  )

Arduino IDE: put your setup code here, to run once.

Variable Documentation

PJONAny bus1& link1
PJONAny bus2& link2
unsigned long time_last_message