jenswilly.dk


iBeacons ready

UPDATE: BLE112 firmware source code can be downloaded here: BLE112 iBeacon firmware. It should be pretty well documented so please try to figure it out yourself before asking :)


Here's a snap of the first two "production" iBeacons (not really production models but a lot prettier than the previous mess-o-wires prototype). They are based on BLE112 Bluetooth modules and contains nothing more than a coin cell battery, a tiny DIP switch for configuring the device identifier without re-flashing the firmware, a capacitor and a diode for reverse polarity protection when external power is used instead of the coin cell battery. And a BLE112 module, of course.

Click for larger image

Click for larger image

Schematics

Here are the Eagle files for schematic and board:

iBeacon_schematic

Firmware

The firmware source code can be downloaded here: BLE112 iBeacon firmware.


81 comments on "iBeacons ready"
frank says:

Would really love to test this out! When do you expect that you can disclose more details?

Jens Willy Johannsen says:

As soon as Apple makes the iBeacon protocol public. I expect them to do that when iOS 7 is released (which is very soon).

frank says:

Thank you for your prompt response! looking forward to it..

encomCTO says:

Will you be selling these? or just positing info on how to create your own?

Jens Willy Johannsen says:

Hi. No, I won't be selling them. This is just info for people who want to make their own.

Serge says:

Great Job,

I believe you could release the firmware in the form of a Hex file without compromising the NDA.
Secondly from what I can tell you did not sign an NDA since you said you reverse engineered it with the sniffer.

Nice work.

Best,
Serge

Jens Willy Johannsen says:

Hi Serge. Since I'm an iOS developer I have signed an NDA saying I can't release details about iOS 7 until that information is publicly released.
But maybe I could release the source code or firmware and maybe I couldn't. I've chosen not to do it until Apple has released the information. But as soon as Apple releases the information, I will post both source code and compiled firmware here.

Serge says:

OK no worries.

Thanks,
Serge

Bill Anderson says:

Phenomenal work, thanks for sharing!

I'm extremely excited about the possibilities iBeacons offers.

Bill

kre says:

I really like what you have done here! Any chance you can post the firmware now that iOS 7 has been officially released? Much thanks for all of your hard work!

Hi Jens, really good work! We're attempting to recreate the packets for iBeacon and would love to see what you've found. The NDA for iOS 7 has been lifted now, so hopefully that means you're able to release it? Thanks in advance.

Matteo says:

Any news on this topic?
I'm very interested to know what you've done!

Best regards,
Matteo

frank says:

same here :)

Josep Alemany says:

Now, that iOS 7 was released, could you share all the information? Thanks in advance!

Regards, Josep Alemany

Hernando says:

Hi, great work .. Why is apple taken so long to release more info ..

Matteo says:

Any comment on why you are not releasing the informations now that the NDA has dropped?
It would be interesting to know if you've changed your mind...

Thanks in advance.

Svet says:

Hi, one more vote for releasing your BGscript please :-).

Jens Willy Johannsen says:

Firmware source code is now available for download. The link is at the top of the post.

Svet says:

Thank you!

Matteo says:

Thanks!

Elango says:

Is there any way to simulate iBeacon from my iMac bluetooth to test the functionality?

Hi Jens,

Quick question - is the only thing that differentiates an iBeacon from a generic BLE device the manufacturer data #1aFF and the pre-amble ($4C00 0215) in the advertisement? (I mean other than the device's UUID... )

regards,
David

Ronny Khan says:

Hi.
Due to my lack of understanding what is the UUID and the identifier used in your firmware ? Like Estimote which uses it's own UUID and "Estimote Region". I have tried a best effort here, but since I'm not really sure about the token or my own code here, this information would be very useful to try to eliminate the number of variables when debugging.. :-)

Jens Willy Johannsen says:

@Elango: No idea. You can do it from an iOS device though. Apple provides sample code for that.

@David: iBeacons *are* generic BLE devices. iOS simply looks for a specifically formatted data in the manufacturer data field of the advertisements. And if that format is valid, then iOS sees them as iBeacons.

@Ronny: I use a UUID I generated myself. You can replace it with any other UUID and use the same UUID in your iOS apps.

Ronny Khan says:

Thanks Willy.
I was able to make it work.
Could i bother you with another question ? The last byte "Measured Power" do you understand the significance of this ?

