Maker Pro
Maker Pro

Microcontroller controlled by pushbutton for LED flashlight

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
OK, I've just had a quick read of the thread.

My recommendation would be to make a prototype board that has proper connections for your programmer. This will be physically larger than your design target, but will allow you to easily test the unit, reprogram, and replace components as necessary. In addition you might be looking at a single sided board as it is easier when you're testing a bare board.

Another option is breakout boards for the various components and a breadboard.

The three questions I have for you are:

1) Do you have any experience making PC boards?
2) Do you have any experience writing software?
3) Have you ever programmed a microcontroller?

If you have any issues with (1) I can make you a couple of prototype boards and mail them to you. I also have a selection of SO-08 mosfets capable of up to 30A which may be useful if the ones you have prove to be problematic. (e.g. FDS4070N3, and SI4936DY). I also have some PIC10F206's so I may be able to also build a similar prototype and help you debug it.
 

TenderTendon

Dec 20, 2014
143
Joined
Dec 20, 2014
Messages
143
Thanks for jumping in Steve. I was preparing to proto this with breakouts/breadboard. To answer your questions:
1) No, but I own a small machine shop and was going to cut the boards on my CNC mill. I have 1/16" FR4 here and engraving bits I believe will work. It may not work though as my spindle max's out at 5000rpm. I was going to draw up a board in CAD, but my CAD software has no circuit board support.
2) None whatsoever.
3) Never.
 
Last edited:

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
OK, cool. I can probably help you with the first one, but I don't typically use PICs, so perhaps someone else can jump in with suggestions when we get to that stage.

Have a few tries with your CNC machine and see what the thinnest reliable cut is that you can make on your CNC machine. Curiously enough, I am currently using a laser cutter to create boards using a very similar technique. What data format can your CNC machine accept (or your drawing package)? I natively produce HPGL files, but I can convert them to almost anything (I use Inkscape for editing).

If you can provide me with the sizes of your components I can get started on designing a board for you. Then you can cut it on your CNC machine.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
OK, here is a very quick and dirty design for a board that can take various size components and a few options for mosfet. It also has positions to connect the batery, constant current device, etc to keep things a bit tidier during testing.

There is a single link.

The entire board is 4cm by 7cm but the parts of interest to you will be the tracks around U1. You'll need to be able to do some mighty fine milling.

Screenshot from 2015-03-21 18:17:30.png

I have also uploaded an HPGL file containing the milling paths. Note that I have specified a tool width of zero for this which may be impractical, and one with a 0.1mm cutting width, which is as large as I can do without pads merging.

This board is shown copper side up, so no mirroring of the output is required.
 

Attachments

  • Mill-0.00.plt.zip
    6.1 KB · Views: 69
  • Mill-0.10.plt.zip
    6.4 KB · Views: 63

TenderTendon

Dec 20, 2014
143
Joined
Dec 20, 2014
Messages
143
Thanks for the design. I'm confused about the power I/O. The board has 3 connection points. I will only have 2 to work with. There is no constant (+) available. I cannot open/import the files you attached with AutoCAD. I will try with my other CAD program when I get to the shop. A .004" cutter is the smallest I have, so it will be interesting....
 

TenderTendon

Dec 20, 2014
143
Joined
Dec 20, 2014
Messages
143
I figured out the connections. In my case, nothing will be connected to the (+) and (D-) pads.
 

TenderTendon

Dec 20, 2014
143
Joined
Dec 20, 2014
Messages
143
Just for the record:
U1: SOT-23
Q1: SC59
CR: 1.6mm x 0.8mm
DC: DO214BA (4.5mm x 3.3mm)
DP: SOD32F (1.6mm x 1.2mm)
Switch: 4.6mm x 2.8mm
switch.JPG
 

TenderTendon

Dec 20, 2014
143
Joined
Dec 20, 2014
Messages
143
Thanks for offering to help Adam! I have never done any kind of micro programming, so I want you to turn me into a programming guru. :) All kidding aside, it is still unknown if this circuit design will even work, so for now all I want is a bare bone program to test the design. The PIC needs to fire the MOSFET momentarily if the switch is pressed <500ms, maintained if pressed >500ms. If the MOSFET is latched on, pressing the switch again will turn it off. This seems simple enough, but the challenge is the fact that all voltage potential across the circuit is lost when the MOSFET turns on, so there is nothing to keep the PIC and gate powered up. Kris's latest idea was to have the PIC switch the MOSFET off for 1 ms every 100 ms, keeping CR charged. These timings may need to be adjusted, as well as the value of CR, but we have a starting point. If the design works, I would like to add a couple more functions to the PIC to take advantage of it being there, but we'll keep it as simple as possible for now.
 

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
Hi Jeff my programming skills are no where near what Kris was able to do. I can only programme in assembler but for this simple programme I would have thought it will be fine. However I do have a group of guys I work with who could knock this up in C if you needed to. I need to just get my head around the design a minute.
Adam
 

TenderTendon

Dec 20, 2014
143
Joined
Dec 20, 2014
Messages
143
Hi Jeff my programming skills are no where near what Kris was able to do. I can only programme in assembler but for this simple programme I would have thought it will be fine. However I do have a group of guys I work with who could knock this up in C if you needed to. I need to just get my head around the design a minute.
Adam

Thank you. I have no idea what the difference would be being done in assembler or C. Take your time, no rush...
 

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
Hi Jeff
Don't quite understand why all power is lost when the MOSFET is on. Can you explain this in detail?
Thanks
Adam
 

TenderTendon

Dec 20, 2014
143
Joined
Dec 20, 2014
Messages
143
Hi Jeff
Don't quite understand why all power is lost when the MOSFET is on. Can you explain this in detail?
Thanks
Adam

This electronic switch will be used in a flashlight and will be placed in series with the battery and the bulb (it is actually an LED driver, but I'll say bulb to simplify the understanding). The electronic switch will receive all of it's power "through" the bulb. When the MOSFET is turned on, the circuit is closed and the bulb lights. However, when the MOSFET turns on, there is no longer potential across it or the PIC, so the pic will shut down. There is no constant (+) from the battery supplying the circuit. Only what it gets through the "bulb". I hope I explained that good enough.
 

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
Ok I understand that now thanks, why does it have to be that way out of interest. Why can't you power the PIC all the time. Sorry for the dumb questions.
Adam
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Jeff, if you can print that board layout I produced at full size and check to see that the various devices you have fit the pad layouts. I'm pretty sure they should be OK.

I'll check to make sure that the pads I placed there for the switch are OK based on the drawing you supplied. If you have a link to the datasheet for the switch that would be great. I would like to double-check the pads which are connected when the button is pressed.

The additional pads are there for alternative devices I have so I can build one of these to assist you.

If You can't mill one of these, I'll do a couple myself and send them to you. I'll include a couple of the devices I'm using, just in case they are useful during testing (they may be a little more rugged).

Also I typed (but failed to post) a description of the pads which you clearly didn't need as you corrected your post some time later.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Great. And the connections I used will work fine with that switch :)
 
Top