Where to get started programming iBeacon BLE sensor modules? - swift

I'd really love to learn to program cheap sensors and modules such as this one:
barometer sensor nRF51822 bluetooth module ibeacon LPS22HB, CR2032 battery holder, specifically to use within iOS and Swift.
I reached out to the company who makes them and tried researching how to get started multiple times, but I really can't figure out where to start. There are also pre-programmed modules, but my interest is programming these cheap ones to fit my needs.
I have the linked module, and a few others, and they appear and can be connected to using beacon detector apps, but display no understandable info.
I'd like to read the barometer pressure reading to start. Help is highly appreciated, I'd love to start working with these.
EDIT/UPDATE: I was able to read the modules manufacture name on one of many iBeacon scanner apps I tried and their name is Yunjia. With this information I am able to find alot more details online about what I have. One website says for these chips I can use LightBlue (the app I used to find the manufacturer name) to modify, read, and write to the module. Any additional advice is welcomed, I'll be researching and testing things out.
I also found the Schematics along with some additional info hidden in the seller website.
Edit 2: I found the manufactures little YouTube channel with some info, looks like I just have to do lots of research and testing and learn everything. https://www.youtube.com/channel/UCvqhWNqDE-v0je0X8XAEF2Q It contains some video instructions.
Edit 3: My short term goal of reading the barometer data was a success! After tons of digging I found I just had to write a value of 0x01 to turn on all sensors, then I was flooded with data and the barometer pressure in bytes which could be translated to the actual amount. Write 0x00 to trun off all sensors.

Apple's iBeacon framework is dirt-simple and very easy to use. It allows you to listen for beacons based a unique UUID, major id, and minor ID. It lets you know when a beacon enters or leaves range, and provides crude (immediate, near, medium, and far) distance values. You can create "beacon regions" that will notify your app when you enter or leave them. That's about it.
If you want to do something like read barometric pressure or temperature readings, you will need to either write your own low-level BLE code or use an existing library. My guess is that these modules are using very standard hardware and that you should be able to find libraries to read their specialized data.
Failing that, you will need specifications on their BLE interface and need to learn how to write Apple Core Bluetooth code. (The link you posted has zero specifications for the units. The only thing it provides is the numbers "nRF51822 bluetooth module ibeacon LPS22HB" (It's not in well-formed English so I don't know how to parse those descriptive terms. I'd google those numbers) Note that Core Bluetooth is a fairly low-level framework and not very easy to learn.
EDIT:
Googling "nRF51822", that is apparently an ARM based chip that includes radio hardware that supports BLE. It sounds like that is a general-purpose chip that vendor would use to build a BLE module. Given that, you'd probably have to reverse-engineer it to figure out how it works.
The "LPS22HB" appears to be a solid state pressure sensor that can be used to build a barometric pressure measurement device. It's no doubt interfaced with the "nRF51822". Without specs you're going to have a very hard time figuring out how it's interfaced however.

Related

Indoor navigation hardware/software requirements for iOS

I'm developing navigation system for my university as some kind of research activity. I'm using SVGKit to display floor plans. And now I need to provide user locationing service for navigation and tracking. So here's my questions:
1) Do I need some special hardware installed in university (Cisco MSE for example, or some cheaper analogues), or I can apply some software/technologies to our current hardware for server-side user location determining? If I do, what equipment do I need for it? I mean, it would be one unit for the whole university, or one per each floor, or what?
2)
Q: Why doesn't the Redpin iPhone client conform to the iPhone SDK
Agreement? A: Apple does not provide a public API to retrieve WiFi
data. In order to get the iPhone client working we had to use a
private API, which is disallowed by the iPhone SDK Agreement.
(c) http://redpin.org/faq.html Does it mean that RedPin is unacceptable in AppStore, so I can't use it?
3)Does Navizon I.T.S. requires some specific hardware equipment except standart routers?
Thank you all, maybe you can offer me better solutions, I hope. Thanks in advance.
Indoor positioning is a very vast field and many different solutions are available which all use a different combination of hardware/software. Some need no specific hardware to work, others need a very expensive infrastructure to be put in place. In the end, it all depends on the accuracy you are trying to achieve. Here are the most common solutions used, I ordered them by the type of technology used:
Wifi: two main techniques are used here, trilateration and fingerprinting. Both do not require specific hardware if your uni already has deployed access points (APs). Trilateration converts signal strength to distance and then intersect circles (almost exactly like GPS). In general this has poorish accuracy and you need to know the exact position of APs for it to work. Fingerprinting is a pattern matching technique where you first build a wireless map of the environment and then match the measurement against this map.
Bluetooth: same techniques as above can be used with Bluetooth nodes. Of course, there's less Bluetooth nodes than Wifi so you might need to deploy some extra nodes for it to be accurate enough. Same accuracy as Wifi (roughly 5 meters)
Dead reckoning: uses an accelerometer, gyroscope and compass to calculate the speed of heading of the user. Needs to be initialized and calibrated regularly by another absolute positioning technique. Subject to drift so accuracy degrades quickly over time. Upside is its very cheap, no extra hardware or initial survey phase are needed.
UWB: very accurate techniques based on time of flight measurements. Requires expensive hardware for both transmitter and receiver. You can achieve cm accuracy with this but it's probably not what you're after
This is still an field of research so it's not that easy to find something that just works. I suggest contacting the IT department of your university, if they run a Cisco system, I know some of them provide some sort of positioning capabilities but I don't have much details.
As for your iPhone question, any app that accesses the private API to access Wifi measurements will be rejected by the App store, so you won't be able to publish anything that relies on Wifi. You can still use it for research purpose though, you'll just have to figure out the code yourself as there's no official documentation (some unofficial doc is out there though)
Good luck!