Jens Willy Johannsen says:

Hi Ronny
The "measured power" is for calibration so the distance can be measured more precisely. I think you can use Apple's sample app to get the value. Other than that, don't know :)

akira says:

Where do you define identifier?

Jens Willy Johannsen says:

Identifiers are hardcoded in both the iOS code and the BLE112 firmware.

Francesco says:

Hi Jens, thank you for publishing your achievements, I was able to create my own iBeacons with that :)

However, it seems like to make the module appear as an iBeacon, you need to replace the normal service advertisement(s) with the customized one, which basically means that any services/characteristics that the chip would expose in the gatt.xml cannot be read or written anymore.
Is there a way of being able to still access to those characteristics, that you know of? Or in other words, can an iOS device connect to an iBeacon and write/read attributes out of it?

Jens Willy Johannsen says:

Hi Francesco. I haven't tried it but it should be possible to use normal services/characteristics as defined in the gatt.xml file since the advertisement can include both info about services *and* manufacturer data. But like I said: I havent' tried it myself but I believe that RedBearLab does it (http://redbearlab.com/ibeacon/).

Francesco says:

Thanks Jens.

I'm trying now to find out if I should construct one single advertisement packet that covers all services and characteristics AND the manifacturer data, or there should be multiple ones that change periodically, one with the iBeacon ad and another with the "normal" gatt.xml services.

I cannot find a good documentation covering the advertisement packet specification, I hope that the Core bluetooth specification will able to help me out in that.

Jens Willy Johannsen says:

Have you tried adding normal services/characteristics to the gatt.xml *and* keeping the BGScript code for the custom advertisement data? In that case, does it ignore the info from gatt.xml?

Chris says:

Do you know if you have to modify the BLE112 firmware to simply send data to an iOS device via UART? Or can it do that right out of the box?

I'm creating a sensor where data processed from a microcontroller is being sent to a BT chip through the UART and then sends it to a connecting device.

Marco says:

Hi,

well done! great work!

Can anybody please tell me, where I can find that Apple Sample Code application? There is nothing in the Apple Developer Library nor in the Member Center...?! A link would be very helpful! Thank you!

Besides, I really want to know if you can use the ble module as a ibeacon and as a "normal" ble device (read and write servce/characteristics) at the same time. @Francesco: does it work, or do you have to change the advertisting data?

Thank you guys
Have a nice day,
Marco

Flavio says:

Hi Jens,
Great project! Thanks for sharing with the world!

Question 1: can you share which company you use to print your PCBs ?

Question 2: Why did you decide to not use any other decoupling capacitor? For example these other guys from http://opentod.org/ have an open source BLE112 project and they use a few more capacitors and a few more filter type components etc etc... I am new at this and I am always wondering how people makes those decisions...
I honestly prefer yours - it's simpler, cheaper and smaller... but I am trying to understand if there are any draw-backs with your approach versus the other projects with more capacitors, filters, resistors, etc etc...

Thank you for your time.
Regards
Flavio

Gustavo says:

Hi Jeans,

Is it possible to update the advertising data on the fly? If I want to setup the UUID and the major and minor?

Thanks a lot

Jens Willy Johannsen says:

@Flavio: 1. Personally I use http://imall.iteadstudio.com/ to make PCBs. I find them fast, cheap and by far good enough for my purposes.
2. Yes, there are drawbacks to my very simple design. Opentōd, RedBearLab and the others have simply designed their devices better. Their devices will work more reliably than mine. Remember, my goal was to design a simple prototype device – not something that would be good enough to sell. In a real-life professional scenario I wouldn't use my own devices.

@Gustavo: Good question. I think so but I haven't tried…

Carsten says:

Hi,
Really interesting and great work.

We are seeking an iBeacon and some tech help in developing our prototype for a new concept, if any here could be interested?
If we wish to buy an iBeacon already now - is it much different than what might come from Apple for the public?
What do you suggest - should we buy Coin or the RedBear for a prototype test?

Thanks

Alvaro says:

Hello,

I have tried to make an iBeacon using a HM-10 module but I can't seem to get the advertisement data required for the iBeacon libraries to identify the module as I beacon. I have just bought a BLE112 module. Could you please tell me how to rewrite the firmware that you have provided?

What do you use (software/dongle) in order to communicate and configure the module?

You have done a great job. Congratulations.

Jens Willy Johannsen says:

@Alvaro: I use a CC Debugger (http://www.ti.com/tool/cc-debugger) to program the module. And I use Bluegiga's (http://www.bluegiga.com) SDK to compile the firmware.

Alvaro says:

Thanks for the reply!

But in order to connect the cc-debugger I need to have the PCB you use for connectivity right? Anyway I can program the BLE112 module without it? I still don't have the PCB building capabilities.

I had created a HM-10 beacon but I can't install any new firmware on it.

Thank you.

Jens Willy Johannsen says:

Yes, you do need to connect a couple of wires somehow. If you can't make a PCB for it, you can solder wires directly to the BLE112. That's what I did for prototyping.

Alvaro says:

Hello again!

I have created a small PCB board with a BLE113 connected to a battery, a resistor and capacitor welded by hot air.

With the factory firmware, would any iOS app detect de beacon? For example I have used LightBlue to detect other Bluetooth transmitters.

The thing is that I cannot detect my Board with any app and I don't know wether it is because of the firmware or the construction of the PCB board.

Thank you.

Jens Willy Johannsen says:

@Alvaro: that completely depends on the factory firmware. An app like "BLEExplr" or "BLE Utility" might be able to see it if the firmware is compatible. But without knowing which firmware is installed you can't know whether the board works or if the firmware just doesn't advertise anything.

kilianciuffolo says:

I am playing with it but the iOS iBeacon API doesn't see the device as a beacon. It is visible as BLE device but it seems it doesn't parse the payload as an iBeacon advertisement. Wondering if anything changed on iOS, is yours still working?

Jens Willy Johannsen says:

Yes, my app sees the device just fine as an iBeacon. Have you changed the UUIDs to match each other?

kilianciuffolo says:

I did, but for some reason wasn't working, probably the SDK changed or something. You are advertising using "gap_general_discoverable" instead it requires "gap_user_data". This is my working firmware https://github.com/kilianc/iBeacon is anyone else needs it.

Jens Willy Johannsen says:

I can see I haven't been using the latest version of the SDK, so I'm sure that's it.
Thanks for the tip and the link to the revised source code.

Anthony says:

Hi,

I have no problem with I beacon implementation. How can I get my beacon to search for beacons without my app. Once discovered I will send them an alert that the entered my beacon zone and ask them if they want to download my app.

AB

Jens Willy Johannsen says:

@Anthony: you can't. An iOS device will only alert for iBeacons it is specifically listening for. (Which is probably for the better seen from a user perspective – personally, I would hate being spammed by "There is an iBeacon nearby" messages.)

Alexandre says:

Hi, do you know if exists a cheaper BLE than the BLE112? I have some projects in mind but this is too expensive. Thanks and congrats your blog is awesome.

Jens Willy Johannsen says:

@Alexandre: yes, the BLE112 is kinda expensive. I don't personally know of any cheaper BTLE module but I haven't really looked. If you want to build a really cheap device you will have to get the CC2450 chip and make all the support circuitry yourself (which is way beyond me which is why I use a complete module).

Alvaro says:

Hello again! I have my BLE113 modules ready to go, but I cannot seem to upload any firmware using the CC Debugger because the Debugger does not detect my chip. Is there a specific configuration in the connection of the BLE board with the CCDebugger?

Thank you in advance.

philipp says:

hi,
i want to buy it, will you sell it?

best regards

Jens Willy Johannsen says:

@philipp: Sorry, I just make these as a hobby – I don't sell them.

Alvaro says:

Hello Jens,

I never got to load the firmware as I said earlier. Is there a certain configuration on how the cables need to be connected from the CCDebugger to the BLE Module? The things is that I was using only 4 inputs of the module, but apparently I don't get a response from the CCDebugger. Could you share the circuit design or the connections in order to connect the Module with the Debugger?

Thanks a lot!

Jens Willy Johannsen says:

@Alvaro: sure, you can download the schematics from this post and see how I which connections I use for programming. Basically, you need to connect the following on the CC Debugger: V-sense, DD, DC, !RESET and GND.

Mannix says:

Hello Jens,

May I know which tool/software needed to build the firmware? I've just look around the bluegiga website and can't find it...

Mannix says:

Hello again,

I found the BGBuild.exe from the bluegiga SDK. However, I got the error when I build the project.xml as following:

script.bgs:Error, name collision in line 80
"event connection_disconnected(handle, result)"
"result" is already defined as global variable.
C:/Bluegiga/ble-1.2.2-100/bin/script_compiler.exe error:-1

How to solve it? And how to test the module? by using iOS device with specific app? or TI tools?

Jens Willy Johannsen says:

@Mannix: It's probably because the firmware I've posted was origianlly built with an older version of the Bluegiga SDK. Try changing "event connection_disconnected(handle, result)" to "event connection_disconnected(handle, event_result)" and see if that helps.

And I test it using an iOS app (you can use Apple's example app and just change the UUID) but you should also be able to see the device using TI tools or similar.

Mannix says:

Thanks Jens. I will try it later on. And do you have a test on BLE113 also?

David says:

Hello Jens,

First of all, congratulation! and apologize but my english is very bad.
Which eagle version are you using? I'm downloading the eagle schemes but I can't open it :(
Eagle tell me that there are invalid date in file...

Thank U so much, and great job again!

Hey Jens, quick question. I'm not a big hardware person and I'm actually trying to build some prototype beacons with your schematics. So far, I have all the parts necessary except I'm not sure what the white J1 connector is - I'm trying to order that part online but I don't know what to look for? Any idea you can shed some light on it...?

Correct me if I'm wrong, but I think it's meant to be a connector for the CC Debugger but really cant find a name for the part.

Also, quick followup - I'm assuming you are also using a coin cell holder for the beacon as well - can you point me to which one you used?

Jens Willy Johannsen says:

@Prateek: Yes, it is a connector for the CC Debugger. If you're making your own PCB, you can use whatever 5 pin connector you wish. The one I use is a 1 mm pitch JST SH connector – product number 1679121 at farnell.com.

And the coin cell holder is product # 1650693 at Farnell.

Paolo says:

Hi Jens, great article. So funny I recently moved to CPH and my first google of a beacon picture sends me to this great blog. I am sourcing and testing affordable iBeacons (iOS) for purposes of getting reliable distance estimates (using my own rough RSSI software "filter" or -in alternative- Apple's built in APIs). I think I am doing a decent job but I am not really having any luck with getting an accurate reading past the 3 meters (only distance ranges seem possible). Is there a way to tell, from specs, if a "commercial" beacon has a stronger and/or more "stable" signal than another (less prone to interferences, travelling further, fewer "oscillations")? Is there any commercial product that you can recommend checking out?

Jens Willy Johannsen says:

Hi Paolo.

I think that reliable distance measurements will be tricky. The signal will be affected by how you hold the phone in your hand and what direction it is pointing is for example.
I'm sure you can find beacons that transmits at higher power but the reception at the phone will still be susceptible to disturbances you can't really control.
Soo... I guess the short answer is, "I don't know" :) And I don't know of any products that might help you. Good luck with your project though.

And welcome to Copenhagen :)

/Jens W.

Paolo says:

Thanks you (tak), I was running controlled experiments in order to come up with my own filter, the issue seems to be that even two beacons of the same brand in a controlled environment can have different behaviour (some past the 3 meters, some past the 2 meters). I can live with interference as long as i get a chance to discover the "true model" (statistically speaking). To me it sounds like an issue of power, the higher the better. E.g. Estimote goes up to 4dBm (Bluetooth class 2), while the ones I am testing (white label from china) go only to 0dBm (Bluetooth class 3, 1 meter).

I will leave it at that, I am not sure that discussing signals and filtering was the main purpose of this thread. Sorry for hijacking :)

Paolo

Hey again Jens, so I ordered some DIP switches for the circuit and turns out they were the wrong ones - too big unfortunately. Can you give me another item number on Farnell for the DIP switches?

Additionally, if I were to build this exact circuit without the DIP switch soldered in, would it affect the functionality at all? I would flash the UUID once on the BLE module but if I didn't need to change it again, would the DIP switch be necessary - I ask that because I already have the PCBs with some space for the switches but I don't think I'll need them

Thanks again.

Jens Willy Johannsen says:

@Prateek: you can build it without the DIP switch just fine. It just makes it possible to change the Major ID og the beacon. If you don't need to change the Major ID after flashing the firmware, you don't need the DIP switches. And nothing will happen if the DIP switch is not on the PCB.

cloudline says:

Thanks Jens for sharing this great article :) Just a question, does this support OAD (Over the Air Download) already for wirelessly changing firmware or updating UUID, major, or minor? If not yet, do you know of APIs or ways on how to do that? thank you!

Jens Willy Johannsen says:

@Cloudline: Nope, there is no support for changing UUID/major/minor or firmware over-the-air. I have seen other iBeacon devices where it is possible to change UUID etc. OTA (the default firmware for the Minew MS54PX1, for example). Usually using GATT services and a custom app (unfortunately I don't have the firmware or souce code for them).

One advantage of the non-updateable approach is that it is not possible for others to hack/hijack the iBeacon and change the UUID. (And the code is much simpler…)

cloudline says:

Ok, i see.. Thanks for pointing to some example... thank you! BTW, you did an incredible job here :)

James T says:

I tried doing this project but I think I accidentally bricked the modules. http://jamestav.blogspot.com/2013/10/ibeacons-james-t.html?spref=bl

jason says:

Why do you use AVDD instead of DVDD?

Rahul says:

Hi Mr. Johannsen,

My name is Rahul, and I am currently a high school student at Adlai Stevenson High School, in Illinois in the United States. My group and I, in an engineering design course, are trying to develop a functional iBeacon. We are really interested in your chip design. We had a few questions:
1) We were looking to make a prototype through custompcb.com using the EAGLE files. What information about the board would be useful in doing so?
2) How does the coin cell connect to the board?
3) How do we (or do we need to) flash the firmware onto the board?

