STM32 Timer Tutorial ⌚ // TRIAC Control ✅
Вставка
- Опубліковано 28 чер 2024
- ▬ I need your support ▬▬▬▬▬▬▬▬▬▬▬▬▬▬
If you like my videos, please like, share and subscribe.
One small click for you, one giant leap for me :)
🙏🙏🙏
▬ About this video ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Controller: STM32F407VGT6
Board: MikroE EasyMx PRO v7 for STM32
▬ More details ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
CubeMx project and source code available here:
embeddedlightning.com/linearis...
Looking forward to YOUR ideas / comments!
▬ My website ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
www.embeddedlightning.com
▬ LinkedIn ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
/ en - Наука та технологія
Top notch lecture!
Clear, concise, detailed, well-paced.
Simply wonderful. Thanks for sharing your knowledge in a such understandable and practical way. 👍
Thank you very much. Please like and share this video, so I can create more content like this. BR, Achim
I have never seen such training before, it was wonderful ❤💯
Beautiful
Thank you so much
Helpful video
Great video! Some time ago I was designing a phase controller for a PIC32 and, after obtaining the voltage equation v(a), I got stuck on the inverse function a(v). The LUT implementation seems like a great option! Thank you for sharing this knowledge.
I'm glad you like my video. BR, Achim
Awesome! I wish I had a professor just like you in college.
Thanks a lot for the kind feedback! If you like my videos, please support my channel by sharing it 🙏
I've used PIC18 for this type of project and always used opto-isolated zero-crossing detection circuit, based on simple optocoupler. I don't remember of accuracy of measurement/detection delay of z.c signal behind real z.c event, but it was not a big deal. Big deal was processing capability of PIC18.
Sure, PIC18 can also do the job, I just chose the STM32 for this tutorial.
@@AchimDoebler I've started recently to use STM32. Lot cheaper and better performance than for example dsPIC33. Not to mention bigger support and community.
I am hats off with this amazing explanation... you are one mentor for me to achieve this relation between power electronic and uC development I am really dream with achieve the 3 phase motor control as well as I want to have your knowledge regarding with lvds and ltdc peripheral to control dpi displays.
Thanks for your very kind feedback 🙏😊
its veeeeeery good❤
Thank you 😉
Is it possible to change the contain of the CRRx register in the fly ??? Say I decide the angle by a pot and a adc read
Amazing job, thank you Mr. Döbler. I need to execute for STM8S, what would you advice for me while getting help from your video for STM32 ?
What exactly do you mean here? Kind regards, Achim
Can Design Ebike
Hi. this video very good for technicial. I need funtion P(α) from excel file. U can help me?
Hi, your project is great, but can i use the zero capture circuit with opto.
@ཧᜰ꙰ꦿ➢ Thank you, can I ask if I need to change anything on STM32F103C8T6 using this code.
thanks for such a kind labor, soon ? when ?
Source code is now available!
Excellent work, wonderful tutorial. Is it possible to use you information to make a similar video in Spanish? Thank you
Thanks for the feedback. Well, you can use my material as long as your video references to this video / my channel. Also my video can be used with Spanish subtitles.
Buenas noches
@@AchimDoebler Thank you very much, I'll reference your video in my video description for sure.
It is the best video , really! but when i connect an LCD 20x4 VIA i2c, the lcd works fine but i dont have the pulses( output of the timer 1. What can i do? Danke ACHIM!
But in this video I don't show any I2C?!
omg
Danke ACHIM! I will write in english because the video is in english. I followed your video and i want to ask something if it is possible: You have made a code for zerocrossing detection, so you are generating 3 pulses in 20 ms and it works very fine. What i am trying to do is to give the pulses but 2 pulses in 20 ms. So, iam trying to detect only a positive edge modifying TIM1->CCER = 0x0001; // OC1: On, AH; IC2: On, Positive edges. It seems that work but with oscilloscope i see that's not perfect because casually appears 3 pulses in 20 ms. What i am wrong? Can you help me on this topic? Danke schön!
Hello Hans, yes, I know the reason for that. Could you please reach out to via email, because it's easier to communicate. Kind regards, Achim
@@AchimDoebler I wrote you Achim. if you can help will be my pleasure.Danke!
Firstable it is a very good job! congratulations brother!
Now i have a question: i want to change power variable from Potentiometer using ADC conversion! I have tried to do it but it doesnt function. Can someone help me?
HAL_ADC_Start(&hadc1); // Start ADC Conversion
HAL_ADC_PollForConversion(&hadc1, 1); // Poll ADC1 Peripheral & TimeOut = 1mSec
power=HAL_ADC_GetValue(&hadc1); // Read The ADC Conversion Result & Map It To power
HAL_Delay(1);
Have you enabled the ADC clock? Have you properly initialized the ADC and also selected the correct GPIO analog alternate functions?
@@AchimDoebler thanks for have answering.
int power=0;
void set_alpha( int alpha )
{
TIM1->CCR1 = alpha;
TIM1->ARR = alpha + SCR_PULSE_WIDTH;
}
/* USER CODE END 0 */
/**
* @brief The application entry point.
* @retval int
*/
int main(void)
{
int alpha;
HAL_Init(); // Initialize STM32 HAL
SystemClock_Config(); // Configure core clock
MX_TIM1_Init(); // Initialize Timer 1 (OC1 / IC2)
MX_GPIO_Init(); // Initialize GPIOs
alpha = alpha_lut[ power ]; // Get alpha from LUT
set_alpha( alpha ); // Generate alpha on output
while( 1 );
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_ETH_Init();
MX_USART3_UART_Init();
MX_USB_OTG_FS_PCD_Init();
MX_TIM1_Init();
MX_ADC1_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1,1000);
power = HAL_ADC_GetValue(&hadc1);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
i would read a potentiometer and put a value in power, in this way i am able to change alpha but doesnt work
i also have tried to do that :
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1,1000);
power = HAL_ADC_GetValue(&hadc1);
TIM1->CCR1 = power;
TIM1->ARR = power + SCR_PULSE_WIDTH;
I'm looking forward to the source code.
It will be uploaded on my website soon.
Source code is now available!
implementing it using stm32cubeide and HAL. But for some reason its not working as intended. I am using stm32f103c8
Well, I suggest you to directly try my code shown on an STM32F4 since it will immediately work on this platform and then slowly port the configuration step by step to your F1.
I actually made it work. Used trigger mode for timer and I kept the period to 10ms and change compare output time according to the table it worked then.
@@EmbeddedEnigma Congratulations 👍🏻
@@Lichtdesign thank you
@@EmbeddedEnigma Hi, I have a similar problem not working properly on stm32f103c8t6, can you please share the timer initialization file .ioc?
Please to share source code
Source code is now available!