Turn your Computer into an iBeacon

October 23, 2020

iBeacon technology allows Mobile Apps to understand their position on a micro-local scale, and deliver content to users based on location. It is a Bluetooth Low Energy technology.

BLE Advertising uses a one-way communication method. Beacons that want to be discovered can Advertise self-contained packets of data in set intervals. Smartphones collect these packets, which can be used for various applications to trigger things like push messages, prompts or app actions.

Beacons ideal for indoor location tracking because a standard BLE has a broadcast range of up to 100 meters.

iBeacon are defined by the Apple company including following parameters: UUID, Major and Minor

You can build your own beacon by defining your own parameter values.

What is UUID?

UUID stands for Universally Unique Identifier. It contains 32 hexadecimal digits, split into 5 groups, like this:


The UUID is a standard identifying system which allows a ‘unique’ number to be generated for a beacon network.

The purpose of the UUID is to identify iBeacons in your network, from all other possible beacons in networks not in your control.

What are Major and Minor values?

Major and Minor values are numbers assigned to your iBeacons, in order to identify individual iBeacon within your UUID network.

Minor and Major are unsigned integer values between 0 and 65535.

The iBeacon standard requires both a Major and Minor value to be assigned.

Device Needed

  • A laptop with usb port.
  • A BlueIO

*BlueIO is Bluetooth® low energy solution that can be used to create new BLE 5.0 applications in the fastest and easiest way.

How to use

Connect the BleuIO to your computer. It opens a virtual serial port (COM port) that you can use to send commands to and from the Bluetooth USB Adapter.

Image for post

Control Bluetooth USB Adapter using predefined commands that you can find on the website. click here

After connecting, you can use the following sample python script to set up your own iBeacon.

To use this scripts you will need to have Python installed. Both Python2 and Python3 should work but the scripts are made with Python3 in mind. But there are comments where the script need to be edited to work with Python2. You will also need to install the module pySerial. The easiest way to install it is through pip (which you should already have after installing Python) by running:


pip install pyserial


python3 -m pip install pyserial

Following is a sample python script for iBeacon. You can also get the source file from Github page.

  1. import serial
  2. import time
  3. connecting_to_dongle = 0
  4. print(“Connecting to dongle…”)
  5. # Trying to connect to dongle until connected. Make sure the port and baudrate is the same as your dongle.
  6. # You can check in the device manager to see what port then right-click and choose properties then the Port Settings
  7. # tab to see the other settings
  8. while connecting_to_dongle == 0:
  9. try:
  10. console = serial.Serial(
  11. port=’COM14′,
  12. baudrate=57600,
  13. parity=”N”,
  14. stopbits=1,
  15. bytesize=8,
  16. timeout=0
  17. )
  18. if console.is_open.__bool__():
  19. connecting_to_dongle = 1
  20. except:
  21. print(“Dongle not connected. Please reconnect Dongle.”)
  22. time.sleep(5)
  23. print(“\n\nConnected to Dongle.\n”)
  24. print(“\n Welcome to the iBeacon example!\n\n”)
  25. new_input = 1
  26. while 1 and console.is_open.__bool__():
  27. # get keyboard input once
  28. if (new_input == 1):
  29. # Python 2 users
  30. # input = raw_input(“Enter the UUID… “)
  31. new_input = input(“Enter the UUID (x) string with Major (j), Minor (n) and TX (t) (format:”
  32. “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxjjjjnnnntt): “)
  33. time.sleep(0.1)
  34. # sends the commands to the dongle. Important to send the \r as that is the return-key.
  35. console.write(str.encode(“AT+ADVDATAI=”))
  36. console.write(new_input.encode())
  37. console.write(‘\r’.encode())
  38. time.sleep(0.1)
  39. console.write(str.encode(“AT+ADVSTART=0;200;3000;0;”))
  40. console.write(‘\r’.encode())
  41. out = ‘’
  42. # let’s wait one second before reading output (let’s give device time to answer)
  43. time.sleep(1)
  44. while console.inWaiting() > 0:
  45. out += console.read(console.inWaiting()).decode()
  46. else:
  47. if not out.isspace():
  48. # We make sure it doesn’t print the same message over and over again by setting [out] to blankspace
  49. # after printing once and check for blankspace before print again
  50. print(“>>” + out)
  51. out = “ “

Save this script into a file called ibeacon.py
or you can name anything you like.

Now open the file using a command prompt by typing

python ibeacon.py

When you start the Python script, you should be able to see your iBeacon using a scanner App designed for Bluetooth Low Energy (BLE). Examples of scanner App can be BLE Scanner from Bluepixel Technologies.

Image for post

Here you can see is your device has started advertising.

Now you can have your own iBeacon in no time. There are many other applications you can develop yourself. It’s a simple and excellent way to learn to program Bluetooth quickly.

Share this post on :