This project implements TapNLink in a relay, so that the state of the relay can be changed from a mobile app. The project uses TapNLink's embedded Java Virtual Machine (JVM) as the application processor. The JVM runs a simple Java program to control the relay.
Note: Before starting, learn how TapNLink and the associated tools work in this Getting Started.
This project is on, Github !
The project has 4 folders:
app_generated/TimerSwitch.apk: The sources for the mobile application that was automatically generated by the IoTize mobile app build server.
java/TimerSwitch.java: The Java code that is executed by the
iotize_studio/WattTap.iotz: The IoTize Studio configuration file that is used to configure the TapNLink for this demo.
doc: The illustrations and the readme file for the java code.
The main components of this project, and where you can purchase them are:
TapNLink communication module is available from these distibutors.
Plastic casing is available here.
These pictures show the hardware. An extension cord has been cut and each half has been connected to the relay board.
Assembly of the relay
The relay acts as a switch between the mains plug and the load.
Inside of the relay casing
Inside the plastic casing, the TapNLink module is linked to the relay with a ribbon cable.
The relay element switches the current to the device on and off.
General view of the project
Java code embedded in the
JVM allows us to do an
onCheck() call at each time interval (This interval is defined in a
TapNLinkVar construct). With this
onCheck() method, by verifying that the provided
id corresponds to the desired
id, we will be able to perform data recovery tasks. The
TapNLinkVar value updates or sends an MQTT message.
- For more
javacode information, click here !
- Open the TapNLink configuration project
iotize_studio/TimerSwitch.iotzwith IoTize Studio. For more information about IoTize Studio, click here.
- In the
User internal JVMto
Yes, and set the
- In IoTize Studio execute
javabuild to generate the
- Configure your
- Setup the connection to your TapNLink
- Click on the
Configurebutton and wait for the end of the configuration process.
- Reboot the TapNLink to apply the new configuration.
- Because this app has not been published on app stores, you have to install it manually. See how this is done here.
- After your circuit is properly connected, and your TapNLink configured, launch the mobile app. The fastest way is to approach your mobile phone (with NFC enabled) to the plastic casing. NFC will launch the app and connect the mobile to the TapNLink automatically.
TapNLink, you can now monitor and control the relay status.
Defining the mode in the State panel allows you to either force the state of the relay (On/Off), or to set it to Auto so that the system manages the state according to a daily set up.
Pressing the button to manually change the state to On has priority. Pressing the button switches the state to On for the amount of time that is defined in the Access panel.
Manual On duration and progress
This option makes it possible to automatically return to Auto mode at the change of the hour. When Automatic Run is active, the mode is retrieved from the daily setup at the change of the hour.
Return to Auto mode