Bluetooth LE Profile for reading measured data

I read a lot about Bluetooth LE in the past hours, but I do not really understand how profiles work. I want to pair an iPhone with a self-made device over BTLE.
The device should send measured temperature values, humidity or other values over Bluetooth and the iPhone should read that data.
I read about different profiles in the BTLE specs (even about heart measurement), but how does one proceed, when reading CO-emission for example?
Thanks a lot!
Regards, mary
There are two sides to this: the profile you'll define on your device and the code you'll write to communicate with this profile in your iOS application.
On the device, you'll define a profile with specific services for the measurements you want to gather. There are several standard Bluetooth LE profiles which you can find in a list on the main Bluetooth developer site. These include profiles for temperature, heart rate, and walking cadence, among others, so if you are providing measurements in one of these categories you can make your device provide one of those services and it will be usable with any iOS application that reads from that service.
For values that aren't covered by one of the existing services, such as the humidity readings you mention, you'll need to create your own custom service. You'll just have to define the service characteristics (what type of data you'll provide and how you'll provide it) and give this service a unique identifier, because it's one you're creating and not part of the standard ones laid out by the Bluetooth organization.
How you define these services and characteristics will depend on the specific Bluetooth LE hardware you use for your device. I've done most of my work recently on Bluegiga's BLE112 chip, which combines a low-power microcontroller with a Bluetooth LE transmitter. They have very good tools for defining device profiles and creating matching firmware, and it's reasonably straightforward to set this up on their chips. I can't speak for other manufacturers, but they most likely have something similar.
Once you have a profile defined on your hardware, you'll need to look for devices advertising it and be able to connect to them within your iOS application. You'll use Core Bluetooth for this, and I highly recommend starting with one of Apple's sample applications, such as their Temperature Sensor example. That example uses the standard health thermometer profile, but you can tweak it to find your proprietary services in addition to the temperature readings. You can see how they read and process the binary data returned from the LE device in that example.
I highly recommend watching Apple's two WWDC 2012 session videos on the topic, Session 703 - Core Bluetooth 101 and Session 705 - Advanced Core Bluetooth, because they provide a lot of background on the topic and show practical examples of this in use.

iPhone to RS-232 via Bluetooth

