Sunday, June 23, 2019

Navigation system for Blind using Passive RFID

It is always troublesome to find our way in a big shopping center. This applies to Visual Handicapped as well as sighted. Currently, the best way is to use beacons system to provide navigation and information around the beacon.

To maintain the beacon system is not that cheap. Beacons are life beacons that needs power source. In a big building, the number of beacons used is staggering. There are ways and means of using other technologies to provide navigational needs for the Visual Handicapped. Below is one which I think is viable.

RFID has been in the market for decades already. Passive RFID is just a piece of paper attached with a tiny chip and an antenna. It is very cheap and can be bough in bulk. Each RFID is unique. Therefore, if you are near enough with a reader, you could know which RFID is near you.

Firstly, you need to lay breadcrumb (RFID) trails on every path in the building. A mapping of each RFID and nearby POI (point of interest) is necessary for navigation. The breadcrumbs should be spaced at a fixed distance apart. Ideally, at every junction, a breadcrumb should be right in the center of it.

User using RFID reader could then able to read the breadcrumbs as he/she walks along the path. By limiting the range to just able to read at least 2 breadcrumbs, The system will be able to know which direction the user is moving since the last one will drop off and new ones will appear. With the mapping, you can then tell the direction of movement.

At junctions, user should be informed that there are branches and alert user on the possible direction and POI. User can then make a decision to move to the specific direction.

The app can be in a form of a map of the building with blinking dots to show current user position and with voice assistance for Visual Handicapped to use. It will have a list of POI to assist users. It will be good to have a search function that finds the nearest point matching the search string like "exit". A highlighted path to the search string, like map navigation, will be helpful.

Since passive RFID is cheap and need no power, it is just a install and forget type. Any missing RFID can be replaced with the same ID. It is, therefore, simple and cheap to maintain such a system.

Now the expensive part is the RFID reader. It needs to be Wi-Fi enabled so that it can be integrated with hand phone app. The app has to be custom designed to use it as navigation system. All these costs eats into user's budget. However, it reduces the cost of building owners so that they will be more willing to invest in the infrastructure. With many building owners willing to install the system, the cost of the application can then be reduced thus lessens the financial burden of users.

Since this navigation can be used for sighted, it becomes universal navigational system thus further reduces the costs. It is a win-win situation.

This system need not to be indoors only. Outdoor place like parks can install such system using weather proof containers for the RFID. It can even be used for temporary venues like a carnival. The uses are multiple.





GSX Questions

It was something that was started quite sometime ago but wasn't made compulsory. Questions are a set of data that was posted as questions and user is supposed to answer it accordingly. Its as simple as that.

However, the Questions are nested questions and no fixed pattern. Previously, a pointer is used if there are nested questions. It could not work that well. Recently GSX changed the data format to JSON and the Questions were set in nested JSON format. This makes it much easier to follow as we just need to traverse the nesting structure typical of JSON.

Fortunately, Questions uses fixed format in the form of Questions and Answers. The nesting is always at the Answers array or as a array in the Questions level.

This blog talks about how to traverse through the list and nested questions using FileMaker. As it is, GSX returns a JSON. Since FileMaker has JSON functions that can read nodes from JSON stored in fields or variables and the format (path) of reading the nodes is like "XX.YY.ZZ". If it is an array, just add the array number after the node name like "XX[0]".

The method of traversing the nodes is simple. The path is stored in a variable.  We start off with $trees="questionDetails[0].trees[0].questions[0].answers[0]". Using JSONListKeys($json;$trees) we can get a list of keys. If there is no answers, we remove the last node and add 1 to the previous level array then repeats to find the answer keys.

Upon finding the answer, we post the question and gets an answer from user. Depends on answer type, user have to respond accordingly. Once finished answering then we look for nested questions in the answer. If there are nested questions, we add one new level after answers and go to the first question in the nested questions.

In the nesting, if there are more items in the array, we go into the next item in the array and look for questions or answers. If there is no more or no questions/answers. we back up one level and see if there are more items in that level.

In this way, we could go into the nesting systematically and back up to the higher level if there are no more array item.

GSX requires you provide the question ID when you answers. So you must create an answer JSON that corresponds to the Questions. Every time you add a question/answer level you need to add the array first so that when you answer, you can write the answers using the same $trees array.

I won't be diving into showing examples of traversing. Do figure out how to do it yourself.




