🌈 ESP32-S3 Rainbow: ZX Spectrum Emulator Board! Get it on Crowd Supply →
View All Posts
read
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi

Following the instructions here I decided to try turning my Pi into an iBeacon.

According to the artical most Bluetooth 4.0 dongles should work so I ordered the first one I found:

dongle

And once it arrived plugged it in:

pi and dongle

To get set up we need to install some stuff:

Make sure everything is up to date

sudo apt-get update
sudo apt-get upgrade

And then install the bluetooth package (this will take quite some time as it installs a lot of stuff):

sudo apt-get install bluetooth

Restart your pi and see if your dongle is detected.

lsusb
hcitool dev

Sadly my device shows up with lsusb, but doesn’t show up in hcitool. Forcing it to load makes things work:

sudo su
modprobe btusb
echo "050d 065a" > /sys/bus/usb/drivers/btusb/new_id 
hcitool dev

Devices:
	hci0	00:02:72:C5:DE:61

To get my device to be recognised at boot time and on demand when it’s plugged in we need to add some udev rules - I found a nice guide here.

Create a new file /etc/udev/rules.d/95-belkin-bluetooth.rules

# Rules for hotplugging belkin low power bluetooth 
SUBSYSTEM=="usb", ATTRS{idVendor}=="050d", ATTRS{idProduct}=="065a", RUN="/etc/belkin_bluetooth.sh"

And another file /etc/belkin_bluetooth.sh

#!/bin/sh
modprobe btusb
echo 050d 065a > /sys/bus/usb/drivers/btusb/new_id

This file needs to be executable by root.

Now you’ve got your dongle working you can turn it into an iBeacon!

sudo hciconfig hciO up
sudo hciconfig hci0 leadv
sudo hciconfig hci0 noscan
sudo hcitool -i hci0 cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 E2 0A 39 F4 73 F5 4B C4 A1 2F 17 D1 AD 07 A9 61 00 00 00 00 C8 00

This will create an iBeacon with the uuid E20A39F4-73F5-4BC4-A12F-17D1AD07A961 and major minor version 0,0.

To monitor for this iBeacon on you would use the following code:

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.locationManager = [[CLLocationManager alloc] init];
    self.locationManager.delegate = self;
    NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"E20A39F4-73F5-4BC4-A12F-17D1AD07A961"];
    self.beaconRegion = [[CLBeaconRegion alloc]                                    
                                    initWithProximityUUID:uuid
                                    identifier:@"test"];
                                    
    [self.locationManager startRangingBeaconsInRegion:self.beaconRegion];
}

- (void)locationManager:(CLLocationManager *)manager
        didRangeBeacons:(NSArray *)beacons
               inRegion:(CLBeaconRegion *)region {
    
    if ([beacons count] > 0) {
        CLBeacon *nearestBeacon = [beacons firstObject];
        
        self.beaconInfo.text = [NSString stringWithFormat:@"%fm",nearestBeacon.accuracy];
        
        NSLog(@"%d", [nearestBeacon.minor intValue]);
    }
}

It works! (not the most exciting app I admit…)

test

Related Posts

Raspberry Pi BTLE Device - Just wrapped up the first iOSCon hackathon and had a blast tinkering with my Raspberry Pi, turning it into a full-fledged Bluetooth device in sync with an iPhone app. Used node for setting up and Bleno for creating Bluetooth low energy peripherals. Penned down each step for you to replicate, right from writing strings on my LCD to reading temperatures and getting notified of IR remote button clicks. Ran it on an app store or GitHub test application. Also, explored the Core Bluetooth framework for iOS app creation, for reading and writing data to the Raspberry Pi. Let's keep creating magic with technology!
Raspberry Pi temperature sensor - In just a bit of time, I managed to successfully get my temperature sensor, the DS18B20, up and running on my new Raspberry Pi. My starter kit even included a ready made circuit board for the sensor, making wiring a no-brainer. After following the setup instructions and inputting a few commands, voilà, my temperature readouts were coming in loud and clear. Ready to tinker around and perhaps even move the connection pin if needed.
Using ChatGPT for home automation - In another thrilling adventure with ChatGPT, I endeavored to integrate it with a Raspberry Pi, effectively turning it into my own personal light switch. My custom ChatGPT plugin, sporting just two endpoints, could revolutionize how we handle APIs, as it managed to control five different lights with simplicity and style. With a dash of YAML magic, ChatGPT managed to deduce the entire process, paving the way for future smart home projects. Big or small, the potential applications are endless and might even lead to computers communicating in human language!
ESP32 TV Version 3 - In the latest board revision, I've successfully resolved some key issues, including a USB interface conflict between the USB2244 and the ESP32 and a risky battery charging mistake—no more direct USB 5V to the battery! Plus, I managed to wrap this up without any clumsy bodge wiring. I've even introduced a new feature: a microphone is now on board, setting the stage for some exciting future projects. Stay tuned for what's coming!
Raspberry pi Infrared Receiver - In this fun tech adventure, I successfully managed to sync my infrared receiver to my Raspberry Pi. This involved correctly wiring up my IR sensor, installing and setting up LIRC, and creating a new lirc config file. I explained each step in detail and shared my major milestones, which included seeing a list of pulses when the remote was pointed at the receiver. Now my Raspberry Pi is fully controlled by my remote.

