Make With Mouser IoT Design Contest - Blind People Tracker Device with AVRIoT Wx from Microchip [2/2]

TIme to continue tutorial from here
Modify firmware of the board,


First download MPLAB x IDE and XC8 compiler and install it.
download the pre programmed by factory for AVR-IoT AWS
https://github.com/microchip-pic-avr-solutions/avr-iot-aws-sensor-node-mplab

Open MPLAB X IDE and open project that already download from the link above.
1619410887187.png



on the navigation window , click AVRIoT -> SourceFiles -> MCC_Generated_Files ->Application_manager.h

edit pre-programmed sendtocloud function
C:
static void sendToCloud(void)
{
    static char json[PAYLOAD_SIZE];
    static char publishMqttTopic[PUBLISH_TOPIC_SIZE];
    
    int len = 0;   
    uint8_t sw0 = SW0_GetValue() != 0;

    memset((void*)publishMqttTopic, 0, sizeof(publishMqttTopic));
    sprintf(publishMqttTopic, "%s/sensors", cid);
    // This part runs every CFG_SEND_INTERVAL seconds
    if (shared_networking_params.haveAPConnection)
    {
            len = sprintf(json,"%u",sw0);
 }
    if (len >0)
    {
        CLOUD_publishData((uint8_t*)publishMqttTopic ,(uint8_t*)json, len);       
        if (holdCount)
        {
            holdCount--;
        }
        else
        {
            ledParameterYellow.onTime = LED_BLIP;
            ledParameterYellow.offTime = LED_BLIP;
            LED_control(&ledParameterYellow);
        }
    }
}
Connect board into PC and reprogram the board with edited file by clicking the make & program device button(red border)
1619411095355.png


after firmware of the AVR IoT board is updated..

Check AWS IoT core server to make sure whether is it work or not.
1619411421317.png

as you can see it works, when swtich button is pressed board will send 0 to the AWS Iot Core server and 1 if switch button is not pressed.

Our board is ready..

Let's continue build smartphone application

The concept here is , when board is pressed by blind people, it will send "0" data to AWS IoT Core server
This data will be subscribed by smartphone application that will be made.

So there are 2 smartphone application we will build.
First as gps sensor (Function is to replace broken gps sensor that i bought)
and second smartphone application for tracking the positiion..

Like I told you on the first thread of this tutorial
the concept is

Blind people bring Embedded device (switch button + microcontroller Wrapped by box) and also smartphone as WIFI Teathering connection.
We will use this smartphone also as our gps sensor. so when switch button is pressed, it will request to smartphone for sending gps location to the cloud.

the gps location will be accessed by other smartphone application. and we can track the location.

Without further ado lets start make 1st application

SMARTPHONE APPLICATION AS GPS SENSOR
open app inventor 2 by click this link
http://ai2.appinventor.mit.edu/

start new project and follow component that I used.
There are
  1. Label1
  2. Label2
  3. UsrPahoMqttClient1
  4. LocationSensor1
  5. Clock1 - 3
  6. text to speech
1619411971229.png


program the application with this block
1619412075526.png


Now Build the application and download it by scan the Generated QR Code

1619412210310.png


Now let's run the application on our smartphone and check the AWS IoT Core server
is it correctly set up or not.

Open AWS IoT Core and click test and subscribe for {id}/sensors & {id}/location
1619412574009.png

You can see at {id}/sensor, when I pressed the button it will send "0" data.
and the smartphone application will response the "0" data by sending gps coordinate (Latitude & Longitude ) :

-6.34766,107.11111
To make sure this coordinate is accurate, I will check it on google maps website
1619412750268.png


Yeayy..... the coordinate is accurate, when I make this app I am exactly on the red pin map.

I think we are done....
eitss... but wait we will make another app for tracker application

SMARTPHONE APLICATION TRACKET

Same with previous step,
go to app inventor 2 and start new project and follow component that I used.
  1. Lable1
  2. Map1
  3. Marker1
  4. Button1
  5. Locationsensor1
  6. UrsPahoMqttClient1
  7. ActivityStarter1
  8. Clock1

1619412908306.png



after make the view like the picture i'ts time to program it with block
follow my blocks

1619413010901.png


Build the software application and download it.
and we are done..

Please watch the video for the demo

Blog entry information

Author
NoobIsHere
Views
2,012
Last update

More entries in Design Contest

Share this entry

Top