I'm looking to connect my iPhone to an RS-232 serial device via Bluetooth. Has anyone implemented this successfully and can offer advice on hardware to use? It's kind of tricky because of the need for the Apple Authentication Processor with the device. The best potential device I've found is this guy but it only comes in an embedded package, its serial port interface is just logic-level UART rather than line-level RS-232, and I can't find a supplier with it in stock.
Any thoughts would be appreciated.
I'm considering just using WiFi to serial instead, but please ignore that possibility for the purposes of this question.
most of the question was answered by yourself already.
Basically you have 5 (+2) choices.
Join the MFi program. This might be hard to impossible if you are not part of a at least mid-size company.
Buy the OEM Bluetooth Module. I'm not sure if this is even allowed by the apple policies.
Use WiFi. Keep in mind that you want to use a wifi chipset that can act as at least ad-hoc access point. Those chipsets are quite expensive, and you have to think of a way to join existing networks (customers don't want to leave their home network to use your product). This will add a lot of cost to the BOM of your device.
Jailbreak might be an option. I never tried to use accessories with a jailbreak, so I don't know if it's possible to use bluetooth without authentication.
Work with a company that is member of the MFi program.
(Maybe an option, and depending of the speed you want to have via RS232: Eventually you can convert the audio output of the head-phone jack to RS232 levels and vice versa)
(Not really an option: develop for Android and do whatever you want)
If you jailbreak your device, you can use BTstack.org (disclaimer: I'm the author of BTstack) to connect to a Bluetooth device that supports the Serial Port Profile. You can get Bluetooth Modules that implement SPP and provide UART level output. As David R. above points out, you then need a UART to RS232 converter, e.g. the MAX232.
Ok. Another option. There are one or two companies that sell RS232 cables for iOS, eg. Skywire here: http://www.southernstars.com/products/skywire/index.html
Then, you could uses a Bluetooth RS232 extender, which consists of a RS232-to-SPP and a SPP-to-RS232 pair. Ugly, but within Apple's rules.
Well. It seems like my answer could be something you didnt ask for.
But the guy you referred to is the answer. Buy his product and you are good to go, all you need is a MAX232 chip. Converts logic level UART to RS232.
the diffrence high + voltage low zero voltage is converted to high +~10volts low -~10volts.
I use the MAX232 chip with my microprocessor, that uses logic level USART to communicate over RS232.
There is a lot of tutorials out there explaining how to hook things up.
This product works: https://serialio.com/product/bluetooth-serial-adapter/bluesnap-smart-bluetooth-40-ble-rs232-adapter
The only downside is that the adapter requires power.
It should be possibly I would think to create something in the middle that accept the bluetooth commands and convert them to serial, similar to what this does with TCP connections: https://www.npmjs.com/package/stellar-socks

Can a Smartphone read RFID tags from a distance of few feet (NOT NFC)?

Being a bit more specific: I would like to know whether there's a Smartphone that can detect an RFID tag from few feet away using its original HW (no external devices) and OS capabilities.
Any comment/direction to reading material will be highly appreciated.
I think the answer depends on your use of the word "RFID Tag". In the classic sense, a read-only transponder, equivalent to a bar code, the answer is not yet. There are proposals for 2.4 GHz RFID that could use existing WIFI chipsets to identify nearby objects. Nothing standard or accepted is available.
However, based on the application you describe. One potential answer may be to flip how you are thinking of setting this up. If you just need to know if a certian, unique, person is near a spot in the mall, maybe instead of their phone looking for an RFID tag you need a low cost bluetooth sniffer (connected to a low cost computing board) looking for their phone, via bluetooth MAC addresses, within say 5m. As long as the customer has bluetooth enabled, has signed up for your service and your read points are connected to the internet this approach should cover your use case.
Basically the possibility is very low.
Near field refers the the property of RF fields with very close proximity between the devices. In the case of NFC as it applies here the devices are even closer, in what is termed the "Reactive near-field". Moving further away these properties are lost.
From Wikipedia: "Theoretical working distance with compact standard antennas: up to 20 cm (practical working distance of about 4 centimeters)"
I just found this solution:
http://www.ugrokit.com/
I don't have any experience with it.
Any android device with NFC chip and antenna embedded is capable enough to read RFID tags.

How to implement indoor navigation on the iPhone

I would like to locate the iPhone in a building to build an application with similar features as the iPhone app of the American Museum of Natural History. There is no good GPS reception as there are also rooms in the cellar I would like to cover.
What can save me is that there is good wifi coverage in the whole area, so my idea was to triangulate the position based on the wifi base stations in range, whose positions are known. However I found no public API to find out which base stations are in range.
Questions
Do you have an idea how the app mentioned above manages to get the correct location indoors?
Could one add the wifi base stations manually to Apple's database and use the usual CoreLocation?
Do you have other ideas how to implement it?
Any help is very much appreciated!
Boundary conditions
The indoor navigation is only used during an event to guide guests new to the building, so no complex infrastructure should be installed.
There are approximately 14-18 rooms to be covered. They are in different parts of the building, so wiring everything up would be very costly.
The preferred solution would not require a server backend of any kind and would work with a list of wifi access points and their corresponding locations.
I wouldn't know about 1 and 2. But if you would implement such a thing, turn it around to save a lot of trouble: create your own free-of-charge wifi network, and let the network determine the location, either based on triangulation, or just based on the currently associated access point. Make their signal weak so you have one audible access point per room. Let the app ask a server in what room he appears to be. This will also work for any other mobile/pda/laptop.
As for other ideas: You could use bluetooth to do somewhat the same as you're planning for wifi. You can't do everything with bluetooth, but listing devices seems to be one possibility. So just put a bluetooth device in every room. Bluetooth range is limited by definition.
Another one would be to use the microphone in conjunction with a high pitched sound which identifies the room, but that would cause trouble with dogs (for blind people), attract bats, and repel mice at the same time. Better focus on an RF based solution ;-)
You can also check out Navizon's indoor positioning system:
http://www.navizon.com/product-navizon-indoor-triangulation-system
Their system is able to locate iPhones by using the WiFi signals transmitted by the device and doesn't require an app to run on the phone to locate it. It can locate any other WiFi enabled device for that matter.
Check out wirelesswerx.com They seem to be doing indoor location using Bluetooth and it looks like they can do permanent install or temporary for events.