element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Low Power IoT Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Low Power IoT Design Challenge
  • More
  • Cancel
Low Power IoT Design Challenge
Blog Blog#4 - BPM Display - System Implementation and Testing
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: skruglewicz
  • Date Created: 3 Nov 2021 4:00 AM Date Created
  • Views 1074 views
  • Likes 1 like
  • Comments 0 comments
  • roadtest psoc6
  • psoc 6 pioneer kit
  • skruglewicz
Related
Recommended

Blog#4 - BPM Display - System Implementation and Testing

skruglewicz
skruglewicz
3 Nov 2021

    image      imageimage

BLOG# 4 - BPM Display - System Implementation and Testing

A Heart Rate Monitor Display project utilizing the PSoCTm 6S2 + AIROCTm Wi-Fi/Bluetooth Pioneer Kit

manufactured by CYPRESS - INFINEON TECHNOLOGIES (Part# CY8CKIT-062S2-43012)

 

This is my 4th blog post for this Design Challenge: Low Power IoT Design Challenge

version 1.3

<<< PREVIOUS BLOG

NEXT BLOG  >>>

Blog#3 - BPM Display - System Design

Blog#5 - BPM Display - Conclusion and Future Enhancements

image

  • This blog will describe the Testing and implementation phases of my design idea.
  • I will be following the path of my design from my previous Blog# 3
  • I'll be using the research from Blog# 2, to implement my idea.
  • To review, my idea is basically
    • To take a heart rate reading from a sensor
    • Calculate a Beats Per Minute value
    • Send the BPM data to the PSoC6 EVK. Using the UART on the Kit
    • Use the FreeRTOS Operating System on the kit:
      • to send the data trough the kit using:
        • Triggers
        • Scheduler
        • Message Queue
        • MQTT client to connect to and send the data to AWS.
  • The Design includes:
    • Two separate MCU kits that use different Embedded Development Paradigms
      • 1. The Arduino Nano 33 IoT Board
        • Uses the Arduino IDE which uses the Python Scripting Language.
        • The application is a Bare-Metal Python script using the Libraries supplied by the Heart Rate Vendor
      • 2. The Cypress PSoC 6 EVK
        • Uses the ModusToolBox IDE using the C/C++ language
        • The application uses an OS (FreeRTOS), and a compiled C/C++ project using the BSP (Board Support Package) for the OS, UART and Anycloud (AWS) support.

 

image

  • Electronics build
  • Software Programming
  • Testing
    • Electrical
    • Software
    • Run the Application Front to Back
      • Run the application and compare the BPM to another BPM app if possible.
      • Conclusions
        • Any Problems?
  • Conclusions and Summary
    • Summary
    • Conclusions
  • Appendices
    • Appendix A -  MosQuiTToTm An open source MQTT broker
    • Appendix B - AnyCloud MQTT Client example in ModusToolbox.
    • Appendix C- Setting up the MQTT Broker -- AWS IoT MQTT
      • Set Up the MQTT Device
    • Appendix D - Solution Project From a PSoC6 blog Series.
          • CONTINUE
  • REFERENCES
    • Jan Crumps PSoC 6 Series.
      • PSoC 6 and ModusToolbox: UART receiver with FreeRTOS
      • PSoC 6 and ModusToolbox: FreeRTOS message queue
      • PSoC 6 and ModusToolbox: FreeRTOS to AWS MQTT
      • PSoC 6 and ModusToolbox: UART receiver with FreeRTOS - Deep Sleep support
      • NanoDrone II PSoC 6
    • Mosquitto Documentation
      • mosquitto - running the Mosquitto broker
      • mosquitto.conf - the Mosquitto broker configuration file
      • mosquitto_passwd - command line utility for generating Mosquitto password files
      • mosquitto_pub - command line utility for publishing messages to a broker
      • mosquitto_rr - command line utility for simple request/response with a broker
      • mosquitto_sub - command line utility for subscribing to topics on a broker
      • mosquitto-tls - brief cheat sheet for creating x509 certificates
      • mqtt - description of MQTT features
      • MQTT Client Example
      • GitHub repo
      • README.md

 

Electronics build

 

  • This Section describes how I attached the 2 boards together

    • .imageimage
  • Connect the 2 kits together referring to the wiring diagram from blog#3
        • connect a jumper wire between the 3.3 V Arduino GND to a PSoC 6 GND pin
  • connect a jumper wire between the Arduino TX pin to  PSoC 6 UART RX pin

 

 

 

 

 

 

 

 

 

 

Software Programming

 

  • My approach will be to implement Jan Crumps blog series on the PSoC 6 kit:
    • FROM Front -- UART receiver
    • TO Back -- AWS server.

10/15/2021 - Checkpoint

  • I'm running out of time to implement my idea fully. The deadline  for the end of the Design Challenge is approaching.
  • If I can successfully get test data through Jan's application then I can loop back around and make the changes to the Arduino board as suggested in my design.
  • The complete application from the PSoC6 Series is in the GitHub repo referred to in Appendix D - Solution Project From a PSoC6 blog Series.
    • the 3 areas of the example I will focus on are:
      • Implement a UART Receiver for incoming serial data from the Arduino design.
        • imageTODO Need to define and test the Pin connections on the PSoC6
      • Use of FreeRTOS Scheduling, Messaging, Semaphores and Triggers.
      • Changes to the AnyCloud MQTT Client example to Publish data from an RTOS message queue using the AWS MQTT service.
  • Before getting this application running, I experimented and tested the AnyCloud MQTT Client example
    • I loaded AnyCloud MQTT Client example in ModusToolbox.
      • I spent considerable time to get this example to run.
      • Refer to Appendix B - AnyCloud MQTT Client example in ModusToolbox
    • Download/Install mosquitto MQTT Broker, to be used as a test local broker.
      • Learn/experiment with it
      • Installed it on my local windows machine
      • Refer to  Appendix A -  MosQuiTToTm An open source MQTT broker
    • Use AWS IoT MQTT Broker instead of MosquiTTo for the Anycloud MQTT Client Eample
      • Refer to Appendix C- Setting up the MQTT Broker -- AWS IoT MQTT

 

Testing

Electrical

    • Test the wiring
      • Are the Pins correct?
    • Use the code attached at the end of PsoC6 series blog PSoC 6 and ModusToolbox: FreeRTOS message queue To test the Jumper Wire Connections between the Arduino and the PSoC6 kit.
    • The Project archive is  ENRICO_UART_FREERTOS_20210318.zip

    • Load the project into ModusToolbox and run it.

    • It's configured for: UART 5.0 and 5.1 (the Debug USB COM port), 9600 / 8 / 1 / N

    • If you want to use other pins, check uart_task.h. Theres's an example for pins 10.0 and 10.1 that you can use as inspiration...

 

Software

          Test scripts to do the following test

    • UART Receiver for incoming serial data
    • FreeRTOS
      • Scheduling,
      • Messaging,
      • Semaphores and Triggers.
    • Use the AnyCloud MQTT Client example
      • Publish data from an RTOS message queue to the AWS MQTT service.

Run the Application Front to Back

Run the application and compare the BPM to another BPM app if possible.

      • Change the code on the Arduino to send the BPM Value over the serial connection.
      • Observe the values on the AWS MQTT Broker
        • Open the TEST link on the AWS IoT Console to see the values.

Conclusions

      • I had a few Roadblocks and the design was more difficult to implement than I had expected.
      • I was able to get the Heart rate Sensor BPM values through the PSoC6 onto the AWS MQTT Broker.

Any Problems?

        • I had problems that were resolved.
        • I had problems:
          • With the MosQuiTTo broker working with the Anycloud mQTT Client example, I could not get the example to connect to the broker.
          • With the AWS IoT thing configuration, that I finally figured out.
          • With the PSoc^ series example, Building and executing it
          • With The BSP importing the PSoC6 series Example.
          • The Connection with the UART.

   

Conclusions and Summary

 

Summary

  • Started by seeing what I needed to do to implement my idea.
  • Came up with the outline for this blog.
  • For the software section i decided to get Jan Crumps - PSoC6 series example to run.
  • I ran into problems right away.
  • I started on the AWS implementation and Had error connecting to my WIFI router
  • I decided to use a local MQTT broker"Mosquitto" for testing.
  • I was able to configure it but did not get it connected
  • I then tried to run the PSoC8 Example to build in ModusToolbox and started getting BUILD errors that Files are Missing?
  • I decided to use the AnyCloud MQTT Client and a thing on AWS IoT cload. I did get this to run.

 

Conclusions

  • I have changed my path to my original idea for a project for this Design Challenge from the project idea mentioned in my application for this challenge.
  • I decided to use the Arduino project from another challenge because it was displaying a BPM value on an LED display.
  • I originally thought to move the entire design (Heart Rate Sensor, OLED display, and Software ) to the PSoC6.
  • I then discovered Jan Crumps series of Blogs describing connecting an Arduino serially to the PSoC6 and sending data thru the board to the CLOUD.
  • So in researching his series in blog#2 I realized that, If I used his example I could use my Arduino project to gather the BPM data and pass it thru his Design.
  • Not so easy, I ran into all kinds of snags. Not with his code but with getting the components of his design to work.
  • This was due to my lack of experience with the:
    • PSoC8 kit
    • ModusToolbox
    • FreeRTOS
    • UART
    • MQTT
    • AWS IoT
    • a local MQTT Broker MosQuiTTo
  • I have learned a great deal from implementing his Blog Series Example.

 

Appendices

Appendix A -  MosQuiTToTm An open source MQTT broker

This appendix contains my experiences with using A local installation of the moscuitto MQTT broker

  • install
  • read documentation
  • run
    • mosquitto_pub
    • mosquitto_sub
  • configure
    • configs/MQTT_client_config.h see man page mosquitto.conf

 

Appendix B - AnyCloud MQTT Client example in ModusToolbox.

This appendix describes my experiences with the example

    • It serves two purposes:
      • you have an example,
      • and it takes care that the dependencies are all available in your workspace.
    • Load the example "" AnyCloud MQTT Client:" from the template Application list
      • If your not sure how to do this, I describe it in my blog#2 section Create a "New Application"
      • image
    • Follow its instructions to connect you to AWS MQTT. You'll need to do the exact same steps with other MQTT projects. If you know it works with the example, it makes the next steps easier.
      • GitHub example READ.me
      • Set up an AWS account.
      • Setup a AWS IoT thing called "ledstatus"
      • Make changes described in Appendix C- Setting up the MQTT Broker -- AWS IoT MQTT
      • Run the example.
      • Observe the results described in the READ.me file.

 

 

Appendix C- Setting up the MQTT Broker -- AWS IoT MQTT

This appendix describes my experiences with setting up the AWS IoT MQTT connection to be used with the example.

Set Up the MQTT Device

  • Set up the MQTT device (also known as a Thing) in the AWS IoT Core as described in the https://docs.aws.amazon.com/iot/latest/developerguide/iot-gs.html.

Note: While setting up your device, ensure that the policy associated with this device permits all MQTT operations (iot:Connect, iot:Publish, iot:Receive, and iot:Subscribe) for the resource used by this device. For testing purposes, it is recommended to have the following policy document which allows all MQTT Policy Actions on all Amazon Resource Names (ARNs).

  • {

        "Version": "2012-10-17",

        "Statement": [

            {

                "Effect": "Allow",

                "Action": "iot:*",

                "Resource": "*"

            }

        ]

    }

  • In the configs/mqtt_client_config.h file, set MQTT_BROKER_ADDRESS to your custom endpoint on the Settings page of the AWS IoT Console. This has the format ABCDEFG1234567.iot.<region>.amazonaws.com.
  • Set the macros MQTT_PORT to 8883 and MQTT_SECURE_CONNECTION to 1 in the configs/mqtt_client_config.h file.
  • Download the following certificates and keys that are created and activated in the previous step:
    • A certificate for the AWS IoT Thing - xxxxxxxxxx.cert.pem
    • A public key - xxxxxxxxxx.public.key
    • A private key - xxxxxxxxxx.private.key
    • Root CA "RSA 2048 bit key: Amazon Root CA 1" for AWS IoT from CA Certificates for Server Authentication.
  • Using these certificates and keys, enter the following parameters in mqtt_client_config.h in Privacy-Enhanced Mail (PEM) format:You can either convert the values to strings manually following the format shown in mqtt_client_config.h or you can use the HTML utility available here to convert the certificates and keys from PEM format to C string format. You need to clone the repository from GitHub to use the utility.
    • CLIENT_CERTIFICATE - xxxxxxxxxx.cert.pem
    • CLIENT_PRIVATE_KEY - xxxxxxxxxx.private.key
    • ROOT_CA_CERTIFICATE - Root CA certificate

----------------------------------------------------------------------------------------------------------------------------------------------

 

Appendix D - Solution Project From a PSoC6 blog Series.

CONTINUE

This appendix describes my experiences with the  entire FreeRTOS implementation project by Jan Crumps.

 

The firmware is available on github: https://github.com/alicemirror/Nanodrone-II_PSoC6

.

After cloning and importing the project into your workspace, perform these activities in the Quick Panel:

  • open the Library Manager and click Update. Close when finished.
  • click Refresh Quick Panel.
  • update mqtt_client.h with your Amazon certificates, and wifi_config.h with your WiFI settings, as you'd do for the AnyCloud MQTT Client example.
  • click Build Nanodrone-II_PSoC Application.

10/20/2021 - I Ran into a SNAG

The Project Won't build?

  • DETAILS:
  • when trying to follow step 1 above "open the Library Manager and click Update. " I get the following error.
  • image

Solution

  • I worked through this problem with the author of the code with Jan Crumps
  • In short there was a problem with one of the HTTPS libraries used in ModusToolbox 2.3 and the BSP.
  • This caused the author, Jan Crumps to change the Project to work with ModusToolBox 2.4 and the BSP 3.X
  • The project is available on the GitHub repo:
    • version 3.1.0 - adapted to ModusToolbox 2.4 and BSP 3.X
  • I reinstalled ModusToolbox 2.4 and imported the project ino my workspace
  • I was able to build the project
  • I Ran the application.

 

 

REFERENCES

Jan Crumps PSoC 6 Series.

  • PSoC 6 and ModusToolbox: UART receiver with FreeRTOS

    • using the UART
  • PSoC 6 and ModusToolbox: FreeRTOS message queue

    • FreeRTOS message queue
  • PSoC 6 and ModusToolbox: FreeRTOS to AWS MQTT

    • Describes using the AWS MQTT broker to publish the message queue data to the cloud.
    • use the GitHub repo:
      • version 3.1.0 - adapted to ModusToolbox 2.4 and BSP 3.X
  • PSoC 6 and ModusToolbox: UART receiver with FreeRTOS - Deep Sleep support

    • Deep sleep implemented
  • NanoDrone II PSoC 6

    • The GitHub repo contains the Final code for the implementation of the design of  the PSoC6 Series blogs.
    • The READ.me contains all the instructions on running the project.

Mosquitto Documentation

man pages

  • mosquitto - running the Mosquitto broker

  • mosquitto.conf - the Mosquitto broker configuration file

  • mosquitto_passwd - command line utility for generating Mosquitto password files

  • mosquitto_pub - command line utility for publishing messages to a broker

  • mosquitto_rr - command line utility for simple request/response with a broker

  • mosquitto_sub - command line utility for subscribing to topics on a broker

  • mosquitto-tls - brief cheat sheet for creating x509 certificates

  • mqtt - description of MQTT features

MQTT Client Example

  • GitHub repo

    • This code example demonstrates implementing an MQTT Client using the AnyCloud MQTT Client library. MQTT
    • The library uses the AWS IoT Device SDK MQTT Client library that includes an MQTT 3.1.1 Client.
  • README.md

    • Example documentation

 

<<< PREVIOUS BLOG

NEXT BLOG  >>>

Blog#3 - BPM Display - System Design

Blog#5 - BPM Display - Conclusion and Future Enhancements
  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube