I am using Kinetis KLO M0 family as requirement and I have to
run a relay that is supplying 277VAC @ 5A to the load.
Also I need to be turning it ON and OFF every 9 seconds. I am
wondering which outputs should I be using.
I can design the power conversion needed, but I am not much
familiar with Microcontroller.
Thanks
Hi,
You can use any GPIO of KL0x MCU. But you will need a external driver, a small transistor is enough, a darlington transistor is much better, like MPSA14. It depens on the voltage and current you need in the relay coil, tipically 12V and some mA. You will need a parallel diode with the relay coil.
http://www.onsemi.com/pub_link/Collateral/MPSA13-D.PDF
Something like this:
If you need to drive multiple relays, you can use an ULN2803, for example.
Luis
So GPIO of KLOx MCU is connected to TTL input of the transistor??
Also which clock should I use to drive the circuit ON and OFF every 9 second? and how will it control my GPIO output?
(MCGOUTCLK, MCGFLLCLK, MCGPLLCLK, OR something else??)
Thanks
Victor
Hello,
Since I am a beginner I am looking for options to do the timing easily.
I also have a requirement of linking the relay to ON/ OFF button
1. time delay function in while loop,
But I dont know what other variables and module would I have to initialize? Would it calculate internally and just put the trigger after every assigned delay time?
while (1) {
_io_ioctl(file1, GPIO_IOCTL_WRITE_LOG1, NULL);
_time_delay(9000);
_io_ioctl(file1, GPIO_IOCTL_WRITE_LOG0 NULL);
_time_delay(1000);
}
2. Use PWM to control the transistor.
I will have to learn how to set TPM for PWM.
https://community.freescale.com/message/319470#319470
https://community.freescale.com/message/63827#63827
Looks like I will also have to learn how to divide clocks, so use EXTAL (which is 8MHz) then learn how to code/ set TPM overflow
and then learn how to link it to GPIO output.
3.
Designer can use a PIT timer to generate a periodic 9 seconds interrupt.
And in the PIT interrupt service routine, customer can set relay control pin output status.
Do you have any examples that I could read that will help me understand how GPIO timings can be adjusted
Thanks
I don't think you want to use PWM in this way, if you mean to use it to turn the relay on and off.
I also don't think you need to use two threads on the forum, but that is your choice.
If you have given us the full requirements of your application, it might be simpler to not use MQX and use PE to setup an IO bit and a timer. You will certain learn more about MCUs.