Maker Pro
Maker Pro

Microcontroller controlled by pushbutton for LED flashlight

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
Yep will add more vias, must have missed the 5 Amps, just saw it in the first post, sorry. For some reason I had only a couple of Amps in mind.
Adam
 

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
Gone a bit quiet this thread, whats the next step? I cant afford the PCBs at the moment, going to cost me £60 for the smallest panel which will give 51 PCBs. Can anyone get them for a better price? Jeff can you link to the LED module you are using, I might order one to have a play.
Adam
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
@Arouse1973 does this mean you are satisfied with your firmware now? Perhaps @TenderTendon can machine a board on his CNC mill. The vias can be filled with small wires and soldered to both sides of the board for prototyping purposes. I don't think it wise to make 51 PCBs until Jeff has at least one in-hand and says it works to his satisfaction.

Hop
 

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
@Arouse1973 does this mean you are satisfied with your firmware now? Perhaps @TenderTendon can machine a board on his CNC mill. The vias can be filled with small wires and soldered to both sides of the board for prototyping purposes. I don't think it wise to make 51 PCBs until Jeff has at least one in-hand and says it works to his satisfaction.

Hop

Yes Hop, go for it, just didnt know how you were getting on. The firmware can always be changed.
Ads
 

TenderTendon

Dec 20, 2014
143
Joined
Dec 20, 2014
Messages
143
Sorry, have been very busy lately. I didn't know that you had a finished version that stays alive through only the 330r resistor. If you are happy with it, give me the part numbers of the components you are using. I will get them ordered and cut a proto board. Also, can you email me the software?
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
Yes Hop, go for it, just didnt know how you were getting on. The firmware can always be changed.
Ads
Ummm? Go for what? The implant surgery went off without a hitch. I am not allowed to raise my left arm above my shoulder for six weeks, and it feels like someone punched me real hard where the defibrillator/pacemaker is located, but other than that I am okay.

Blew up my second PIC10F206 while my engineer son was watching. Embarrassing. I really let the magic smoke out on that one. If this keeps up I will purchase some PICs in PDIP packaging, but I really need to learn how to solder SMDs and program PICs even after this project is completed.

Hop
 

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
Ummm? Go for what? The implant surgery went off without a hitch. I am not allowed to raise my left arm above my shoulder for six weeks, and it feels like someone punched me real hard where the defibrillator/pacemaker is located, but other than that I am okay.

Blew up my second PIC10F206 while my engineer son was watching. Embarrassing. I really let the magic smoke out on that one. If this keeps up I will purchase some PICs in PDIP packaging, but I really need to learn how to solder SMDs and program PICs even after this project is completed.

Hop

Ummm, not sure what I meant by that either LOL. Glad to hear your okay.
Adam
 

Supercap2F

Mar 22, 2014
550
Joined
Mar 22, 2014
Messages
550
... Also, can you email me the software?
It's just Diptrace, and you can get it from here. Also, if you want to do 3D Models you'll also have to install their 3D Libraries.

But if Adam is using the freeware version, it is against their license to sell your products you design with it. You have to upgrade to the paid version here if you want to do that.

But if Adam is using the freeware version, and you don't want to pay $75+ to upgrade (I wouldn't blame you if you didn't!) KiCAD is a free and open source software you could use instead. Yeah, I did leave it a not-so-good review once but after you figure it out, you can design stuff pretty quickly and professionally.

Their are a couple other softwares that would work for free, but their quite annoying to use...
Dan
 
Last edited:

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
Just implemented the switch interrupt I wanted to right from the start, seems to be working ok. Will load the code, parts list and Gerber this weekend.
Thanks
Adam
 

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
Here are the files. I have included the DIPTRACE design files so people can download the software from Dan's link and you can make any changes you might want to. Also remember you will need to change the port pin in the software for the MOSFET on and off pin to RA2, you do this at the top off the code by modifying the MACRO. I know the schematic symbol for the PIC has the wrong label names but all GPIO pin names will be is replaced buy RA? but for you is won't make any difference. I just forgot to change them.

Thanks
Adam
 

Attachments

  • CODE.zip
    1.5 KB · Views: 89
  • DXF.zip
    6 KB · Views: 86
  • GERBER.zip
    4.1 KB · Views: 90
  • PCB.zip
    12.1 KB · Views: 125
  • PARTS LIST.zip
    519 bytes · Views: 115
  • SCHEMATIC.zip
    11.8 KB · Views: 81
