Microcontroller Board plans...

tetsujin

Active Member
Joined
Jun 26, 2009
Messages
102
For various projects of mine I've been working on a design for a microcontroller board. The problem of trying to fit a circuit board into some of these models (not super-small models, just fairly dense with multi-layered parts) has led me to try to make this thing as small as possible. The current version is something like 11mm x 10mm.

The basic idea of how the board will work goes like this: on the board is a tiny microcontroller. From the board, four lines are run to some accessible points on the model exterior: two for power, and two for data. The data lines can be used to issue instructions to the board, change the state of its outputs, and so on. I haven't written the software for the data lines yet, but the plan is to use low-speed I2C, which would allow me to connect a bunch of these things onto a single bus and address them individually.

The other four I/O lines of the controller go to operate LEDs and such. The initial plan for using these I/O lines was that the board would incorporate pull-up resistors, which would also act as current-limiting resistors for the LEDs connected to the line...

The problem I'm running into is basically one of power economy: each I/O line from the microcontroller can only feed or sink up to 20mA of current. That means that making one output drive four white LEDs requires operating each LED at no more than 5mA (I can't hook up the white LEDs in series because the supply voltage to the controller board can only be up to about 6V - which isn't enough for two white LEDs plus a current-limiting resistor... And additionally, the initial design (having the current-limiting resistors do double duty as pull-up resistors) was a problem anyway: the result would be that when the board pulls that output low, more than 20mA would flow through that resistor and into the I/O pin - so the "low" state has to be the one that turns LEDs on, and the LED needs its own current-limiting resistor somewhere. I seem to have run out of space to place such a thing on the board...

I'm trying to come up with a good solution to the power limit issue so the board can drive a larger number of white LEDs. One possibility that comes to mind is to drive the board at a higher voltage: 12V perhaps. This would require adding a voltage regulator to the board, however, to give the board its 5-6V supply... But if I did that, then I'd be able to connect two or three white LEDs in series, connect the anode end to +12V, and the cathode end through a resistor to an open-collector output pin of the microcontroller... If the controller pin sinks up to 20mA in the low state, then those three LEDs could all run at full brightness.

Another option might be to add a LED driver IC, either a constant-current source or just a buffer that would give me more output current than I can get from the microcontroller I/O... This would mean adding a second circuit board, I guess... And using a current source might mean that I'd have to run a greater number of lines from the controller to the various LEDs, in order to get the power I need...

So it's a bit of a puzzle at the moment. I'm not entirely sure what I'm going to do. In current projects I could probably get by with the current 6V power supply, running white LEDs at half power and using one I/O line for each two LEDs... But it might make more sense to change the plan to a 12V supply sooner rather than later, and redesign the board to incorporate a regulator. I suppose I have some time to figure it out...
 
Hi Tetsujin,

I am not an electrical engineer, but I think you could use a transistor as a switch. Basically feed a higher current source through the transistor to the LED and drive the transistor with the output from the microcontroller. Here is a link that might explain it better:
http://www.rason.org/Projects/transwit/transwit.htm

If you use SMD transistors and resistors, you could keep the size small without the need for 12v power supply provided the supply you do have can provide enough current for all the LEDs you plan to use.

Hope that helps,
Chris
 
Well, since I'm working with surface-mount and trying to keep things as small as possible (and dealing with multiple outputs) I'd more likely go for an IC to power-up the microcontroller outputs rather than do each one individually with a transistor... (Surface mount components are really tiny... The ICs are hard to handle, and individual discrete components like transistors, resistors, or LEDs are just crazy...)

There are several problems I'm trying to work out. The first problem is that I've got basically one place in my model to put in a circuit board, and it's got to be small. (Though it is possible I could come up with an alternate location... I'm investigating that possibility, as well... But the location I'm using now is great 'cause it's accessible and it's very central. The second problem is that I've come up with one design for this board already - it's small enough for the space but there's no room for more components. So to add components I've got to rethink my design a bit. Finally, there's the problem of running wires in this model. It's a humanoid robot model, and the joints have got to be able to move even with the wires in there. And any place wires bridge a joint, I've got to be able to replace the wires if they break later on. I've already got five wires running through the knee joint, for instance (two data, two power, plus one coming down from the microcontroller for lights) - adding more wires there is not an option. This is one of the attractive things about going to higher voltage: I can power more LEDs on the same amount of current if I've got higher voltage, and I'd only have to add a few components to do it. To increase the I/O lines to a higher supply of current at the same voltage may not be so simple. (It all depends on how much current my output amplifier thing can sink...) I can reclaim some board space by making the external connections surface-mount instead of through-hole, and so on - but if I have to add on too many additional components, I'll wind up having to add a second board.

