Idea to a concept
This is part two of my series for how to complete a project. You can find the other parts here. This part will describe how to take your idea to a concept. Creating a concept is the first step in making a completed project
Table of Contents
Why making a concept first anyway?
So, why not just make a schematic directly instead of "wasting time" working on a fluffy "concept"? There are a few reasons why, and it will most likely save time in the long run.
- It will let you easily see what different solutions means for the completed device
- It will let you see early if you are making something too complex
- It will let you see what kind of sub-circuits are needed fast
- It will let you find what kind of power rails you need
- It gives you a list of bite sized "blocks" to design later on
As an example you can look at a project I am working on right now. The schematic can be a bit hard to follow, but the block diagram illustrates quite clearly what controller IO is needed, how the power rails are structured and what circuits are needed. At this stage I do not think about what those blocks look like inside, just what they do. A visual specification basically. The completed block diagram can be seen below.
Creating this kind of diagram might look like a quite daunting task, but it is rather easy if you do it step by step. I will describe the steps here below and show the results after each step.
Concept development
Step 1 - Condense the idea and scope
This part is quite easy. Take your idea and write down for yourself what you want the project to achieve. This is to make it clear to you what the goal is, and see if there are any questions about the goal itself before you start doing schematic design. It is also a way to try and stop scope creep which can be an eternal time sink. For this project, the result from this was a short but clear description.
The project should control a number of PWM fans to cool down my servercloset or similar space. It shall be able to keep an area below a set temperature as quietly as possible by controlling the speed of the fans. The device shall be able to integrate with Homeassistant over WiFi and allow for the following functions.
- Adjust setpoint
- Switch between automatic and manual speed control
- Report fan speeds
- Report fan status
- Turn on/off fans remotely
It should not be reliant on Homeassistant to work and should go back to automatic control should the connection to Homeassistant be lost.
I want to make this device with a standalone STM32 MCU and program it in the C language using the HAL libraries.
Step 2 - Set the specification
This step is another paper exercise where you will define what you need the device to do. It is OK to have some open points here. But in my experience from making both my own and professional projects you need to be a bit careful with what you leave for "later". Leaving things to open might bite you in the ass later on, or even make you need to throw out all of your work and start over. If the open point is important or not is a thing you will learn by experience. You do not need to go overboard here and make a 30 page datasheet, but some kind of spec is critical to make. My specification for this project was this
Fan outputs
- 4 Fan Outputs for PC Fans
- Power rail
- 1A Current delivery
- 12V
- Individually High side switched
- PWM Control
- 20kHz PWM Frequency
- 5V logic level
- Compliant with Noctua whitepaper
- PWM Feedback
- 1kHz Bandwidth
- Internal Pull up to max 5V
- Short circuit current 5mA
Temperature input
- Population option for Analog and 1-wire protocol
- Pull-ups for temperature sensors in the device
- Analog bandwidth minimum 100Hz
Buttons
- Pull-up resistors in the device
- Button short circuits signal to GND
- 2 Button inputs, one on the board and one on cables
Development IO
- Reset button on the board
- Minimum 4 controllable LEDs
- SWDIO for flashing and debug
Protections
- Power input shall be reverse polarity protected
- Each pin shall have some ESD protection
- MCU signals shall be protected against short circuits to GND and VIN if practical
Wifi
The project shall be WiFi enabled with a solution that can easily be integrated into Homeassistant
Step 3 - Create block diagram
Creating the block diagram is the part that is most time consuming when creating a concept. I generally start from the power input end. I know from the specification that there should be an input connector, reverse polarity protection and then the power supply. Then, continue and place down the "Wifi module" and the MCU. Not specifying what they are, just place them as blocks. The result should now look something like this.
Now we can start placing down the input/output blocks. We know that there should be 4 fan outputs, 2 temperature inputs and two button inputs. Place down those blocks as well. Now, it starts to become time to decide on what the properties of the blocks should be. I start with noting down the WiFi block and MCU. The specification says that a STM32 MCU should be used. That is enough for now. I also know that I want to use a ESP8266 as WiFi adapter as I have already developed code for this in a previous iteration. The communication between WiFi adapter and MCU is UART, so lets add RX and TX. With MCU and WiFi card decided it is also possible to set one power rail. Both the MCU and ESP8266 need 3.3V. The ESP can use 5V and its internal regulator, but the logic level need to be 3.3V. This means the button and temperature blocks need a 3.3V connection. Experience also tells me that the fan outputs will dominate the current consumption while not being overly sensitive so 12V input by an external power brick is a good fit. Lets add that as well
Now it starts to look like something we can use. There are just a few things missing. It is time to start drawing the IO to the MCU, which is quite straightforward for the button and temperature blocks. The fan blocks are however a bit more problematic. The feedback input can be pulled to 3.3V as it is an open drain connection in the fan, so it can easily be connected. The PWM outputs require a bit more work. The specification says that it should be 5V, so there need to be a level shifter in between the MCU and output. I will place the level shift as a special block as I can purchase a multi-channel IC for it. 5V level shift also means that I need a 5V rail from the power supply so lets add that as well. Draw all the IO lines and the finalised result should look like what the article began with.
Step 4 - Final Touches
Now there are just a few final touches left. The first is to choose a MCU. As the block diagram above already shows I decided on the STM32C031K4T6. The MCU is in the "low cost, 8-bit replacement" line in a easy to solder 32LQFP package. It is the cheapest one I could find that still allowed a decent amount of IO. The requirements on the processing resources are not very high so even this basic MCU should work. What I especially like with this line of MCUs is that they are cheap and basic but still has a lot of timers, interrupts on all pins and DMA. The processing speed might make them look not much more capable than an Atmega 328P but the included features makes it quite a lot more capable.
Another finishing touch is a small peek into the power supply. I opted to use a buck converter to produce 5V and then linearly regulate it down to 3.3V. It is quite nice way to easily get a clean and stable MCU voltage while being reasonably efficient. It also let me get 3.3V and 5V without adding any extra hardware.
The last finishing touch is to take a peek into blocks that might require extra supporting circuitry. In this case that would be the fan high side outputs. The switching speed requirement is very low, while the output is quite low power. Because of this I will use a simple PMOS with the gate controlled by a logic level NMOS. This is the cheapest and easiest way to get a high side switch, requiring no gate driver, logic input to the NMOS is sufficient.
The result
So now we have everything needed to move forward to schematic design. A rough specification, a idea what to implement in the shape of a block diagram as well as a start at looking into the blocks to determine how they should work.
Next steps
Now this looks like something we can work with. The diagram is now complete and it is time to proceed to the next step, create the actual schematic. That post can be found here.