This project creates a simple connected relay using a TapNLink module and an app for access code entry. The project uses TapNLink's embedded Java Virtual Machine (JVM) as the application processor. The JVM runs a simple Java program and controls the access to a connected device such as a door lock.
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/DigiTapLock.apk: The sources for the mobile application that was automatically generated by the IoTize mobile app build server.
java/DigiTapLock.java: The Java code that is executed by the
iotize_studio/DigiTapLock.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
The main component used in this project is the TapNLink communication module. You can purchase it here..
How it Works
These pictures show the hardware. An extension cord has been cut, and each half has been connected to the relay board.
The assembled cord and relay
The relay acts as a spy between the mains plug and the load.
Inside the relay casing
Inside the plastic casing, the TapNLink module is linked with a ribbon cable to the relay.
The relay element switches the current to the device on and off.
The red cable will be replaced by a button, to ask if access is possible.
General view of the project
Java code embedded in the
JVM allows us to do an
onCheck() call each time interval (This is defined in the
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 also updates or sends an MQTT message.
- For more
javacode information, click here!
- Open the TapNLink configuration project
iotize_studio/DigiTapLock.iotzwith IoTize Studio. For more information about Studio, click here.
- In the
User internal JVMto
Yesand set the
- In IoTize Studio execute the
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.
Launching the 'DigiTapLock' App
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 is 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 access to your device.
View of the app
First, login using the admin account to access the control dashboard.
Access panelIn the Access panel, you can change the number of times remaining for access. You can set up to 21 different access codes for your device.
Control panelIn this panel, you can constrain the access to certain hours. For example, if access is enabled for 11 AM, when you press the button you will be able to access the device.
To install this version, you must unistall the wattTap app on your mobile and then install this one. This version provides:
New code input interfaceA digital keypad for code entry.
Connection preferencesThe preferences can enable the storage of the last code that was entered using the keypad. When the mobile connects to the TapNLink (NFC, BLE, or WiFi), that last code is sent automatically. You do not have to type it again.