Emulating USB Protocol over BLE for Data Transfer

As the Internet of Things (IoT) continues to grow, the need for efficient and reliable data transfer between devices has become increasingly important. One approach to achieve this is by emulating the Universal Serial Bus (USB) protocol over Bluetooth Low Energy (BLE) technology. In this blog, we will explore the concept of emulating USB protocol over BLE and provide a detailed implementation guide for computer enthusiasts. Introduction to BLE and USB BLE is a wireless personal area network technology that allows devices to communicate with each other over short distances. It is commonly used in IoT devices, wearables, and other low-power applications. USB, on the other hand, is a widely used interface standard for connecting devices to a computer. Emulating USB Protocol over BLE To emulate the USB protocol over BLE, we need to create a virtual USB device on the BLE device and configure it to communicate with the computer as if it were a physical USB device. This involves creating a BLE service that mimics the USB device’s behavior, including its interface, endpoints, and device class. Hardware and Software Requirements To implement this project, you will need the following hardware and software components: A BLE module (e.g., nRF52832 or CC2541)A microcontroller (e.g., STM32 or Arduino)A USB device (e.g., USB storage device or USB serial device)BLE module’s SDK (e.g., nRF5 SDK or CC2541 SDK)Microcontroller’s development environment (e.g., Keil µVision or Arduino IDE)USB device’s driver program (e.g., USB storage device driver or USB serial device driver) Implementation StepsStep 1: Create… Read more

Feeling bad and sad

As I sat in my office, staring blankly at the computer screen in front of me, I couldn’t help but feel a sense of disappointment and frustration wash over me. It had been a month since I was passed over for the position of R&D Director, a role I had been gunning for years. The memory of that day still lingered vividly in my mind, like an open wound that refused to heal. I had worked tirelessly as an R&D engineer for years, pouring my heart and soul into every project I took on. I had always been driven by a passion for innovation and a desire to make a meaningful impact on the industry. My hard work and dedication had paid off, earning me a reputation as one of the most skilled and respected engineers in the company. So, when the opportunity to become the R&D Director arose, I knew I had to go for it. I spent countless hours preparing for the interview, rehearsing my answers, and fine-tuning my presentation. I was confident that I had the skills, experience, and vision to lead the R&D team to new heights. But when the news came that I didn’t get the job, I was devastated. It felt like a punch to the gut, leaving me breathless and disbelieving. How could they not see my value? Hadn’t I proven myself time and time again? The questions swirled in my head like a vortex, pulling me down into a dark abyss of… Read more

Generating Heat Maps for eye-tracker data

