how_to_build-2

Hack: Big Data in the City

Level: Intermediate

Hacktime: 120 mins

Cost of materials: $168 – $200

If you are a company in an African city, say Uber, Easy Taxi, DHL, Jumia, Konga or ACE, and you relied on logistics to run your business efficiently, it makes sense to track the travel route and fuel use of your fleet of cars. It makes even smarter business sense to capture that data, aggregate it and use it intelligently to improve your business operations.

We developed the “Big Data in The City” hack to help companies make data-driven decisions to optimise operational efficiency. Analytics from our GPS and GPRS real time trackers were used to record travel routes in and around the city, the number of stops made to a delivery station, the flow of traffic at certain times of the day and even the speed at which we traveled.

The GPS data was automatically sent to a remote http server and then displayed on a map, using the Google Maps API, which allowed anyone with access to view our transport route from a web enabled device (smart phone, tablet or PC).

The Big Data in The City Hack

Tech talk: We use GPS and GPRS for rapid processing of real-time information to optimise the delivery of goods. As the data route is automatically plotted on a Google API, the server intelligently recalculates the travel route based on the current traffic situation. The application also aggregates the data according to a set frequency (hourly, daily, weekly), the data is sent to a user’s database and patterns are established to determine the most cost effective routes of delivery and to inform other business decisions.

Simple talk: Use a real-time tracker to track anyone, anywhere.

Materials

STM32F4 Discovery Shield

STM32F4-Discovery Development Board (houses an ARM Cortex M4 microprocessor)

GSM Click (with antenna)

GPS Click (with antenna)

▪ SIM Card with Data bundle

▪ Power source (This hack was powered from the PC USB port)

▪ A PC for developing the firmware

USB cable (Type A to Mini B)

▪ An HTTP Endpoint (a temporary endpoint can be obtained from requestbin)

▪ MikroC for arm compiler (download from here and install on your PC)

Procedure

1. Connect all the kits together
10295817_455271654645446_7709838433424896906_n
2. Plug the STM32F4-Discovery board into the discovery shield
02Big Data - STM32 F4
3. Plug the GSM and GPS clicks into slots 1 and 3 on the discovery shield
03Big Data - Connections
4. Connect USB cable between your PC and the shield. This powers up the unit.

04Big Data - USB Cable

5. Time to write some code! (For simplicity DAA have prepared a ready firmware to load onto the processor).

05Big Data - MCPAR file

6. Download the firmware from our github page and open the .mcpar project file. This should load up the project environment. If not already open, open the .c file for modifications.

06Big Data - Change APN

7. You will need to change the APN settings to that of your service provider e.g. Safaricom, MTN (the example application uses O2 PAYG APN settings).

07Big Data - HTTP endpoint

8. You will also need to change the http endpoint.

08Big Data - request bin

9. To obtain a temporary endpoint, go to requestb.in, click on “Create a RequestBin”

09Big Data - BIN

10. When all changes have been made, build the project.

10Big Data - Build Project

11. Upload the built program unto your processor. MikroC has a help section if needed.
11Big Data - Program processor

Now that the processor is programmed, the device will acquire GPS coordinates every 60 seconds and the data will be sent to the end point via GPRS.

 

Big Data - GPS dataTo verify that the GPS coordinate has been successfully transmitted, copy the RequestBin URL into your browser and you should see the GPS data in NMEA format.

End of hack.

View the pictorial hack on Facebook for step by step photos.

Watch out for Part 2 of this hack which provides details on displaying the GPS data on Google Maps.

Linda Waireri Author

Get the best African tech newsletters in your inbox