Friday, April 21, 2017

Week 10

With the new package that arrived I immediately knew it was the new printer head. Its a shame it only came on Thursday. Today, Friday, I was finally got the board they originally gave me to hook up to the printer head and I tried to program it. After a few hours of trying to get it to run I found out that the heater is a straight through and through on my board. I looked at the schematics and there it was.



Fantastic. The two only things I was trying to control weren't even available for me to interact with. So then shortly after that, I learned that a board was being made, soon available, was going to be interacting with the heater and the thermistor. However, it was not going to be soon enough.



I talked to other people working on the same board as me and it seems there was a testing board made for the heater and thermistor (and a bunch of other things...). so here it is, I tapped into it with my pseudo 'microcontroller circuit'. The wires are there connecting to this board here.



Then, I hooked up my evaluation board up to the bread board, with all the right components, allowing it to function and control all the proper parts. The evaluation board, which houses the microcontroller, allows the microcontroller to shut my MOSFET on and off, which allows me to switch the heater circuit on and off. And with the testing points tapping into the thermistor, I'm able to record the resistance for the thermistor, which correlates to heat. With my code I've already made, everything I needed was in place to control the heater in the printer head and turn it off when it reaches a set point. This is as close to a 'real world' scenario for testing as I can get. I'm excited to see how the results show next week.

Thursday, April 20, 2017

Week 9

With the completion of the testing scenario on my evaluation board complete, it's time to move on to the real product. However, with this recent schedule my onsite advisor has been quite busy with traveling and meets he needed to attend. I have put in the request for a dysfunctional printer head component with the thermistor and heater still intact. He told me he'd see what he could do and now I have to wait for the product to come in. Which, it looks like it may be next week.

-4/7/2017

Friday, April 7, 2017

Week 8

Week 8

With new parts to work with, I was able to continue my work. I fitted the new thermistor on to a separate board to make it more robust and reusable.
     
                               

Then, to achieve a proper thermal contact with the thermistor and the pseudo heater (a simple 20 ohm resistor, to generate heat when a voltage is applied), I used thermal paste on the separate board and resistor.

                                                               

With the complete circuit I have made, it was all ready to be tested. With this testing setup, I was able to record at which voltage the LED would turn off.


                            

Although it was messy, I was able to find that the voltage reached about 2.2 volts then my LED turned off completely.

                               

The heat slowly dissipated after I disconnect the resistor and the system returned back to normal. The Oscilloscope here shows the rise at the beginning to 2.2 and slowly going back down over time. This is precisely what I wanted to see in order to move on to implement my PID controller. It feels rewarding when your work and code really go together to finally achieve your final goal. Next week I'll show my PID controller code that will control the heater.

-3/31/17

Wednesday, March 29, 2017

Week 7

Week 7

My progress the last two weeks has been almost minimal, the project along with the work was put at a halt because the thermistor I was working with broke when I was trying to fix it back on. I had a spare, however while trying to fix the spare on to the board, It slipped out of my pincers on to the floor. The thermistors themselves are so small it was impossible to find them on a white and black spotted flooring.


Just look at how small this is. It doesn't help even in the slightest that the thermistor itself was black and white.

I had to put an order on and it seems it wont come until next week.

So, for today's blog, I will go over the terms and research that I have done to further inform you about my work.

So for my project itself, I had mentioned working with PWM configurations, microcontrollers, ADCs, thermistors, PID controllers, and N-Channel MOSFETs. PWM is an acronym that stands for Pulse Width Modulation. This is a specific type of configuration for an output of an electric signal. You can imagine this output as a sine wave, but instead, when the point on the wave is positive, the electric signal will be sent, and when the point is negative, the electric signal will not be sent.

                             

So, with that in mind we get some sort of wave that looks like this. I previously talked about how PWM turns an LED off and on very fast? This is the wave function that does that. The period, being one full cycle of the switch or wave, is miniscule. The duty cycle is how long the 'on' function is for the wave, with respect to the period. The ratio between the duty cycle and the period is what determines how bright said LED will be. The bigger the duty cycle, the brighter it will be. The opposite is also true.

PWM outputs are given by microcontrollers and other electric devices alike. But in my project I'm working with this microcontrollers specifically.

                       

Imagine them as a small computer with all its own components, including a processor, memory, and RAM. Although, microcontrollers have pins coming out of it as shown above for multiple purposes. These pins can function as in and out ports, being that most of them are programmable. This allows for giving outputs such as PWM and taking in inputs.

