Originally this project was planned to limit interrupts from colleagues. But slap-bang it's much more useful when working from home, e.g. due to the COVID-19 period.
Colored LEDs (WS2812, RGB) are synchronized with my Outlook calendar and show the status already at the entrance to my office. If 'red' (means busy), then better not to enter :-)
Project OverviewThe project consists mainly of two parts as shown by the simple block diagram.
1) A microcontroller is used to drive the WS2812 stripes. The color is controlled just by UART.
2) A C#-App reads the Outlook calendar status and sends the related control character via UART to the microcontroller. The tool also allows to override the calendar information and set the status manually. Of course, the brightness can be set, too.
PC Application 'GetOutlookCalendarStatus'The major important part of that project is to retrieve the calendar information from Microsoft Outlook calendar. As I am not a PC programming specialist, probably I did not solve it in the best way, but so far I have tested it successfully on different PCs and versions. The C# source and executable are attached.
If GetOutlookCalendarStatus.exe
is started first time, then GetOutlookCalendarStatus.cfg
is generated newly, otherwise an existing configuration file is read. It keeps the last set COM port and dimming value. The application will automatically connect to the microcontroller, if attached and if the correct COM-port is selected. The user can observe the connection status below the COM-Port number (Connected/Disconnected).
The Dimming value controls the brightness, from '0' as maximum to '4' presenting low brightness.
Most interesting, of course, is the status of the Outlook calendar, that is automatically retrieved if the 'Automatic' mode is selected. The actual calendar status is shown with bold text style. Alternatively, if the user like, the status can be set manually. In this case the Outlook calendar status is still shown with bold text, but the manual selected status will drive the related LED color
Microcontroller ProjectWell, working with Cypress' PSoC kits I remembered the KitProg that is part of the most Cypress Pioneer Kits, and works as the programmer unit for those kits. It is based on PSoC5LP.
Sometimes (e.g. Embedded World) Cypress gives that kits for free, or you can order for approx. 10-20USD from distributors.
Some suitable kits having the KitProg2 programmer:
Advantage of the CY8CKIT-149, it has a Micro-USB socket on board, that simplifies and improves the connection using a standard USB cable to the PC. The older KitProg2 implementation (e.g. CY8CKIT-145) can be connected directly to the PC-USB Host port, but that is sometimes a little groggy.
Cypress' KitProg2
Many people do not know that the KitProg2-Firmware, beside of the main purpose ('programmer'), includes additionally a bootloader that allows to add and run user-applications. This is described well in the user-guide that can be found on your computer, when you have installed the PSoC Creator IDE, that anyway is required to develop software for PSoC.
Depending on your installation path (e.g.: C:\Program Files (x86)\Cypress\Programmer\Documents\KitProg2 User Guide.pdf), find the User Guide and see chapter 'Developing Applications for PSoC 5LP' for details how to make a bootloadable application, how to change the KitProg2 from programmer mode to bootloader mode, and how to download the user-software.
Also an example project is provided by Cypress, depending on the installation path, e.g. C:\Program Files(x86)\Cypress\Programmer\Examples\Misc\KitProg2_Custom_App).
Software implementationKitProg2_CyOutlook_USB_UART_to_WS2812 is based on the KitProg2_Custom_App like described above. Following components have been added to implement the requirements:
- 1 x USBFS (CDC mode)By the virtual COM port the commands from the Windows application are received and routed to control the LEDs.
- WS281xLib.cylibThanks to Marc, this great library for PSoC4 and PSoC5 can be found on bottom of page https://www.ihastings.com/ws2812-leds/. It makes driving the intelligent WS2812/Neopixel by PSoC microcontroller very easy. You do not have to touch the library. It works perfect as is.
The PSoC Creator schematic is very clear and more or less self-explaining.
Depending on the received character the LEDs color and brightness are controlled.
If the user like, the LED colors can obviously changend in main.c.
typedef enum {
ColorFree = 0x0010FF10,
ColorTentative = 0x00FF8420,
ColorBusy = 0x00FF0000,
ColorOutOfOffice = 0x000000FF,
ColorWorkingElsewhere = 0x00C000C0,
} enColorRGB_t;
How to download the software (Bootloader)The CustomApp is not downloaded as normally by the PSoC Creator Programmer! It needs to be handled by the Bootloader Host tool that can be invoked from the PSoC Creator Tools menu.
On the KitProg2 the bootloader mode is started by pressing mode switch SW3 while power-up.
In case the sniffer software is running then the bootloader can be entered by pressing SW3 more than 5 sec, the status LED3 will light. Release SW3 and press it again short, the kit will reboot entering the bootloader mode what is indicated within the Bootloader Host tool.
Ensure that Port 'USB Human Interface Device 04B4_F146' is listed correctly.
Browse for the right file:
<project>\KitProg2_CyOutlook_USB_UART_to_WS2812.cydsn-> \CortexM3\ARM_GCC_541\Debug\-> KitProg2_CyOutlook_USB_UART_to_WS2812_2.cyacd
NeoPixel WS2812 LED stripesPrincipally all kind of WS2812 LEDs can be used. The data is output on P12.5 what is located next to GND and +5V on th eJ6 pin header, and makes it easy to wire between PSoC and LED Stripe.
Once again, Cypress PSoC Creator including existing software examples and libraries made it easy to realize a helpful gadget.
Well - that's it!... for the moment. Stay tuned! Stay safe and healthy!
Regards, Holger
Comments
Please log in or sign up to comment.