Last edited:

TenderTendon

Dec 20, 2014
143
Joined
Dec 20, 2014
Messages
143
Also remember you will need to change the port pin in the software for the MOSFET on and off pin to RA2, you do this at the top off the code by modifying the MACRO. I know the schematic symbol for the PIC has the wrong label names but all GPIO pin names will be is replaced buy RA? but for you is won't make any difference. I just forgot to change them.

Thanks
Adam

I'm really confused with all this. If I will be using the same PIC as you and using the same schematic as you, why do I need to change anything in the software to get it to work?
 

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
I'm really confused with all this. If I will be using the same PIC as you and using the same schematic as you, why do I need to change anything in the software to get it to work?
Hi Jeff.
Rember I made a mistake on my PCB, from what Kris origionally designed. I had the port pin for the on and off on the wrong pin. The design now has this corrected but I only have my demo PCB to work with. So any code I do has to have the port pin different. I suppose I should change my demo PCB at some point.
Adam
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
Lest I get off into left field here (American baseball term), it appears that Adam is now using a PIC10F320, or possibly a PIC10(L)F320, instead of the original PIC10F200 that is mounted on the prototype board that Jeff sent us, and that I have been afraid to mess with using MPLAB X and the PICkit 3 in-circuit programming hardware, for fear of damaging the prototype. As I mentioned elsewhere, I am not having much of ANY success trying to program my PIC10F206 in SOT-23 packages. I only have two remaining to solder up on 8-pin DIP chip carriers. So I will order from Digi-Key tomorrow both the PIC10F206 and the PIC10(L)F320 in PDIP packages for breadboarding. These puppies are so cheap, I have to find some more "goodies" to add to the order to justify the shipping cost.

The '320 appears to be functionally equivalent to the '206 and '200 with some added features, like a vectored interrupt to address 0x04 and program continuation from Sleep without Reset when the WDT times out. This simplifies the coding a lot. And the low-power version will help to minimize capacitor discharge between re-charge events. I still have no way to assemble and test Adam's latest code because I don't have any '320 micros to play with yet. I have tried reading his code and "executing" it in my head, but that doesn't even begin to compare with assembling the code and executing it on real hardware. It is a useful de-bug technique however.

I don't know if it is something I am doing wrong in soldering the PIC10F206 chip onto the 8-pin DIP carrier, or bad Chinese jumper wires, or incorrect wiring (highly likely!) but my idle current with Vdd = 5.0 V DC is about 640 μA. This is with the micro in a short loop executing a bit-set (or a bit-clear) instruction on a single I/O line. If I include the PICkit 3 in the circuit, the current increases to 6 mA. So I have decided to disconnect the PICkit 3 except while downloading assembled code. I am also now using six series-connected D-cells to provide power to a 7405 three-terminal positive voltage regulator supplying 5.0 V DC to the PIC. That works great, but if something goes wrong the D-cells can really produce some smoke. Perhaps I should go back to using three series-connected AA-cells providing about 4.2 V DC. Also, initially I had a 330 Ω, 1/4 watt, carbon film resistor in series with the battery since the actual flashlight will provide power that way. I took the resistor out when I was learning how to write code to make sure the PIC was getting sufficient voltage. Silly me. That resistor probably would have saved PIC #2 from releasing its magic smoke. I will definitely have the 330 Ω resistor in series with the power supply from now on.

It looks like I am a long way from adding the Schottky diode and MOSFET power transistor, much less the LED controller module, to my breadboard. Jeff will probably have built and sold a hundred flashlights by the time I get there. But I'll keep on truckin' with this until I get it working. To do otherwise means I have to give my wife back her sewing table.

Hop
 

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
Hey Hop
Well at least your having a go, yeah using the 320 allowed me to write the code how I planned it in the first place, didn't realise the 200 was so basic until @BobK told me. I know someone like Kris would have done this easily with the 200 but my pathetic software skills drew a blank after 4 hours of trying to get the sleep function to carry on from where it left off. But for a few extra pence it hardly seems worth struggling. I am also seriously thinking of getting a small PCB milling machine at some point, What a great toy!
Cheers
Adam
 
