Restroom odors are a huge deterrent to your customers. Walking into a stinky restroom ruins your customer’s experience & lowers their impression of your whole business.
This can be very frustrating and embarrassing for anyone who is in a rush to the Restroom but smells bad. although there are people working on Restroom cleaning. Sometimes they are late to clean the toilet so it smells bad
HardwareFor this project we need hardware (price is only estimated, you can check in online store)
Figaro 2600 series is a new type thick film metal oxide semiconductor, screen printed gas sensor which offers miniaturization and lower power consumption. The TGS 2602 has high sensitivity not only to air contaminants which are emitted by cigarette smoke, but also to low concentrations of odorous gases such as ammonia and H2S generated from waste materials in office and home environments.
After solder in matrix pcb, have 3 output cable (Red for 5V, Black for gnd and Yellow to analog data). and connect to P10_5.
Software
Choosing an IDEModusToolbox™ software, the latest-generation toolset, includes the Eclipse IDE and therefore is supported across Windows, Linux, and macOS platforms. Eclipse IDE for ModusToolbox™ is integrated with quick launchers for tools and design configurators in the Quick Panel. for software can download https://www.infineon.com/cms/en/design-support/tools/sdk/modustoolbox-software/
After download software and install, we can run Eclipse IDE for ModusToolbox™, this a resume how to run hello word from Eclipse IDE for ModusToolbox™ to PSoC™ 6 62S2 Wi-Fi BT Pioneer Kit. (image picture slide)
- pic 1. Select browse directory as workspace, can use dafult in mtw or create new folder. skip this is use default, and click launch
- pic 2. after selected directory click lauch
- pic 3. Eclipse IDE is open, click New Application
- pic 4. Because we use board CY8CKIT-062S2-43012 so choose this in board Support Package (BSP)
- pic 5. Choose hello world to first try, and then click Create
- pic 6. click Main.c to see program default and try to build hello world application
- pic 7. make sure that program was build in no error
- pic 8. Connect USB from computer to board CY8CKIT-062S2-43012 and see led1 (power) led2 (kitprog3) is on
- pic 9. upload to board click hello world program (kitProg3_MiniProg4)
- pic 10. if LED 8 is blinking its mean success to upload from example hello world
Because Hello World program code example demonstrates simple UART communication by printing a "Hello World" message on a terminal and blinks an LED using a Timer resource using PSoC™ 6 MCU. so we can try about serial communication.
First Install Tera Term Open Source Project (https://ttssh2.osdn.jp/index.html.en), and then run
- pic 1. Tera Term application, choose Serial and make sure port usb is connected
- pic 2. Choose baudrate 115200 and then click New Setting
- pic 3. Tera Term default after connect
- pic 4. please push button reset
- pic 5. Hello world is shown in Tera Term
- pic 6. if press 'Enter' in keyboard Led Blinking is paused
- pic 7. if press 'Enter' again in keyboard Led Blinking is resume
For other project like how to access RGB led, GPIO, and other sensor can see in infineon academy (https://media.infineon.com/channel/89141/infineon-academy/1)
SensiML,first open browser (https://sensiml.com/) create account and sign in
and for data capture in your computer you need download SensiML Data Capture Lab (https://sensiml.com/download/)
Preparation forProgramming
because this project I need display ini oled (built in CY8CKIT-028-SENSE kit), sensor TGS2602 with ADC reading sensor, Led RGB (built in CY8CKIT-062S2-43012). please select libraries
After check middleware and peripheral please click update, wait until completed prosses.
Function retarget-ioin peripheral
A utility library to retarget the standard input/output (STDIO) messages to a UART port. With this library, you can directly print messages on a UART terminal using printf(). You can specify the TX pin, RX pin, and the baud rate through the cy_retarget_io_init() function. The UART HAL object is externally accessible so that you can use it with other UART HAL functions. For detail instruction can see (https://github.com/Infineon/retarget-io)
Function display-oled-ssd1306in peripheral
This library provides functions to support the 128x64 pixel dot matrix OLED display driven by SSD1306 controller. This is the same display as used on the CY8CKIT-032 shield. The library has been designed to work with 3rd part graphics libraries including emWin and u8g2.
Function emWin in midleware LibrariesemWin is an embedded graphic library and graphical user interface (GUI) framework designed to provide an efficient, processor- and display controller-independent GUI for any application that operates with a graphical display. For detail instruction can see (https://github.com/Infineon/emwin)
Function rgb-led in peripheralThis library provides functions for controlling an RGB LED. This library implements color mixing and brightness control using the PWM blocks. For detail instruction can see (https://github.com/Infineon/rgb-led)
After libraries set, now we can test one by one function
Test IO - RGB Ledand Button (user btn2)
try access IO with button (user btn2 and user btn1) to turn on RGB led and oled display
#include "cybsp.h"
#include "mtb_ssd1306.h"
#include "GUI.h"
#include "cy_rgb_led.h"
int main(void)
{
cy_rslt_t result;
cyhal_i2c_t i2c_obj;
bool read_val;
bool read_val2;
/* Initialize the device and board peripherals */
result = cybsp_init();
CY_ASSERT(result == CY_RSLT_SUCCESS);
/* Initialize the I2C to use with the OLED display */
result = cyhal_i2c_init(&i2c_obj, CYBSP_I2C_SDA, CYBSP_I2C_SCL, NULL);
/* Initialize the OLED display */
result = mtb_ssd1306_init_i2c(&i2c_obj);
CY_ASSERT(result == CY_RSLT_SUCCESS);
__enable_irq();
GUI_Init();
// Initialize pin as an output
cyhal_gpio_init(CYBSP_LED_RGB_GREEN, CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_STRONG, false);
cyhal_gpio_init(CYBSP_LED_RGB_RED, CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_STRONG, false);
// Initialize pin as an input
cyhal_gpio_init(P0_4, CYHAL_GPIO_DIR_INPUT, CYHAL_GPIO_DRIVE_NONE, false);
cyhal_gpio_init(P1_4, CYHAL_GPIO_DIR_INPUT, CYHAL_GPIO_DRIVE_NONE, false);
// Read the logic level on the input pin
for(;;)
{
read_val = cyhal_gpio_read(P0_4);
read_val2 = cyhal_gpio_read(P1_4);
cyhal_gpio_write(CYBSP_LED_RGB_GREEN, read_val);
cyhal_gpio_write(CYBSP_LED_RGB_RED, read_val2);
GUI_DispFloat(read_val, 1);
}
}
For test read analog (ADC) data can see this instruction (https://github.com/Infineon/mtb-example-psoc6-adc-basic)
Test Machine LearningMachine learning with sensiML we can follow example in project creator after choose BSP
and then we can follow instruction to training data and captured data like Webinar: Implementing Machine Learning on the Edge with ModusToolbox™, Picovoice and SensiML. (https://www.hackster.io/videos/1152?mc_cid=258e89f4dd&mc_eid=b71f8f83c3)
Combine all partby part programming in main programming Project
Prepare running 2 mode because we need data capture and recognition
// Modes
// 1 = DATA CAPTURE => Use this mode for collecting data and use the Data Caputre Lab
// 2 = RECOGNITION => Use this mode for running a Knowledge pack from the sensor
#define DATA_CAPTURE_RUNNING_MODE 1
#define RECOGNITION_RUNNING_MODE 2
// Change the below to either DATA_CAPTURE_RUNNING_MODE (or) RECOGNITION_RUNNING_MODE
#define APPLICATION_RUNNING_MODE RECOGNITION_RUNNING_MODE
Data Capture and labelUse data capture lab and after capture live data we can open project explorer, because we use live labeling to get data so files according to each label.
print simple 3D for cover sensor
in the future this project will be update with many sensor like DHT sensor, and than get many data to run machine learning. Collect data use wifi connection.
Comments