ラベル Eddystone の投稿を表示しています。 すべての投稿を表示
ラベル Eddystone の投稿を表示しています。 すべての投稿を表示

2018年5月12日土曜日

Cooperation between micro:bit and MIT App Inventor with Eddystone signals (No.2)

In the last article (No. 1), a program (with microbit JavaScript block editor) that sends Eddystone signals (either Eddystone-UID or Eddystone-URL) and a program that receives it with Android (by MIT App Inventor) were presented.

In this article, Eddystone-URL data that should be adversised by maicro:bit is updated from Android side. To do that, I use the Bluetooth UART service (serial over Bluetooth). Overview of the mechanism is as shown in the figure below.




Let's see the operation of Android. (a) is the initial state. In (b) we are sending a new URL to the micro bit in response to a request. In (c), the URL currently stored in microbit should be sent back for confirmation.



URL information updating

Next, I will examine the source program briefly. The figure below is a micro:bit program. When you press button B, URL information should be received from Android side. Also, if you touch pin P0, it will send the current URL to Android. Press button A to advetise the URL.





The main parts of the Android program created with MIT App Inventor are shown below. We are communicating using BLE's UART, but in App Inventor we can use BLE extensions, which makes it very concise. However, in addition to this, connection settings with a standard BLE device, decoding of URL information, etc. are also necessary.



Main part of BLE UART communication with MIT App Inventor

Finally, here is the result of displaying the web page of the adverrtised URL in another application. For example, in the above figure, we setup 6 characters "RwaMqL". This is the actual URL with the header "http://goo.gl/" appended. However, this is a shortened version of the original URL. That's because of the limitation of the number of characters that can be advertised.

The shortened URL "RwaMqL" denotes Dept. of Mathematics, Hokkaido Univ.



2018年5月9日水曜日

Cooperation between micro:bit and MIT App Inventor with Eddystone signals (No.1)


Let's try to collaborate between micro:bit which is currently drawing attention and MIT App Inventor for Android. As one of them, we exchange Eddystone signals. There are several signal configurations of Eddystone, but here we deal with Eddystone-UID and Eddystone-URL among them.

Micro:bit (advertiser) and Android (receiver)


Let's perform the demonstration and watch it.
As a Microbit program, we made it possible to advertise these two types of Eddystone signals.  First, when you press micro: bit button A, it advertises the current pitch (inclination to the horizontal plane) and temperature. In the figure below, you can see that they are being received on the Android screen. That is, at the present time, the pitch of micro: bit is 30 degrees, and the temperature is found to be 26 degrees Celsius.

Pressing buttonA on the Micro:bit makes it advertise two kinds of data

Next, when pressing the micro:bit button B, a certain URL is advertised. On the screen of Android, the received contents are displayed.
Pressing buttonB on the Micro:bit makes it advertise an url of a web page


And soon, the web page for that URL was automatically displayed. In this case, it is a web page about the Akita dogs which became more famous for being given to famous Russian ice figure skater Miss Zagitova (Алина Ильназовна Загитова).
In this case, cheerful “Japanese Akita Dogs” web page is illustrated


Let's see these source programs. The following figure is a micro:bit advertising program. By pressing button A or button B you can issue either Eddysotne-UID or Eddystone-URL.


Eddystone advertising program (micro:bit)

Next is the Android program that receives Eddystone. This is made with MIT App Inventor only. It uses the extensions function for BLE (Bluetooth Low Energy), so it's very easy to write. However, the figure below shows only the essential part. By this alone, it is possible to directly acquire the content of the received data advertised. Thereafter, for example, it is necessary to decode the received URL data and convert it into a character string. It is also necessary to pass it to the Web viewer. All of them can also be written with MIT App Inventor.
Main part of Eddystone receiving program (MIT App Inventor)


please read this related article

Thanks
FoYo