-
Demonstration Video
08/20/2020 at 12:52 • 0 commentsIt is approaching the end of the Cypress PSoC 6 contest. I would like to end it off nicely with a demo video of how my system functions.
I really learnt a lot from this contest. Do let me know what you think to!
-
Overall Block Diagram
08/15/2020 at 13:19 • 0 commentsTo wrap off, I decided to revisit the block diagram of the finalized system.
I hope this makes it clearer to you how my entire system operates
-
The Final System setup is done!
08/10/2020 at 06:21 • 0 commentsIn the previous log, I received the RFID module and got it working with the Cypress board.
RFID Scanner LCD Interface.
Now, I created a nice GUI screen to interact with it.
- Scanning items - RFID scanner is waiting for changes
- Updating - when the item is not found in the inventory, it will update accordingly
- Successful - the update has been completed.
Final Enclosure with Stand
Previously I also made an enclosure for the Cypress development board
- (See this log: https://hackaday.io/project/171810-fimble/log/180959-paper-craft-enclosure-case-design)
I thought I should make one for the RFID scanner and then place everything nicely together.
Placing inside the box (module on a breadboard, with flexible wires).
After mounting everything.
The system is mounted on a stand.
And it can be powered using a power bank battery.
More pictures.
And how the scanner interface looks like
In the next update, I will wrap up the remaining codebase and hopefully create a demo video in the next week for the judges to see.
-
MFRC522 RFID Reader
08/08/2020 at 10:28 • 1 commentChange of Plans
I initially wanted to use the "SparkFun Simultaneous RFID Reader - M6E Nano", however my local Sparkfun resellers do not plan to bring in any stock. I chose that RFID reader because it was a UHF long range RFID reader which will be needed if my smart inventory system is placed in a large storage space. It is unfortunate that I couldn't get one. Many other UHF RFID readers on the market are meant for industrial use and I cannot possibly afford it (costing from a few hundreds to thousands of dollars). I wanted to at least have a fully working prototype, so I had to look for alternatives.
Furthermore, I realised that the Cypress PSoC 6 Kit does not have a lot of GPIOs left. This is because the LCD display module takes up most of the pins. I found out there are no exposed hardware UART pins, SPI pins or I2C pins. (Technically, I can share I2C with the one for the KitProg).
With the constrain on the pins, I decided to choose the MFRC522 RFID Reader module which requires only SPI. SPI is very easy to bit-bang and I am familiar with the MFRC522 because I have used once when I first started with Arduino programming.
Testing the MFRC522 Module
I first verified that my module works using the Arduino examples.
And it works, so I ported the Arduino C++ library to a C library so I can use it with my Cypress PSoC.
As for wiring, I tapped off VDD and GND from the Pmod connector. I wanted to avoid soldering, so I used long socket pins to make a friction fit.
For the SPI pins, I connected it as follows:
- MOSI = P6_2
- MISO = P6_3
- SCK = P9_6
- SDA = P9_7
- RST = P13_7
Shown in the above picture is the debug screen. The RFID card UID is being read.
That is it for today. The hardware is 100% completed for this project. The next post will be to have the RFID reader upload the card detected to AWS. I will then simulate an inventory with RFID tags and make a demo video for you to see soon!
-
AWS S3 For Flutter Web App
07/30/2020 at 08:39 • 0 commentsWhen I created the Flutter Android App, I thought of cross-platform as one of my reasons for trying out Flutter.
I read that Flutter Web is still in early support, however, it will be good to try it out. I want to see how to host it on Amazon Web Services itself. If I can host my app on AWS, it will turn my project into a fully serverless and cloud-based concept.
Adding Web support to my Flutter App
To add web support, first I ran these commands in my flutter app directory.I followed this guide: https://flutter.dev/docs/get-started/web
Run the commands:
$ flutter channel beta $ flutter upgrade $ flutter config --enable-web $ flutter devices $ flutter run -d web-server --release
Hosting on AWS S3
In the end, I chose AWS S3 as a suitable service because I realised that I can generate the Flutter app as a static webpage.I followed this guide closely to set up the S3 bucket, permissions and properties:
Go to S3 console and create a new bucket
Under properties, I enabled static web hosting. I went with all the default settings
Here, we can see that it is enabled afterwards
We need to allow public access, so I went to permissions to edit the bucket policy.
I modified to have this bucket policy for my use-case:
{ "Id": "PolicyForPublicWebsiteContent", "Version": "2012-10-17", "Statement": [ { "Sid": "PublicReadGetObject", "Action": [ "s3:GetObject" ], "Effect": "Allow", "Resource": "arn:aws:s3:::cypress-psoc/*", "Principal": "*" } ] }
I then uploaded all the files from the build directory: ./flutter_fimble/build/web/
And as simple as that, my app is now hosted online live! It was way easier than I thought!
-
Flutter Android App for Smart Inventory
07/22/2020 at 13:09 • 2 commentsAs of now, most part of my project is done. For the hardware side, the only missing piece is the RFID reader which I have yet to receive due to issues with shipping delays. All the code is working perfectly and interfaced with AWS cloud so I will say it is 90% done for the hardware.
My next plan was to make an Android app which will keep track of all the inventory items in the system. I have had experience coding Android apps before. But for this I decided to try something new and use Flutter which is a new framework which is cross-platform for Android, iOS and web apps.
Today, I finally completed my app and it is looking great. I will describe the features below.
Run-through of the app
This is the run-through of each page of the app. There are 3 major features which I will propose for my project.
Inventory Page
The first page will show all the items currently inside the inventory (eg. items inside your smart fridge). When the user clicks on an item, there will be a description of the item and also nutritional values of the food item.
Statistics Page
This page will display the settings of temperature control of the storage area. It is useful especially for sensitive food items which need to be stored at a certain temperature.
A breakdown of the category of the items can also be derived via analytics from all the data gathered through this smart inventory system.
Overview Page
Working principles behind the app
The app makes use of AWS API Gateway which serves a HTTP page to retrieve the items from the database dynamically. A lookup table is implemented to provide the item image and description for the user. In practical use, there are also online databases with thousands of food nutritional labels which can be made use by the app.
A possible further improvement will be to host the app on the AWS platform itself, and make it truly a cloud solution. As I mentioned earlier, I used Flutter which allows making Web Apps. Using AWS EC2 or S3 may be a possible service to host it on. But I will focus on getting the final bits of my project working first, and try it out only if I have additional time.
As usual, the source code is posted in my Github repo, feel free to take a look and discuss with me.
-
Paper Craft Enclosure Case Design
07/18/2020 at 12:15 • 2 commentsOut of curiosity, I took a look at what other people were doing for this contest. I was inspired by this project log in the Nanodrone project. In the link below, the author designed a case for 3D printing.
I wanted to do something similar but I didn't have a 3D printer. And also all the Makerspace facilities near my home are closed due to the coronavirus situation. I decided to create a paper craft version of it. I can print it on colored stock paper.
Final Design of Paper Craft Enclosure
Thus, here is my design for the paper craft enclosure for the Cypress PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WiFi-BT).
The original files can be found open-source on my github repository. Feel free to download it and make one yourself!
Initial prototype using paper
Final prototype using card stock
-
Temperature/Humidity using DHT11
07/18/2020 at 02:36 • 0 commentsThis is just a quick post on adding DHT11 wiring to my board and my plan is to connect it to AWS.
In my Android app, I thought it will be good to know the analytics of temperature/humidity of my smart inventory fridge.
First, let's look at the DHT11 pinout -- it needs 3 wires and a pull up resistor.
And then I looked at the PSoC pinout.
With the LCD in place, I chose the bottom left corner pin, P13_6, which is unused by the LCD. Many other pins are used up by the LCD.
And for VCC and GND, I used the Pmod connector VCC and GND.
Final pinout.
I will then add the code and upload the data on to AWS.
In my next post, I will finish the basic outline of my Android app.
-
emWin Bitmaps using Python script (cross platform)
07/10/2020 at 09:06 • 0 commentsI wanted a nice splash screen for my project. I wanted to test the bitmap capabilities of the emWin driver, because I can see that it allows bitmaps to be displayed.
There is a Segger emWin Bitmap Converter, but there are some issue with it.
(1) It is Windows-only, and I am running my setup on Linux.
(2) It is a demo version, which shows a demo watermark.
As a hobbyist, I cannot afford the full version of the Bitmap Converter, hence I tried to derive the bitmap format myself and create an open-source cross platform using a Python script.
I referred to these sources which show how emWin bitmaps C files are generated.
- https://github.com/OpenNuvoton/NUC126BSP/blob/master/Library/NuEdu/emWin/tslib/nuvoton_logo.c
- http://www.pixfonter.net/bitmap-converter/user-manual/image-emwin.html
- https://github.com/STMicroelectronics/STM32CubeL4/blob/master/Projects/32L4R9IDISCOVERY/Demonstrations/STemWin/Gui/Core/power_measurement/generated/slide/arrow_right_gray.c
From here, I can understand that I can have different formats of color encoding (for example, ARGB888, RGB565). The emWin LCD driver is very powerful too as it supports color palettes to compress bitmaps to a smaller size.
I implemented these into my python script. https://github.com/zst123/Project_Fimble/tree/master/emWin-Converter/
Here's the result from my work today.
-
AWS API Gateway to DynamoDB
07/04/2020 at 06:44 • 0 commentsSince my app is of a food tracking system, I eventually need to implement an Android app to show an overview of what is inside the fridge inventory.
I am planning for a HTTP API for (perhaps) an Android App to access. The request flow will be like this.
- Android app → HTTP Request → AWS API Gateway → AWS Lambda → AWS DynamoDB
I will try out AWS API Gateway today to retrieve contents in the AWS DynamoDB database.
(1) Create Lambda to be invoked by API Gateway.
Go to Lambda console
- Function > Create function
- Function name: CypressPsocApiLambda
After creating the lambda go to IAM console
- Access management > Roles > Permissions > (Click on the function name)
- Attach policy: AmazonDynamoDBFullAccess
(2) Create API Gateway and integrate it to Lambda
Navigate to the API Gateway service console, and choose Create API. In API name, type CommentsApi and type a short description. Finally, choose Create API.
- HTTP API > Build
- API name: CypressPsocApi
- Stage name (leave as default)
Create a route
- GET request: /retrieve
Create and attach and integration
- Integration with: Lambda function > Choose “CypressPsocApiLambda”
(3) Edit Lambda to parse DynamoDB items
I used the document client to scan for the table name. This retrieves all the items without any filters. Perhaps I'll add a filter parameter in if I need it in the future part of this project.
And now, I can go to the /retrieve page and I see all the test entry in my database.
For next time, I want to do up the android app and also the RFID portion of the PSoC device.