* 1. Project function introduction
Using the National Technology ARM Cortex-M4 core chip N32G430C8L7, plus the USB voltage, current, and power meter implemented by Texas Instruments INA199A1, the simple RGB colored lights are expanded.
* 2. Project attributes
Jiali Chuang 2022 Summer Training Camp
* 3. Open source agreement
GPL 3.0
* 4. The hardware part
uses LiChuang EDA professional printing. The expanded RGB colored lights, each color LED shares an IO and is driven by a transistor.
*5. Compilation environment for software
:
Keil uVision V5.25
Burning tool:
Pwlink2
Reference code:
[1] Training camp example project "N32G430C8L7-USBMeter"
[2] National Technology official example: n32g430_EVALexamplesGPIOLed_Blink
[3] National Technology official example: n32g430_EVALexamplesTIMTIM_DemoTIM_Basic
The extended LED color light code is as follows:
void led_rgb(uint32_t x) //Lighting program { switch(x) { case 1: LED1_ON; LED2_OFF; LED3_OFF; //Red break; case 2: LED2_ON; LED1_OFF; LED3_OFF; //Green break; case 3: LED3_ON; LED1_OFF; LED2_OFF; //Blue break; case 4: LED1_ON; LED3_ON; LED2_OFF; //Blue and red break; case 5: LED1_ON; LED2_ON; LED3_OFF; //Red and green break; case 6: LED2_ON; LED3_ON; LED1_OFF; //Green and blue break; case 7: LED1_ON; LED2_ON; LED3_ON; //Red, green and blue break; default: break; }}
void TIM6_IRQHandler(void) //Timer interrupt service function{ static uint32_t tt = 1; if (TIM_Interrupt_Status_Get(TIM6, TIM_INT_UPDATE) != RESET) { TIM_Interrupt_Status_Clear(TIM6, TIM_INT_UPDATE); cnt++; //cnt is a global variable if(cnt>50) //Set timing { cnt = 0; tt++; if(tt>7) tt = 1; led_rgb(tt);//tt ranges from 1 to 7, corresponding to 7 colors } }}
-------------------------------------------------------------------------------------------------------------------
I originally planned to make a PWM gradient light, but because the MCU's IO port was not independently led out and the MCU was below the screen, it brought great inconvenience to debugging. After a long time of tossing and turning without progress, I finally changed to a relatively simpler RGB light.
After the physical object was completed, after many tests,
the voltage value displayed by the power meter OLED was 0.2V to 0.3V higher than the value measured by the multimeter when powered by a mobile phone charger, and
the current value displayed by the OLED was basically the same as the value measured by the 200mA gear of the multimeter. In the third photo, the power meter current was 0.11A, and the multimeter measured 113mA.
The overall accuracy of the USB power meter meets personal use needs.
I participated in this training camp and got a very practical measuring tool. This training camp is really worth it! Thanks to Jiali Chuang & National Technology!
-------------------------------------------------------------------------------------------------------------------
Actual photos are as follows:
6. BOM list
* 7. Competition LOGO verification
* 8. Demonstrate your project and record it into a video and upload it
to B station link: https://www.bilibili.com/video/BV1AS4y1s72h?spm_id_from=333.337.search-card.all.click&vd_source=52d9aa1d12b4e4017271eb13df97e091