Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Hackster is hosting Impact Spotlights: Smart Home. Watch now!
Michael
Published © GPL3+

Wearable cyber-deck monitor using UNIHIKER for any device

The capability of reading sensor status information from other Bluetooth or wifi enabled devices. The Other vital informations...

IntermediateWork in progress391
Wearable cyber-deck monitor using UNIHIKER for any device

Things used in this project

Hardware components

UNIHIKER - IoT Python Programming Single Board Computer with Touchscreen
DFRobot UNIHIKER - IoT Python Programming Single Board Computer with Touchscreen
×1
Lithiuim ion battery 7.8 volt
Lithium-ion battery 2S
×1
wireless charging
×1
DC/DC Converter, Buck Regulator
DC/DC Converter, Buck Regulator
LM2596 Step down buck converter
×1
USB Li Ion Battery Charger
Adafruit USB Li Ion Battery Charger
TP4056
×1

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

CAD

3D model case for the wearable cyber-deck monitor

Schematics

Simple Schematic

Here is the simple schematic diagram for the wearable cyber-deck

Code

Unihiker code

Python
Here is a sample code I used in my project. You can use it according to your needs.
import socket
from unihiker import UniHiker
import time
 
# Initialize UniHiker
uh = UniHiker()
 
# Wi-Fi Connection Parameters
ESP32_IP = "192.168.4.1"  # Replace with the ESP32's IP address
ESP32_PORT = 12345        # Replace with the ESP32's listening port
 
# Create a socket to communicate with ESP32
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(5)  # 5 seconds timeout
 
try:
    print("Connecting to ESP32...")
    sock.connect((ESP32_IP, ESP32_PORT))
    print("Connected to ESP32!")
except socket.error as e:
    print(f"Error connecting to ESP32: {e}")
    uh.screen.text("Error connecting to ESP32!", x=20, y=20, color=(255, 0, 0))
    exit()
 
def update_display(data):
    """Update the UniHiker screen with received data."""
    uh.screen.clear()  # Clear the screen
    uh.screen.text(f"Received Data:", x=10, y=10, size=20, color=(0, 0, 255))
    uh.screen.text(data, x=10, y=50, size=20, color=(0, 255, 0))
 
try:
    while True:
        # Receive data from ESP32
        try:
            data = sock.recv(1024).decode('utf-8')
            if data:
                print(f"Data received: {data}")
                update_display(data)
            else:
                print("No data received.")
        except socket.timeout:
            print("No data received (timeout).")
        time.sleep(1)
 
except KeyboardInterrupt:
    print("Exiting...")
    sock.close()
    uh.screen.text("Disconnected.", x=20, y=20, color=(255, 0, 0))

ESP32 code to connect with the Unihiker

C/C++
Here you can connect any device, and this is the way my robot connects to the unihiker.
#include <WiFi.h>
const char* ssid = "ESP32-Access-Point";    // SSID of ESP32's Wi-Fi
const char* password = "12345678";          // Password for the Wi-Fi
WiFiServer server(12345);                   // Create a server on port 12345
void setup() {
Serial.begin(115200);
// Start Wi-Fi in AP mode
WiFi.softAP(ssid, password);
Serial.println("Wi-Fi Access Point started");
Serial.print("IP Address: ");
Serial.println(WiFi.softAPIP());
// Start the server
server.begin();
Serial.println("Server started");
}
void loop() {
WiFiClient client = server.available(); // Check for incoming clients
if (client) {
Serial.println("Client connected");
while (client.connected()) {
// Send data to the client
String message = "Hello from ESP32! Time: " + String(millis() / 1000) + "s";
client.println(message);
Serial.println("Message sent: " + message);
delay(1000); // Send a message every second
}
client.stop();
Serial.println("Client disconnected");
}
}

Credits

Michael
7 projects • 6 followers
Knack for Tech and Science! Computer scientist!
Contact

Comments

Please log in or sign up to comment.