Related Videos

ESP32-TV Version 3 - Is it done? - In today's project update, I'm excited to share that my ESP32-TV boards, fresh from PCBWay, are operating flawlessly! We've successfully dealt with the USB2244 conflict with the ESP32, and the battery charging issue is now a thing of the past. We've also made some awesome additions like a microphone to our board. The real MVP though, is the USB2244 chip that’s given us significantly improved read/write speeds - making it perfect for handling video files. Next on the agenda, figuring out a solution for the non-standard display connector. As ever, there’s progress, there’s problems, and there's David Bowie animated gifs!
Lots of Stuff - And a NEW PCB! It's a rare mailbag video. - In today's episode, I'm unboxing some goodies from PCB way - my super tiny esp32 breakout boards, which I'm planning to use to recreate a mini TV complete with speakers and a display. Also received some convenient adapter boards for easier testing. Excited to explore a new Arduino Nano esp32 based on a different, tinier module, and contrasting it with other products like the Tiny Pico. Also up for testing is a new mini wear electronic load compared to my old one, and an ATX power adapter for more USB ports. I'll be testing power banks, playing with inexpensive yellow displays and nunchucks for fun gaming projects, and testing out an RGB bead curtain with hackable possibilities. Also, under my ongoing experiments is a Raspberry Pi zero, turning into a 'Doom' playing device with added sound and game controllers. Finally, an air quality measuring device for detecting air particles, CO2 levels, humidity, temperature and other parameters is up for exploration as well. A whole array of fun projects queued up, so stay tuned!
ESP32-S3 USB UAC Audio Device - does it work? - Time for an audio project: I took my PCBWay ESP32‑S3 board for a spin—fixed the common anode/cathode LED mix‑up, verified the IMU and battery charger, then tested an I2S PDM mic and tiny speaker with a Web Serial Audio Studio (scope, spectrogram, tuner). I also turned it into a USB UAC device in ESP‑IDF: the mic is clean, but speaker over UAC is crackly (Mac/Windows toggle oddity); direct I2S WAV playback is perfect, so the hardware passes QA.
Unlocking the Power of ChatGPT: Effortlessly Generate Arduino Code for Your Projects! - Witness ChatGPT's impressive potential for generating working Arduino code, as demonstrated in a step-by-step ESP32-based project utilizing a potentiometer and dot star LED.
Easy S3 PCB and Schematic - it’s really simple. - In this video, I explore the functions of my newly arrived little boards - essentially a PCB that an esp32 S3 room module can be connected to. I put the board's voltage regulator, battery charger, and a 3 watt class D amplifier to the test, and damn, they work perfectly! I even use breadboards, connecting them together to facilitate a wider workspace. I gave the pcbs a spin, conducting sanity checks to ensure full functionality. With a successful battery charge and impressive voltage measurements, my PCB's are up to the challenge. I also dabble in some circuit jargon, explaining schematics, amplifiers, battery chargers and a clever mosfet approach. To top it off, I solder on an ESP32 module and prove that yes, it actually works. Stay tuned for a following video where we'll work with a speaker and display!
HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
Blog Logo

Chris Greening


Published

> Image

atomic14

A collection of slightly mad projects, instructive/educational videos, and generally interesting stuff. Building projects around the Arduino and ESP32 platforms - we'll be exploring AI, Computer Vision, Audio, 3D Printing - it may get a bit eclectic...

View All Posts