Thursday, June 20, 2019

Communicating with Apple Web Services (GSX) via Filemaker 2

My previous blog on the same subject is 3 years ago. Since then Apple has changed from using XML to JSON as a means of transferring data. Therefore there is a need to show how to do it with JSON.

JSON (Javascript Object Notion) by its name, is a Javascript feature but it has extended its use to many other applications. It is a format of storing data just like XML except it is more human readable when you format it nicely.

Fortunately, FileMaker has caught up with the latest trend by including a few JSON related functions. It is not that easy to use those functions to compose JSON but it is very much easy to get data from JSON.

To create simple JSON you just need to use $example =JSONSetElement("";"elementkey";"elementvalue";1) and it will create a nice JSON '{"elementkey":"elementvalue"}'. However, if you want to insert nested JSON then it is a bit tedious.

For example, you want to create a key that contains an array with one key and  value. First you must create the key and value as a JSON like last paragraph. Then you have to create an array to contain that JSON like $array= JSONSetElement("[]";0;$example;3).

Finally you then create the root element like $root=JSONSetElement("";"root";$array;4). You have created a JSON '{"root":[{"elementkey":"elementvalue"}]}'. This format is generally used by Apple in GSX in both request and response.

If it is a simple JSON that need to store a small set of data with fixed keys, it is better to create the JSON with unique values for each element that needs to be changed like "~!1", "~!2" etc. After that use substitute function to replace the "~!x" sequence. Two lines instead of 3. In actual fact, one line encompassing both action can be done by just using the JSON as source of substitute directly. In this way you could reuse the same code repeatedly or even store it as custom function.

The parameters used in JSONSetElement can be found at. JSONSetElement.

Getting values from "elementkey" in the above JSON is easy. $value=JSONGetElement($root;"root[0].elementkey")

If you looking at this blog first then I suggest you go to the previous blog on the same subject first to get an understanding.


Saturday, June 15, 2019

Exercising by Heart Beat

Normally one would want to exercise with some repeatable routine. Some go for fixed time. Others go for distance. More health conscious people will want to stick to an exercise/training routine depends on the type of exercise done.

I usually go for speed based exercise as I do walking and cycling. Recently, I am obsessed with heart beat based exercise. It is not scientifically proven but based on the ample talks about lowering heart beat, a controlled heart beat during exercise moves one towards lowering it. It will be good for controlling hyper tension, high blood pressure.

Before launching on the methods used to keep heart beat within a range during exercise, it will be good to about the basis of heart beat measure. According to scientific figures, the maximum heart beat a human can have is 220 beats per minute (BPM). Individual person's maximum heart beat is 220 - number of years of your age. People who exercise constantly will have their maximum heart beat considerably higher than normal people's heart beat.

Minimum heart beat depends on individual. Some athletes have resting heart beat around 40 BPM. Most people's heart beat is between 60 - 100 BPM. Children aged 6 -15 is around 70 - 100 BPM.

My range of heart beat I want to control while walking is 99 - 108. It is at the lower end of medium exercise range. The reason is to avoid excessive sweating. It is not easy to control the heart beat at this range as any lower than 98 BPM means I am out of medium exercise range. This is especially true if I don't do warm up before walking. It tends to fluctuate very much till the body is warm up.

Monitoring heart beat while cycling is a bit dangerous. However, all vehicle drivers including motor-cyclist have to keep monitoring their speed while driving. Their speed is very much higher. Just ensure that the coast is clear before you take a peek at the heart beat monitor. I only do it while cycling on long stretch of PCN or cycling path.

Depending on the type of cycling done, the heart beat range can be different. Usually, if I want to go for speed, I abandoned heart beat monitoring. Just go fast till your limit. On the other hand, for standard exercising, I go for 155 plus minus 10. It is at a comfortable heart rate without stress. Coincidentally, 155 is my maximum heart beat (theoretically).  Individuals must try and error to find a comfortable cycling speed for themselves.

At 155 BPM the speed of travel is basically below the 25 KPH limit of PCN. It is therefore safe and within the regulation.

GARMIN Connect has a stress measurement statistic page. It is to show how often you get stressed. My stress region is generally non existing except at the beginning  and end of exercise. It could be a result of my method used but there is no proof and I don't bother to prove it.

Below is a typical walking speed and heart beat chart.