Thank you very much for your time and design,

Sincerely,
Rahul

Jens Willy Johannsen says:

Hi Rahul,

1) Well, it's pretty standard based on the EAGLE files. It's a two-sided board and it has solder mask and silkscreen on both sides. Thickness and copper thickness is not crucial – choose the cheapest version. In other words: two-sided board, everything else is standard or not too important.

2) There is a coin cell holder soldered to the bottom side of the board. You can also use the "+" and "÷" pads and attach you own 3.3 V power if you want that instead of the coin cell.

3) Yes, you need to. And this is slightly tricky. You need a "CC Debugger" to flash the firmware as well as the software (which you can download from Bluegiga's website). The 5-pin header connects to the programming pins on the BLE112 so you need a 5 pin connector and attach the appropriate wires to the CC Debugger.

I hope that helps. Good luck with your project.

/Jens W.

Rahul says:

HI Jens!

Thanks for the response! It was really helpful! I have 1 more question:
When sending this board to a PCB manufacturing website(do you recommend any good ones that support EAGLE files?), do they create the board with all the components on it, or do we need to buy all the components separate and solder them on ourselves? If this is the case, what all separate components would we need to buy? The website we were currently looking at is https://oshpark.com/ ., The board there costs about $9 for 3 boards.

Do you know of any companies that produce boards with components on?

Thank you very much.

Sincerely,
Rahul

Jens Willy Johannsen says:

Hi Rahul

You do need to buy all the components and solder them on yourselves. There are companies that both create the PCBs and assemble them with components but it is a lot more expensive and many of them will only accept orders of at least 1000 boards.
I have only ever bought components and assembled the boards myself so I can't help you with any company names.

As for PCB manufacturing, I use ITead in China, but I have heard good things about OSH Park as well.

/Jens W.

Rahul says:

Hey Jens, we are working on our BLE112 board (more to come later). (Also, can you link a buyable programming header for the board?). I had a question. I recently found Blugiga's BLE121LR, a chip capable of 450 meter range! Is there any way we could swap this chip into the EAGLE schematic and board (I understand it is of a different shape, but maybe this is still possible?)
Let me know if you think it is possible, so we can start trying!
By the way, thank you very much for your help! We will be sure to mention all you have done for us and give you credit!

Note: Here is the BLE121LR datasheet: http://media.digikey.com/pdf/Data%20Sheets/BlueGiga%20PDFs/BLE121LR_V1.2.pdf

Sincerely,
Rahul

Rahul says:

Also, for our first prototype, do we only need to put the hardware.xml, gatt.xml, and project.xml files onto the board (or the script.bgs file too?).

I am assuming that we download the SDK from Bluegiga's website. Then do we just import the hardware, gatt, project, and script files? (and how?)

When we use the cc debugger, are there specific files we need to use to put onto the board (from the SDK?)

Sorry, we are very new at programming boards, hope to hear from you soon.

Sincerely,
Rahul

Leave a Reply