The whole thing is further complicated by the fact that all these decisions have to be interconnected. If I decide to change the supply voltage, for instance, I've got to include that change into the design of other parts of the model. I can't design LED circuits for 6V, seal them up inside model parts, and then later decide to use 12V. (Well, I could, but it could get complicated...) So while there's model work I'm hoping to move forward with even though the microcontroller board isn't ready, that's complicated by the fact that I need it to be compatible with whatever solution I come up with later on.
 
OK, some more progress on this whole issue...

First off, the first microcontroller board I designed (scroll to the bottom) is terribly flawed, as it turns, out: first, one of the lines I connected to I/O is an input-only line, and therefore not useful for driving an LED... Second, the arrangement of resistors is basically useless: they're set up to "pull up" the output lines - the microcontroller outputs can drive themselves to +5V, so there's no real need for that... It would only be useful if the outputs were open-collector... And even then, the usefulness of this would be seriously limited unless the I/O were connected to LED cathode... in which case the board doesn't provide an on-board current-limiting resistor for the LED. If the I/O were connected to LED anode, then current to the LED would either need to go through that pull-up resistor, or come from the microcontroller itself... So I'm not sure what I was thinking there... The 12F683 I/O pins are not open-collector, and the resistors (square pads on the back of the board) where I've got them wouldn't work as current-limiting resistors...

For similar reasons, my plan to use a 12V power source and a voltage regulator, along with open-collector outputs won't work on a board this size... There's no space for an additional component on my board design, and a voltage regulator would be as large as the microcontroller itself. Plus, as I noted above, the PIC I/O pins aren't open-collector and haven't got an open-collector mode...

I had hoped I would be able to do this project with the 12F683 - for such a small part, the low pin count definitely makes it a lot easier to solder on. But it seems like the small number of I/O lines makes it a poor choice for this project, since I want to use two I/O lines as a serial interface to control the board's behavior, that only leaves three I/O lines for driving LEDs. So I came up with a new 11mm x 10mm board design using the 16F688 - a 14-pin microcontroller with the same physical size... (This obviously means the pins are a lot closer together - and therefore harder to solder... But it also means there's a lot more I/O lines to work with - a total of 11 outputs, compared to the 5 on the 12F683...) The new board design eliminates the second row of I/O pins (these were just ground lines, anyway) and provides pinouts (with pads for series resistors) for a total of five I/O lines plus solder points for another two. (The remaining four I/O lines are used for in-circuit serial programming and for interfacing to the microcontroller's on-board USART for serial communication...) This means I can put current-limiting resistors for the LEDs right on the controller board, and distribute a multiple LED load over multiple I/O lines... And two of the I/O lines are set up such that if the resistor is omitted and some pads bridged on the opposite side of the board, those I/O lines become access to ground or voltage instead... Unlike the previous design, the new board does not provide a whole row of pins just for easy access to voltage and ground...

I may still rethink some of my design decisions from this board: for instance, the connector to the right of the microcontroller (the ICSP header, which is also used for powering the board and issuing instructions to it during normal operation) ties two pairs of I/O pins together: one is the normal set of ICSP data and clock pins, the other is the set of pins the USART can use for synchronous I/O clock and data... Typing these pin pairs together means that I can use just one five-pin header for both writing program code to the board and for controlling the board while it's running, and still take advantage of the USART for my serial I/O needs (if I can figure out how to write the code to do that...) But it would also be possible to write the synchronous I/O code myself using the two I/O pins used for ICSP - this would free up another two I/O pins for other purposes... I'm not sure what's the best way to go. I haven't fully explored the problem of writing I2C code on the device.

As for the problem of getting enough power out to drive multiple LEDs - I think I need a second board... I'll probably try designing something that can sandwich the controller board, and provide (I guess) some kind of LED driver and maybe a voltage regulator for a 12V supply. (I still have reservations about going to a higher voltage supply because I feel like it complicates things in a way... But being able to run multiple LEDs in series is still quite appealing.)

[attachment deleted by admin]
 
I got my boards made! But I messed up...

Pity I screwed up...

This is my first time having a circuit board fabricated... Wouldn't you know I'd neglect little details like correctness... I ordered the boards around the beginning of the month, discovered my mistakes over the weekend, and the boards arrived today...

Still, the boards are usable - maybe useful, even. But I think, having seen how this batch turned out, it's time for another round of redesign...
 

Latest posts

Back
Top