Last edited:

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
Adam,
It is so frustrating trying to program and test a microprocessor when all that is visible are four I/O ports. MPLAB X can't even show the contents of the registers, or at least I haven't found out how to do this. I'm just about 100% certain it shows the program memory contents after doing an upload, because that is how I find the factory-set oscillator calibration bits located in the last word of program memory. I don't trust MPLAB X not to erase these bits, so the first thing I do is read them and write down the value for later reference in an EQUate directive for each PIC I use (three of them so far). It appears that there are much more sophisticated PICs with lots more program memory available, enough to allow MPLAB X to download a de-bug "executive" into high memory. And for these more complicated PICs there are de-bug modules available that can transparently execute the target PIC code in real time, with breakponts and such. And you can even program these larger PICs with high-level languages such as C, which I know almost nothing about. As you said, at work there were always software weenies available to roll code for us hardware guys. I learned just enough C to "keep them honest" so to speak.

Getting the sleep function to resume from where it left off requires some means to save in a user variable the address where you want program execution to resume. This could be a table indexed by another variable whose value you assign just prior to sleep. Then, having determined the reset was a result of awakening from sleep, you use the index to retrieve and load the address where you want to continue, either as an Interrupt Service Routine or a branch back to the code following the sleep instruction. That's a lot of overhead for the PIC10F200 (or PIC10F206) that is unnecessary with the PIC10F320 (or PIC10LF320). Just for grins, I may eventually try to program that for the PIC10F206 to see if I understand indirect addressing and pointer objects. Hmmm. I had plenty of trouble with that using C, so no telling what it will be like with assembly. All the software geeks on this forum are probably ROFLTAO right about now. I make no apologies for being a hacker: I will beat on the bits until it works, no matter how ugly the final code looks. I do draw the line at writing self-modifying code, leaving that to the criminal hackers now. I may have written a few scraps of self-modifying code in the past, but the devil probably made me do it. It sure didn't get documented as such.

I would surely like to have a CNC milling machine. It is a great toy! A CNC lathe is also a fine toy. We had both of these (for awhile) where I worked, complete with all the tooling needed for setup and getting things done. Well, almost all... you can never have enough tooling. These were not top-of-the-line models by any means, but they were adequate. My company sent those of us who were interested to Sinclair Community College to get trained on how to use them, but I chose not to go. A year later they moved both machines to another building for production machining, which made them virtually inaccessible except by prior arrangement. So much for prototyping.

I am not so certain that a PCB milling machine is the way to go for prototyping. I like the idea of replacing the cutter head with a small diode laser to either ablate a resist coating or, with a UV laser diode, expose photo-resist coating. No messy chips to clear away, no expensive carbide tools to break. I would also consider building a small Gerber photo-plotter with an aperture wheel for several different-sized pads and traces, but I seriously doubt that is going to happen no matter how large my collection of stepper motors. My wife would insist I build her a 3D printer as soon as she saw me gathering x-y slides and whatnot. <sigh>

My engineer son had some success as an undergraduate student at The Ohio State University physics lab using a laser printer to make circuit boards. I think this involved printing a mirror-image of the positive artwork and then transferring the toner image on the paper to a bare copper-clad board by means of a heated flat iron. After the toner re-hardened on the copper, he somehow dissolved the surrounding paper and then etched the toner-resisted board in ferric chloride. Some touch-up was usually necessary prior to etching, but I was semi-impressed with the results. Cheap, effective, and fairly quick turnaround. After etching, the toner came off fairly easy with a 3M Scotch-Brite abrasive cleaning pad.

Hop
 

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
Hi Hop
The old mplab has an in built simulator I used to use alot. You could step through your code and use watch windows to see the registers change. You could also set inputs high and low to see what the code does. I have not needed to use this in mplabx but google it you might get some results.
Adam
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
Hi Hop
The old mplab has an in built simulator I used to use alot. You could step through your code and use watch windows to see the registers change. You could also set inputs high and low to see what the code does. I have not needed to use this in mplabx but google it you might get some results.
Adam
Thanks, Adam. Apparently MPLAB X has a software simulator too, but it needs to be enabled under "Hardware Tools"... go figure. I will go upstairs to the HP laptop and give it a go. Maybe I should also join the Microchip forum, wherein I found an ancient post that said how to enable the software simulator.:)

Hop
 
Top