In this step, there are two functions provided to you in MCU.py
This function is used for initialize camera hardware and face detection algorithm, you do not have to do anything with this function you need to aware that this function return two variables:
- faceDetectAlgorithm: this is a algorithm that used to detect a human face
- video_stream: this is the video that camera captured
This function is used for trigger the camera shooting and pass the video into our algorithm. Do you remember the last function initialize_facedetection() provides you? You need to fill in the algorithm and video captured variables, for example, your working zone looks like this: you do not have to do anything with this function
- Your Beautiful work example!!!!!!!
- faceAlgorithm = faceDetectAlgorithm
- face_video_stream = video_stream
- Do not cross over me, thanks!!!!!!!!!!!!!!
After you finish your work, you can run MCU.py by press Run button in IDE or python3 MCU.py in command line. You can see a windows pop up, and if you show your face in the camera, a blue square will capture your face, you can checkout
After you set up your beautiful face, you press Enter, and the picture will captured and saved in local folder. Your step 1 is done!!!
In this step, there are two functions provided to you MCU.py
This function is used to initialize the s3 server, there are three variables you need to work with:
- Your Beautiful work should be under!!!!!!!
- region = 'put your region name here'
- access_key = 'put your access_key here'
- secret_key = 'put your secret_key here'
- Do not cross over me, thanks!!!!!!!!!!!!!!
- region is the location of s3 server, for now it should be 'cn-north-1'
- access_key is the id key that access the aws S3
- secret key is the password key that access the aws S3
All of them, should not expose to public, and it will not be provided in this document, you can find this information in Raspberry /home/pi/AIoTlab/paramters.txt.
Then you need to go into \AIoT-workshop\Lab2UploadPictureToAWSS3\s3.py locate function s3_init(region, access_key, secret_key) you need to fix the secret key parameter.
This function is used to transmit captured image (do you remember what you did in step 1 when you press Enter key ??), there are two variables you need to work with:
- Your Beautiful work should be under!!!!!!!
- imageName = 'the image you captured in step 1'
- groupid = 'which group you are in??'
- Do not cross over me, thanks!!!!!!!!!!!!!!
- imageName is the image that you captured in step 1 when you press Enter key, it is stored in your local folder named as "202001XXXXXXXXXX.jpg", you can either put imageName = "202001XXXXXXXXXX.jpg" or imageName = image_name
- groupid is the group number that you are in, for example, you are in group 1, you should write your code as groupid = 'group001'
Then your step 2 is done!!!!!!!!!!!!!!!!!!!!!!!!
An face image is not enough to identify yourself, you need extra information to show youself. And the information will trigger the publish to GCIT Family in Golden Pocket. There are two function you need to work with.
This function is used to initialize the IoT core connection. There are 5 variables that you need to work with:
- Your Beautiful work should be under!!!!!!!
- endpoint = 'put your endpoint here'
- port = 'put your port number here'
- root_cert= 'put your root certification location here'
- private_key= 'put your private key here'
- device_cert= 'put your device certification here'
- Do not cross over me, thanks!!!!!!!!!!!!!!
- endpoint is the address of IoT core, this information is important, it will be in a separate document.
- port is a number that you need to connect to IoT core, it will be in a separate document.
- root_cert is used to identify the server is the real server.
- private_key is used to unlock the message that received from servers.
- device_cert is used to let server identify the device is the real device. you can find all this information in Raspberry /home/pi/AIoTlab/
This function is used to transmit message to IoT core. There are four variables you need to work with:
-
Your Beautiful work should be under!!!!!!!
- thingname = 'your thing name should be here'
- groupid = 'which group you are in??'
- group_member_count = 'How many members in your group'
- member_names = 'you name, you team member 1 name, ...'
- blessing = 'what do you want to say, be careful, everyone can see ^_^'
-
Do not cross over me, thanks!!!!!!!!!!!!!!
-
Your Beautiful work should be under!!!!!!!
- You need to call Lab3AWSIoTconnectivity transmit_message_to_cloud() function to transmit your data
-
Do not cross over me, thanks!!!!!!!!!!!!!!
- groupid is the group number that you are in, for example, you are in group 1, you should write your code as groupid = 'group001'
- group_member_count is the information that you want to tell IoT core how many group members in your group, for example, group_member_count = '3'
- member_names is the names in your group, for example, member_names = 'roy, tom, ben'
- blessing is your imagination.
- the last step is you need to go into Lab3AWSIoTconnectivity and use transmit_message_to_cloud() function to transmit your data
Step 3 is done !!!!
In this step, there is no hands-on work to do.