-
Final log
01/04/2017 at 21:33 • 0 commentsProject entry:
Along with hackaday logs on the project page...
The project is summed up by the following document (including build instructions, BoM, etc): Switcher.pdf
The hardware and software is available in the github repo: https://github.com/ashleyjr/Switcher
The final project meets the 1KB criteria and majority of the project goals have be achieved.
Personal reflection:
My knowledge of switch mode power supplies was already fairly complete but I tend to use off the shelf controllers which, when treated with respect, are quite simple to get up and running. I chose to develop a SMPS from scratch as a way of putting myself in design position of a commonly used component so that I might better understand why they behave as they do.
Using the Keil c51 compiler and diving deep in to the assembler was a valuable experience. I often tend to avoid assembly like the plague but monitoring the code size byte by byte has taught me subtle changes in C can make huge changes in the assembler. I also have a greater appreciation of the 8051 architecture and can understand why new chips based on the this design are still entering the market.
-
Code size analysis
12/31/2016 at 17:16 • 0 commentsAs a quick aside I wrote a small script to plot the code size produced against commits. Initial development is erratic, the size slowly grows as more features are added and eventually I keep optimising the code to get back below the limit.
-
Optimisation
12/31/2016 at 01:30 • 0 commentsThe functionality of the project almost complete code must be optimised to reach the target of 1024 bytes or less.
In this example the two functions under inspection regard UART traffic. One to load the buffer which is unloaded from a timer and the second is used to move data between an unsigned 16-bit integer and ASCII representation of that number. Working from left to right in the image below the code size improvement is as follows...
- 1021 bytes
- 1016 bytes
- 1004 bytes
The first step replaces an if statement with a modulus operation to control wrap around of the UART buffer. The second step shifts an if statement to the end of a loop to reduce the number of jump operations the compiler generates.
The more bytes than can be removed from the generated assembly will enable more options to be placed in the UART menu structure. Similar techniques will be used to reduce code size where possible.
-
Controller first steps
12/14/2016 at 23:43 • 0 commentsThe controller has been implemented using only proportional and integral control. The derivative control likely not be required Below is a graph of output voltage of the switcher with increasing input voltages. Under minimal load this will need to be tuned to respond appropriately for give step sizes and output loads.
The ability to switch the output voltage on and off is given by the menu. Two commands are available to enabled and disable the switcher. This along with the PID controller itself has pushed the project over the 1KB limit.
-
Hardware build part 2
12/07/2016 at 23:30 • 0 commentsThe additional switching components have added to the stripboard . Using only the small load from the potential dividers on the output (500R) the capabilities have been tested in open loop mode. The scope shots below show the PWM frequency running at 96KHz with a fixed 5V input. The output is boosted to 6V and bucked to 4V.
There is a large amount of ripple voltage which can be improved by increasing the output capacitance. This can be tuned when a variable load is available.
During the open loop testing it was noted the usable range of 8-bit PWM is only about 10% for the 256 possible states. The programmable counter can also operate in 16-bit mode which will improve the resolution of the output voltage.
-
Hardware build part 1
12/06/2016 at 22:55 • 0 commentsThe first stage of the hardware build is complete. Missing any switching components it mainly consists of potential dividers to measure up to 6V. The dividers are clamped at 3.3V to protect the microcontroller. The ADC inputs have been tested and the diode drop can be measured.
-
Schematic
12/05/2016 at 01:18 • 0 commentsTo prove the software some basic hardware is required. The attached schematic will be implemented on strip board which can be attached to the dev board. The main features include...
- Pin assignment from the microcontroller
- Input voltage measurement
- Output voltage measurement
- A current shunt measured by a second voltage
- A high side switch when operating in buck mode
- A low side switch to operate in boost mode
There is also protection zener diodes for development.
-
Dev board peripheral experiments
12/03/2016 at 16:27 • 0 commentsUsing the Silicon Labs toolstick and a C8051F850 daughter board I have configured the following setup:
- 2 x PWM outputs running in phase at 95.7KHz using an 8-bit counter
- 1 x 10-bit ADC input
- 1 x UART running at 115200 baud
The internal clock is running at 24.5MHz.
Currently an ISR is used to update the PWM duty cycle but the next steps will be to...
- Refine the PID controller
- Include a timer to execute the PID routine from an ISR
I'm also prototyping hardware to begin testing the setup as a boost converter.