A heat map is a graphical representation of data where the individual values contained in a matrix are represented as colors. –Wikipedia  Concept Here is my approach to deal with it. All that is need is a frequency of a value being repeated in case of one dimension and then creating a color  map for high to low and plotting them on a graph. Problem statement For eye tracking data, we are dealing with a 2d data of x and y points. In the experiement there are squares of size 3.4cm. They are arranged in 10 colomns and 6 rows. We want to see in which of those squares are hit more frequently and produce a heatmap. Experiment data For the hits, we have the data from the participant eye tracking. After some manipulations from the eye tracker raw data, we get points x and y. Here we are not using time series analysis so time stamps are not required. The experiment uses a specific eye tracker but the data is saved using python and the format of the data looks like the following TimestamptTriggertLeftValiditytRightValiditytLeftXtLeftYRigthXtRightY Data from userXX trialXXX [wpdm_file id=3] Solution code positions <- read.table(“http://blog.southpaw.in/?wpdmact=process&did=My5ob3RsaW5r”) br.x <- seq(-23.5, 23.5, length.out=10) br.y <- seq(-16.1, 16.1, length.out=6) int.x <- findInterval(positions[,1], br.x) int.y <- findInterval(positions[,2], br.y) #See footnote int.x <- factor(int.x, levels=10) int.y <- factor(int.y, levels=6) tb <- table(int.x, int.y) image(br.x, br.y, tb, xlab=”X”, ylab=”Y”, las=1, main=”Heat map”) Conclusion The image generated can be interpreted as red with low frequecy or almost no… Read more

Installing MEAN stack for Fullstack application development

The best one liner for what MEAN stack is given in the following picture. MEAN stack is more like LAMP. M = MongoDB E = ExpressJS A = AngularJS N = NodeJS MEAN Stack Logo There has been a lot of development from Google for the AngularJS and NodeJS. They are minimalistic and javascript based, for now cutting edge web development tools. For installing MEAN stack in ubuntu, follow the commands to set up your MEAN Stack. I deployed my server in Digitalocean which is like my obsessed service for cloud deployment. Install MongoDB #~ sudo apt-get install mongodb Install NodeJS and Npm #~ sudo apt-get install nodejs npm and create a symlink #~ sudo ln -s /usr/bin/nodejs /usr/bin/node Install Bower #~ sudo npm install -g bower Install Grunt #~ sudo npm install -g grunt-cli Install MEAN sudo npm install -g mean-cli Init your first App $ mean init testApp type in your IPaddress with port 3000 http://xxx.xxx.xxx.xxx:3000

It could not have been better! Its just gonna get better!

That moment! few hours before the new years! A probable feel of dashing adrenaline because of It could not have been better! Its just gonna get better! An amazing page in the book of time where a year is a a sheet smeared with melancholic emotions, careless decisions, withering memories, inspirational failures and motivational achievements. Incredible year with the force awakening in the end! There is a stir to settle down! got stirred, probably will settle down… looking ahead for the future. Its all about the vibes and the motions!  

Key2.0: Open Source Bluetooth IoT Door Lock

What is Key 2.0? Key 2.0 (or Key20 for short) is a Bluetooth IoT Door Lock controller. It turns a conventional electric door lock into a smart door lock that can be opened using a smartphone without the need for a physical key. Thus, Key20 is the modern version of a physical key, or, as the name suggests, the key version 2.0 for the Internet of Things (IoT) era. Key20 consists of two parts: Key20 door lock controller device, which is physically connected to the electric door lock and wirelessly via BLE to the mobile app. Key20 mobile app implementing the user interface to unlock the door and communicating with the door lock controller through BLE. [ Mobile Phone w/ ] [ Key20 App ] | | Bluetooth Low Energy (BLE) Connection | |—[ Key20 Door Lock Controller ]—[ Electric Door Lock ]—| | [ Device ] | | | | | | | |———————-(Voltage Source)———————–| ( 12 VAC ) The following image shows the Key20 door lock controller device and the Key20 app running on a smartphone. You can get a quick impression on how Key20 works watching the following video: Key 2.0 Video The main features of Key20 are: Using state-of-the-art security mechanisms (Elliptic Curve Diffie-Hellman Key Exchange (ECDH), HMAC) to protect against attacks. Open-source software and hardware, including an open implementation of the security mechanisms. No security by obscurity! Source code for the app and door lock controller as well as Eagle files (schematic and board layout)… Read more

My Frustrating Experience with Ghost’s Blog Editor

It’s hard to believe it’s been over six months since I started using Ghost as my blogging platform of choice. At first, I was thrilled with its simplicity and ease of use. The minimalistic design and user-friendly interface made it a breeze to create and publish blog posts. However, as time went on, I began to notice that the shine was wearing off. Specifically, I found myself growing increasingly frustrated with Ghost’s blog editing functionality. At first, it was the little things. The inability to easily format text, the lack of a decent spell-checker, and the clunky image upload process. But as I continued to use Ghost, these minor annoyances snowballed into major headaches. I found myself spending more and more time wrestling with the editor, trying to get my posts to look the way I wanted them to. One of the biggest issues I have is with the title editing feature. It’s surprisingly finicky, and I often find myself having to re-enter the title multiple times before it sticks. And don’t even get me started on the auto-save feature, which seems to have a mind of its own. I’ve lost count of how many times I’ve accidentally overwritten a post because the auto-save kicked in at the wrong moment. But the real deal-breaker for me is the lack of a decent WYSIWYG editor. I’m not a coder, and I shouldn’t have to be one to create a decent-looking blog post. The fact that I have to switch back and… Read more

Learnings from analysing my compromised server

Returning back home. I get this buzz on my phone. Turns out it’s an email from Linode. Daym. I thought was I billed already? Trust me on this, I was really not sure what to do of this for the first two minutes when I read the email. I opened the Linode admin panel to check out what was my server up to. And the CPU graph had jumped off the hooks. Same was the case with the network graph Looking at the network log’s suggested a high amount of outbound traffic coming from my server, further cementing the Linode support ticket that I got. I ssh’d inside my server to see what was going on. I will be damned. I don’t remember sleep typing my password continuously for that long! Let me tell you, you don’t do a cat /var/log/secure at this point as the file would just be spit continously at you with no end of stopping. Did head (even a tail can do) to it. Going through the start of the file, everything was fine until I started to see the extremely less epoch time between two failed attempts. This confirmed my hunch that some script kiddie was trying to brute force through the root user login. /var/log/secure Fulled to brim I know, I should have disabled root login at the start and used ssh-keys to access my server. But I just delayed it to be done the next day. My fault. The logical thing now would be to start iptables (or) ufw and block outbound traffic as well… Read more

Compiling Contiki for CC1350

Setup: macOS 10.13.5 VM – VirtualBox Guest OS: Ubuntu 16.04 Setup Contiki on the local machine: Install the following packages. you might need sudo right. # sudo apt-get remove gcc-arm-none-eabi gdb-arm-none-eabi binutils-arm-none-eabi # sudo add-apt-repository http://ppa:team-gcc-arm-embedded/ppa # sudo apt-get update Compile Contiki hello-world for Native: Native means that your code will compile and run directly on your host PC. for me, it will run on the Ubuntu 16.04 OS on the VM. cd into your development folder. # git clone https://github.com/contiki-os/contiki # cd contiki/examples/hello-world # make TARGET=native mkdir obj_native   CC        ../../core/ctk/ctk-conio.c   CC        ../../platform/native/./contiki-main.c   CC        ../../platform/native/./clock.c   CC        ../../core/dev/leds.c ### output truncated ###   AR        contiki-native.a   CC        hello-world.c   LD        hello-world.native rm hello-world.co The target command tells the compiler to compile for the current system. This is what is later changed for cross compiling to our target platform. Type the following command to run the hello-world program. # ./hello-world.native Contiki-3.x-3343-gbc2e445 started with IPV6, RPL Rime started with address 1.2.3.4.5.6.7.8 MAC nullmac RDC nullrdc NETWORK sicslowpan Tentative link-local IPv6 address fe80:0000:0000:0000:0302:0304:0506:0708 Hello, world if this is how it worked! your compilation worked! Compiling Contiki-OS for CC13xx The only thing to be changed is the target. make clean is an important step. make clean make TARGET=srf06-cc26xx BOARD=sensortag/cc1350 this says the compilation works if you see the following: CC ../../cpu/cc26xx-cc13xx/lib/cc13xxware/startup_files/ccfg.c CC ../../cpu/cc26xx-cc13xx/./ieee-addr.c AR contiki-srf06-cc26xx.a CC ../../cpu/cc26xx-cc13xx/./fault-handlers.c CC ../../cpu/cc26xx-cc13xx/lib/cc13xxware/startup_files/startup_gcc.c CC… Read more

TI CC2530DK – Contiki OS – Internet of Things

This blog post is an effort to create a one stop information for starting off your Contiki project with cc2530DK. There is enough information already available on Github wiki. This post is more than an extension to have all information under one place and as usual my way of documenting my projects! [toc] Getting started Installation – Ubuntu I am assuming that you already have a system installed with Ubuntu. My suggestion would be to do it on a Virtual machine. I am using VirtualBox Installing Contiki The easiest way is to use [viraldownloader id=211 text=’InstantContiki 2.7′]. The longer description of how to install on your existing virtual machine (vm) is also available at the bottom. Steps for firing up your instant contiki 2.7 Install vmware since the guest operating system is in VMDK and Vmx files [viraldownloader id=212 text=’vmplayer’] Start the VM instance and Contiki comes already installed. Steps for installation Install the following packages: Copy paste the following in your terminal. You need root access to perform this. sudo apt-get install build-essential binutils-msp430 gcc-msp430 msp430-libc binutils-avr gcc-avr gdb-avr avr-libc avrdude openjdk-7-jdk openjdk-7-jre ant libncurses5-dev doxygen git gtkterm This will allow you to cross-compile for MSP430- and AVR-platforms. Clone the Contiki sources from Github: git clone git://github.com/contiki-os/contiki.git contiki This is all about installing contiki. There is one more step where you will install SDCC to compile for 8051 devices. Installing SDCC to compile for cc2530/1 devices As always, first step is to install the pre-requisites. Copy paste the following in your terminal. sudo… Read more