Innlegg

Viser innlegg fra oktober, 2015

The Beam and Ball Project - Part 2 Servo Control

Bilde
  Software (continued) Servo Control To control the servo the microcontroller need to produce this 50 Hz waveform shown below. The resolution is defined by the microcontroller because the servo is an analog device. There are mainly three ways of doing it. Delays Set output, then do delay. This is a bad way of doing it. The program is halted for every delay. However if you want to mash up some code to test your servo, this is the way to go. Consumes the whole CPU Good and quick technique to test servos. Hardware PWM The most positive about hardware PWM is that the overhead is 0. The CPU usage is practically zero, and only one or two instruction cycles are used to set a new pulsewidth. Running the PWM at 50Hz demands that the PIC16F887 is ran in max 1 MHz due to max prescaler settings. So at the beginning of the project I went with 1 MHz. The 10bit capable Hardware PWM uses a CCPx module, and TMR2. TMR2 is 8 bit, however the remaining two least significant b

The Beam and Ball Project - Part 1 Setup and distance measurement

Bilde
This is a write-up for my YouTube series: Introduction The hardware and designing a function for the distance measurement. So I've always wanted to learn PID Control. It's a closed loop control system used to move and regulate something into a given target. PID control is fairly simple to implement, however the math behind can be intimidating for anyone. I remember back in College that I was put off by all the focus on differential equations. However PID control was a great subject to learn diff-equations, don't get me wrong. The main concept of PID got lost for me a long the way back then. To get me started again what isn' better than doing a fun project that involves this form of control. Here is a link to my Beam and Ball Project series on YouTube. https://youtu.be/R5ryRxh4_7c?list=PLtQOf_JULmrQr-Htio6THf0MxvWWyOdG_ The Hardware  A good way for me to get started was to digg out my trusty EasyPIC5 development board from MikroElektronika from 2008. It has