The ability to take in inputs allows for ADC control. ADC is an acronym for analogue to digital converter. ADCs allow for an input voltage to be interpreted as something else. This can allow for an interpretation of many things alike. However, I am currently using it to measure voltage with a thermistor. Thermistors are a resistor that vary in resistance according to how hot it is. I have my ADC input tapped into a circuit with a thermistor, and according to said circuit, you are able to interpret the voltage as a specific temperature.

And with a certain temperature, I can use a PID controller to respond and send a signal to another circuit. PID Controllers are a specific type of controller that can account for a difference and respond to it in a very fluid way. PID stands for proportional integral derivative, Which each part has their own influence in a special way.


Using a set point defined by code, the user can have this code interpret and change a value or send a signal depending on the value of 'PID'. This allows for coders to account for changes in whatever way they want. The Kp, Ki, and Kd are all coefficients that determine the strength of each part of the PID controller. The key idea is to use these coefficients properly to maintain a slow and steady increase or decrease to your selected value. Also, try to avoid overshooting your target, you want to hit it, not go above it.

                            

This is the real time output of a PID controller trying to hit a set point. A steady state error is when the PID controller misses its target value, either going above or below it slightly when the control loop is finished. The value for 'PID' allows for a control sequence to occur exactly like this.

With my project specifically, I am using a PID controller and a PWM output to control a N-Channel MOSFET to switch a signal on an off towards the heater in the printer head. N-Channel MOSFETs are a special type of gate that allows for some sort of flow when a voltage is applied to both D and G, allowing voltage to flow out to S.

                    N channel enhancement type MOSFET

This depiction of a MOSFET shows the circuit I will be using to switch my heater on and off. The signal going to the heater is S, the signal from g is my microcontroller, and the signal from D is from a 24v power supply. The microcontroller will use all of these aspects I have mentioned to form the final product of my project, a heating control loop.
-3/24/17

Monday, March 20, 2017

Week 5

Week 5

During my fifth week I was finally given the code that will be in the final product, code that I am going to work with. This means that my final code will not reside in some form of a main function. The controller that is going to be implemented in the final product uses almost all of the channels. So with that in mind, I was also informed of what pins and channels I could use for my control loop. This meant that threads were going to be in use. I have never once used a thread before, so it was a learning process. Thankfully the final product code had other examples of threads that were available for use. Using these said examples, it did not take long to replicate something on the same level.

I used the ADC thread as a reference to make my own thread named PWM. The name was in reference to the PWM control needed to be implemented from a reference voltage. This reference voltage, as previously stated, will tell me what temperature the printer is heating the ink at, then my thread is going to react to that value accordingly.
Here is a very basic control loop first used. The circuit used in the printer itself will give a reading of .86V at 20C and 2.11V at 60C. The GetThermVoltage(); method will return this reading accordingly. I also had to invert the incrementing property in my PWMSetDuty method (This method changes the duty cycle on a 0-100% process) in my first if statement. This is because at a voltage of .86, we need a higher PWM output which will decline to 0 at a voltage of 2.11. Now I have to test the code and see what happens when the thermistor itself is heated. That will be my first job for next week.
-3/10/17

Friday, March 3, 2017

Week 4

Week 4:

It was easy to settle in while coming in on my fourth week on Monday. I was able to figure out the entire PWM mechanic on Monday and I got my LED to blink at half brightness with a half duty cycle. Electronics control the brightness of LEDs using a duty cycle, which is an instance where the voltage is turned on and off at very fast frequencies. This is even faster than the human eye can see. So if a LED is turned on and off very fast, but is on for half the time, the observer will only see the average of this period, which would be a LED on at half brightness. This allows me to control the heater's voltage directly with a pin associated on the board itself. This is in fact the end goal itself. Today, Friday, I have set up the thermistor on the board along with an LED to show that a change in heat in the thermistor can show a change in the brightness of the LED. That will be my goal for next week. And finally, after that is finished I can actually start implementing my control loop into the printer head itself.

-3/3/17

Week 3

Week 3:

The next major goal in my project was to learn and figure out a simple LED circuit and turn it on and off, but with some delay in between. The specific board I am experimenting with is not as popular as some Arduino boards. I am currently working with ST Electronic's STM32f0 discovery board, mostly due to the fact that the same exact microcontroller is in use with our printer head controller. It was more efficient and more controlled using a timer with a certain tick. Programmers use the system tick, which varies from different micro controllers, and pre scale it down so that each and every tick occurs every second or millisecond. This allows programmers to control a system to allow it to take a reading or a measurement every tick. Then, allowing for the system to be informed of the current state, it can then react accordingly. Which, in my case, I would be able to apply a different duty cycle or average voltage to the heater itself, allowing for it to not heat up or cool down faster than needed. With that goal finished this week my next lesson is to figure out PWM control.

-2/24/17