gfxgfx
 
Please login or register.

Login with username, password and session length
logo
 
gfx gfx
gfx
19852 Posts in 1275 Topics by 5182 Members - Latest Member: charbuild March 28, 2024, 12:00:22 PM
*
gfx* Home | Help | Search | Login | Register | gfx
gfx
Breaktru Forum  |  eCigarette Forum  |  Modding  |  Topic: Beginnings of another MCU mod - but using PWM
gfx
gfxgfx
 

Author Topic: Beginnings of another MCU mod - but using PWM  (Read 107605 times)

0 Members and 5 Guests are viewing this topic.

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #50 on: August 13, 2012, 04:17:07 PM »
Use the SMD PTC fuses.  They're a lot smaller and they have lower resistance.  Littelfuse makes a line with ultra-low resistance.  I use a 1210L350SLWR.  The other option would be to just use protected cells.  That would make the fuse redundant, unless of course, you want the fuse there as a backup, nothing wrong with that.

Having your PCBs made should not be an issue for cost, maybe for time, but it's usually not a problem for me.  I use these guys;

http://dorkbotpdx.org/wiki/pcb_order

It will cost you about $10 for three 2 layer boards that size.   You would have to use different software though.  He takes raw EAGLE files and Gerber plot files.  You can use the free version of EAGLE.  It's limited to 4 inches in board size and 2 layers, but your board is within those limits.

I would recommend against using jumpers.  For one, they take up some space and you'll probably forget about them.  You may be surprised how often you will re-program your board when developing your project.  If you use a 2 layer board, trace routing will be less of an issue.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #51 on: August 13, 2012, 04:28:14 PM »
Now that's an incredibly cheap price for those PCB's - just installed Eagle so going to have a play and see how I get on with it.
Wanted to pop a fuse in place as although I'll be using protected 16340's at first I'll probably get some higher capacity IMR 18350's to run with if I feel the need for a spare set.  Seemed like a bit of forward planning could save a few batteries in the long run should any problems occur on the atty end!
Looking at the SMD fuses I might grab a few on the order (which is steadily growing as I'm working things out) so I have the option then for on other projects I can use either.

I only went for jumpers as it meant I could align them in a place where clearance wouldn't be an issue and when I'm testing I'll be using the DIP version of the chip on the breadboard anyway so it'll only be on rare occasions after the first few trials that I'll be updating.  The other reason is I've got so many headers and jumpers I might as well find a home for them somewhere :D

Right, time to learn Eagle....

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #52 on: August 13, 2012, 05:54:10 PM »
I think that PCB fab charges $5 for international shipping.

Sorry to say that EAGLE is a real PITA to learn, but, it's going to be a lot more flexible than the software you're using now.  It's designed to build PCBs from schematics, but you can design your boards directly in the board editor by manually placing "routes" before laying out traces (routes is the EAGLE term for an electrical connection) .  It's weird, but that's how it works.

Just saw your schematic, missed that before.

You're missing the bias resistors on the base connection for your bipolar junction transistors.  You can can use bipolar transistors if you really want, but MOSFETs are generally considered a better solution.  MOSFETs do not need to be biased like bipolar transistors.  Eliminates the need for a resistor that way.

That switch on the LCD is not going to work.  You'll get current bleed from the other connections and the LCD will do screwy things.  You need to switch the high side on the LCD.  You should use a P-channel MOSFET or a complimentary pair of MOSFETs for that (a complimentary pair reverses the logic so low is off and high is on).

Once you have a switch on the high side, you have to be careful not to leave any of the control and data pins in a high state when the LCD is shut down.  You'll get current bleed (within the LCD's logic chip) if any of the pins are in a high state.  Again, it will cause the LCD to do screwy things.  You can either ensure all MCU outputs to the LCD are low before you shut down the LCD or add 47k resistors in series with those data and control connections.

You need to switch the high side on the ADC voltage divider.  Otherwise, when the transistor is off, full battery voltage will be present on the MCU's analog input which will fry the chip.  You'll need a complimentary MOSFET pair.  It will isolate the MCU from battery voltage.  You can get cheap and small complimenatry pair MOSFETs on a single chip.  It's something commonly used.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #53 on: August 13, 2012, 06:06:16 PM »
Sir you are an absolute wizard :)

Will have a dig through and see what parts are available - sounds like the complimentary pair is the only real way to go so might as well get it sorted :)

Just seeing if I can do any conversions into Eagle from the Express software and I'm just running through a script that might just work for the PCB itself so fingers crossed...

Update:  Yes I can convert the PCB files, but the clearances are too fine for the PCB fab - concentrate on the components and schematic for now I think although Eagle doesn't have half the parts I'll be using so need to build a custom library I think.
« Last Edit: August 13, 2012, 06:25:08 PM by sterling101 »

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #54 on: August 13, 2012, 06:35:30 PM »
I usually finish with the breadboarding before actually getting to a PCB design.  Chances are, things will change some amount after you have things breadboarded and working.  You can make little proto boards to breadboard your SMD components.  Looks like this;

http://s1232.photobucket.com/albums/ff380/chblock/?action=view&current=breadboard.jpg

BTW, I don't use any of the canned parts in EAGLE.  I build my own libraries.
« Last Edit: August 13, 2012, 06:39:58 PM by CraigHB »

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #55 on: August 13, 2012, 06:46:28 PM »
Does this look ok for a complimentary MOSFET?  Think it has the right specs but want to be 101% before ordering :)
PMDT290UCE

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #56 on: August 13, 2012, 07:16:43 PM »
I couldn't get a link on that.

Here's the one I use in my latest mod;

http://www.fairchildsemi.com/pf/FD/FDG6332C.html

If it compares well to that one, it will work good.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #57 on: August 13, 2012, 07:33:54 PM »
Even better, Farnell stock that one so have put a few on the order sheet.

Will dig out a few circuits to see how to configure them.  Definitely feel a change coming on though as space is my greatest enemy on this (well, and the lack of money lol) so thinking  of a main pcb for the mcu and major components, switches and lcd on another daughterboard and perhaps shift other stuff like the battery and atty connections/components on another.  I've not got a set size on the tube I'll be using yet to house it all but I want to make it nice to hold in the hand so probably a diameter of about  an inch would be perfect, but I'll probably take a trip to the local hardware store to check sizes/materials etc this week but won't buy anything until I'm happy it's ready to go.

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #58 on: August 13, 2012, 07:50:13 PM »
Hehe, space is always the enemy.  I've reduced the PCB area by a third for the mod I'm working on now, talk about cramming 10lbs of crap in a 5lb bag.  At one point I thought about stacking PCBs, but then decided it was just easier to place components on both sides.  That's something you normally want to avoid since it makes assembly more difficult, but it was best way I could think of.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #59 on: August 13, 2012, 08:17:29 PM »
Have just read an article about liquid epoxy solder - apparently it's getting better now and losing more of it's resistance characteristics.
Still not sure of the best method to do the attaching/soldering as I've never worked with surface mount components before but if it's still available I remember a solder "paste" which was like flux and ground solder/tin which you painted on and then heated to about 220C and it formed a proper solder joint.  That was way back in the 80's though and all I can find now is flux being called solder paste.
Think my 12W super mini iron might not be up to the job though somehow :)

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #60 on: August 13, 2012, 08:59:39 PM »
You have two ways to go with SMD as a hobbyist.  You can do your own reflow or you can solder by hand.  I solder by hand myself, but that's from decades of doing stuff with electronics way before surface mount and reflow soldering was invented.  I just haven't motivated on messing with reflow at all.

For hand soldering SMD components, you need a good variable temperature soldering station with a very fine tip.  I use a .015" tip.  You need very fine rosin core solder.  I use Kester 24-6337-0007 which is .015" in thickness.   You need 10x magnification minimum.  I use a stereo microscope, but you can use a jewelers headset or any other magnifier that works well for you.  You need a pair of very fine tweezers to handle the small parts.  I use a flux pen to lay down a layer on component pads.  It dries and gets gooey pretty quick so it does a good job of holding chips in place for soldering.

Once you have all the tools and equipment, you'll find hand soldering SMD not all that different from the old thru-hole stuff, just the scale is smaller.

Reflow is a bit of an art.  I haven't tried it so I can't say much about it except you need a good solder paste, a variable temperature hot plate or toaster oven, and a good temperature probe to get the heating and cooling profile right.  I've read of lots of people doing their own reflow and it comes out just as nice as the factory.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #61 on: August 14, 2012, 09:34:20 AM »
Hmmm, tempted to see if I can get some solder paste and have a go at the re-flow method.  If I can get it right I might go crazy and fix my x-box too :)

Just mocked up some bits using a cardboard tube that some tin foil came with and some strip-board random pieces I've got lying around and I should, with an I/D of 1" be able to fit 3 boards, one main board with the logic controls on it, one upper board with the LCD and switches and a lower board to handle the high amps.  If I use pin and receptacle headers I should be able to assemble the three boards as one and slide it in the tube nice and easily and fill in any gaps there might be with an insulating sleeve.

Just thought of something else too - I was going to add some current measurement device too which will probably need to be on the high current board and the data sent up through a pin to the PIC.

Dave, what was the current sensing chip you used?  I can't remember or find the reference to it at the minute :)

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: Beginnings of another MCU mod - but using PWM
« Reply #62 on: August 14, 2012, 10:01:24 AM »
For 3.3v
ACS711/

For 5v
ACS712/

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #63 on: August 14, 2012, 10:28:22 AM »
Cheers Dave - have popped one on the order :)

Still trying to get my head around Eagle - not the easiest in the world I must admit!

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: Beginnings of another MCU mod - but using PWM
« Reply #64 on: August 14, 2012, 10:32:54 AM »
Cheers Dave - have popped one on the order :)

Still trying to get my head around Eagle - not the easiest in the world I must admit!

I know it's a real pain. Craig turned me on to it. It takes a long time to make a PCB. Having to make your own library components. Express PCB is so fast in comparison but you're obligated to use their service if you intend to job out the board.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #65 on: August 14, 2012, 10:55:51 AM »
Tempted to fudge it together in Express PCB to do a home made board first then get it all done properly in Eagle for a full version afterwards if I decide to job out the board and make more up.  Been on it half an hour now and I've almost got the PIC made into a device - gonna take a long time this one!

Edit:  What's Eagle's problem with connecting VDD to +5v and VSS to Gnd?  Keeps having a fit about it when I do the checks on the schematic????
« Last Edit: August 14, 2012, 03:39:31 PM by sterling101 »

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #66 on: August 14, 2012, 04:15:01 PM »
Yes, it takes a while, but once you have things set up, it goes pretty quick.

Can't help you on EAGLE's schematic editor, I dont' use it.  I use another CAD program for my schematics and build my boards directly in EAGLE's board editor creating my net list on the fly (EAGLE can do that).  The main reason I use EAGLE is because the fab I use takes the raw board files and I happen to have a full professional copy I got for free.  Saves me exporting Gerbers which isn't a huge ordeal, but it's one less chore.  In any case, it's probably the most widely used program for hobbyists because it has a free version and can do everything that needs to be done.

I've used the ExpressPCB software before and it's pretty limited even for making your own PCBs.  You'll want to mirror your prints and IIRC, it can't do that.  You have to design everything mirrored which is really screwy.  EAGLE can mirror prints simply by selecting a printing option.  ExpressPCB has other limitations that are a problem for me even when using their fab service.  I used their service once some time ago, but have since found a couple cheaper sources.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #67 on: August 14, 2012, 04:17:24 PM »
I'm working through it bit by bit - turns out if you connect a net that has a different label to the pin it will throw a warning up.

Kinda makes sense now but by god is it annoying lol

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #68 on: August 14, 2012, 04:35:35 PM »
Yes it is.  EAGLE is highly structured like any PCB software suite.  However, things that are fairly intuitive for other programs tend to be convoluted in EAGLE.  More than once, it's made me want to throw my monitor through the window.  Though, it can do everything you need to do and once you get used to its quirks, it's not so bad once you get to know it.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #69 on: August 14, 2012, 04:44:02 PM »
It's the lack of information that I found tough - I haven't found anywhere that tells you how to modify an existing part for your own library.  Finally figured it out by messing and copying pasting and managed to get the 16F1847 with all pins correct in a library.
Other than using nets and not wires for connecting the parts it's not too bad on the schematic side of things - just hope there's nothing just around the corner to beat me back again now I've said that :)

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #70 on: August 14, 2012, 04:49:26 PM »
Hopefully.  I'd have to say the Library system is the weakest point for EAGLE.  They do not make it convenient to build your own parts.  It's like they assumed no one would ever want to use anything other than the pre-built models.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #71 on: August 14, 2012, 04:51:43 PM »
I got that impression too - great if all you wanted to use were static items and nothing that has recently been released (like the 16F1847 at under 2 months).

Still, I'll keep at it and see how I get on.

Just been wondering about a diode for the battery too - just in case I have a brain fart moment at some point and reverse the polarity.  I'd guess a regular 10v would do the trick ok for that?

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #72 on: August 14, 2012, 05:08:33 PM »
You want to avoid diodes in line with your power supply.  They are very lossy.  A standard diode has a 1V drop around 1A.  With an atomizer current tof 2A, that's a 2W loss!!!  That's huge considering atomizer consumption is around 10W.  That can be cut that in half with a good Schottky diode, but that's still 10% and higher.  The exception is when used as a rectifier in a switching regulator, but synchronous converters that use MOSFET rectifiers instead of diodes are much better.  They're becoming the rule more than the exception anymore.

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: Beginnings of another MCU mod - but using PWM
« Reply #73 on: August 14, 2012, 05:09:28 PM »
If you Google around you can find the PIC library for Eagle that someone else has made. When I sometimes get lazy I search for libraries.
Be fore warned that they are from users and may not be perfect. That's when it's time to roll up your sleeves and get to making your own.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #74 on: August 14, 2012, 06:08:17 PM »
I tried the PIC library Dave but the 16F1847 is so new it's not in any of the ones I downloaded.

Managed to get it in right though - just need to get making the schematic up and running with all the components in place now.  Had to make one for the vreg I've selected too as it wasn't around in any library I could see anywhere.

On a side note - here's my current order list ready to hit the buy button but want to be sure I've got all the parts ready as I'll be out of cash very soon and it's pay day tomorrow (yes I did mean that right) :(

Edit just read what you said about the loss from adding a diode - I wasn't considering that much of a loss.  I think I'll do without or come up with a better method for making sure reverse current isn't possible I think!
« Last Edit: August 14, 2012, 08:05:54 PM by sterling101 »

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #75 on: August 15, 2012, 06:06:48 PM »
OK, on the topic of reverse voltage protection how do these two quickly knocked up ideas look?

I'm erring more on the positive side one for ease of protection but just want to see if I've got the idea right really.  Still not sure whether it will be a good idea anyway without a mechanical off switch as the MOSFET will be drawing current at all times if I'm right but I suppose it depends on the characteristics of the MOSFET to how much of an impact that will have?

Also wondering on detecting a short or too low a resistance coil - I'm guessing I just look at a certain value from the current sensor to work that out but I can't seem to find an actual look up to tell me what current is what Vout from the ACS712 unless I'm being quite blind and the formula for working it out is in the datasheet somewhere??

Been looking at debouncing the switches too - still undecided if I should just write a little bit of code to hold a delay on the button input for say 30ms to get over the debounce or to try the hardware method.  However, I have ordered quite a few bits today, just need to get the main order from Farnell sorted now :)

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #76 on: August 15, 2012, 09:50:54 PM »
You're on the right track, but I have to think about it to say exactly and I dont' have the energy right now.  You want to consider the MOSFET's body diode.  A MOSFET can only block current in one direction.  You'll want to set it up so the reverse polarity condition gets blocked by the MOSFET's body diode.  The MOSFET has to be off for reverse polarity and on for normal polarity.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #77 on: August 17, 2012, 04:41:12 AM »
Been doing some more coding in the bit of spare time I've had over the past couple of days and now have a 5 click on/5 click off system working well for sending the thing to sleep and preventing false firing in a pocket etc.

Had a chat with a few guys who've used the display I'm using too and using the chip I am I can drive the power directly from the PIC's output pin without any issues at all.  I just need to pull the data lines low before switching off so there's no current leakage but other than that it's good to go!

So I suppose the only need for the complimentary pair will be the voltage divider so need to get that sorted out.  I'm assuming I drive the gate of the N-channel from the pic and have the g/s feeding 0v to the P-channel's gate which can switch the current through the voltage divider on the high side?  So basically we're using the n-channel as a logic inverter?

Right - hospital appt so better run :)

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #78 on: August 17, 2012, 07:22:37 AM »
Here's what mine looks like;

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #79 on: August 17, 2012, 07:40:18 AM »
Re. the LCD, you might be able power it with the PIC, but there's a couple issues.  For one, the LCD display itself is driven at higher voltage using a charge pump.  That means there is some amount of capacitive loading so there's some inrush current when the LCD starts up.  There's also the LCD backlight which typically draws a minimum of 10mA.  When the LCD starts up, it will easily surpass the sink limit for a PIC port pin, usually 25mA.  That could cause a brownout for the MCU processor core.  Powering the LCD with the PIC will also cause a slow ramp-up in voltage for the LCD which can be a problem.  It may work, it may give you trouble.  I suppose you can always try it and see.  If it works okay, it will save you some PCB real estate and some parts, but I wouldn't borrow the trouble myself.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #80 on: August 17, 2012, 08:27:39 AM »
Excellent - I figured that was the way it would work.  Have got 10x FDG6332C on the way now so might as well use it for the LCD as well.

Once the last bit of the order turns up I'll have everything to hand and can start the prototyping.  I think I've got most bases covered though, and every pin on the PIC used too!
Hopefully I've got enough components from the order that arrived this morning to start mocking most of it up on the breadboard.
For ease of use I've got a selection of through hole components that pretty much match the SMD ones so I can prototype and move things around without having to build the breakout boards etc. so I should have a working prototype fully set up in no time all being well :)

Can't thank you enough for your help though - I knew I was rusty on a lot of things but didn't realise I was quite that bad lol

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #81 on: August 17, 2012, 02:28:58 PM »
Welcome, best of luck with it.  It's definitely a worthwhile project.  May have a go at a PWM regulated mod myself some day.

I'm using a 28 pin PIC.  I have zero unused pins.  Lucked out on that or would have had to move to a 44 pin PIC consuming a lot more space.

BTW, have you seen the PBusardo review on the Gripper?  What a weird duck that is.  Based on what he shows in the review, it looks like it's boosted to 6.2V then PWM regulated for a range from 3 to 6V equivalent.  Man those Chinese engineers are whacked.  Anybody else would have just used series cells with PWM or a single cell with a variable booster, not both.

I have to give them credit though, it's a novel way to get around the limitations of a booster (can't go below input voltage), but it's really convoluted.  There's no reason to do that just to run a single cell.  It doesn't have USB charging.


http://www.youtube.com/watch?v=TCS1WbsjJOs
« Last Edit: August 17, 2012, 02:39:52 PM by CraigHB »

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #82 on: August 17, 2012, 02:53:56 PM »
I love the start of that one - classic blooper material but left in :)

I did think maybe use a boost to upper voltage then regulate down with the PWM but like you pointed out the booster normally uses PWM then smoothed out to generate the boosted voltage then you're re-running PWM again so it's kinda like doing the same again, again :)

Just been trying to find a decent cheap usb pic programmer to replace the one I've got that now isn't being updated to support the new chips (kitsrus kit 149).  I've got a generic JDM programmer too which is fine, but none of my PC's have serial ports these days and the USB->Serial lead doesn't cut it.  My other one is the flashlab 77 that I use for prototype staging as I can do ICD with it but that needs a bootloader to work, which means I need another programmer to do the bootloader first.  Can you see the catch 22 I'm in here? lol

Might consider building a pickit2 clone if I can find the parts out or maybe a version of the usbpicprog.org programmer as that is quite a nice set up.

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #83 on: August 17, 2012, 03:10:23 PM »
I know lots of people build their own PIC programmers.  It's an interesting project in of itself.  In my case, I'm just using an old PICkit2 with an older chip it supports.  Until I use a newer chip, I'm not going to get another programmer.  When I do, it will be another PICkit or whatever else it's been superseded with.  They are cheap enough.  With what i spend on electronics and e-cig mods, spending $50 on a programmer/debugger is pretty much a non-issue in comparison.  Though, it's probably more expensive for you with international shipping and VAT.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #84 on: August 17, 2012, 03:14:46 PM »
Just been looking at the PICkit2 clones and they seem to offer good compatibility with the latest firmware - in fact it seems it uses Microchip's own firmware by the looks of things!
Only problem I do have like you say is it's the slow boat from china for 3 weeks or another $40 on top for shipping over the atlantic.

I've got a PIC18F452 here that supports direct usb interfacing so maybe the info on usbpicprog.org might be worth a punt??

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #85 on: August 17, 2012, 03:21:22 PM »
A lot of people use the bootloader.  There's one that comes with MPLab, but I haven't used it.  Though, like you said, it's a catch22.  You need the programmer to install the bootloader.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #86 on: August 17, 2012, 03:36:34 PM »
I thought these were quite interesting too though...

http://simon.derr.free.fr/site/spip/spip.php?article11

http://electronicsadvices.blogspot.co.uk/2009/04/full-featured-pickit2-clone.html

And very much last...

http://www.embedinc.com/products/lprog/index.htm

As it's more of a buy from Microchip at a cost than a potential DIY jobber.

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #87 on: August 17, 2012, 03:52:33 PM »
That' really cool.  Looks pretty easy to make.

I don't think clones can hardware debug so that might be a consideration.  You can probably get by without the hardware debugging aspect, but the few times I've needed it, there would have been no other way to troubleshoot my problem. 

The problem with the PICkit2 is it's all but obsolete now.  If you want to use an older chip it supports, no problem, but if you want to use any of the newer chips, you need the newer programmer/debugger.

The latest inexpensive one is the PICkit3, but I think they may have killed the potential for cloning since the device has to download device specific firmware from Microchip for every differernt PIC you want to work with.   If you switch PICs, you have to reload firmware.   A lot of people thought that was really lame and complaned a lot.  Others don't seem to have a problem with it.  I think it was their way of dealing with how big the product line is getting.  To manage a monolithic version of firmware to support every chip would be too unruly.  Even the PICKit3 is starting to get some mileage on it now and I don't know what's coming down the line to replace it.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #88 on: August 17, 2012, 04:03:30 PM »
I'm really thinking of the usbpicprog one - it's cheap, open source and very well respected.
It's pretty much future proof as far as the firmware goes as they also release the source code so for a geek like me it's perfect :D

Edit: bugger it - just ordered one so I can get going with it :)
« Last Edit: August 17, 2012, 04:06:31 PM by sterling101 »

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #89 on: August 17, 2012, 04:09:16 PM »
That's the problem with building your own programmer, if you need it, it's because you need it now.  Sort of like making your own hammer to build a house.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #90 on: August 17, 2012, 04:19:41 PM »
Yep - good analogy ;)

Still, only coming from The Netherlands so it should be here by midweek all being well.

Shame about the old K149 I've got though - when I bought it in 2002 it was cutting edge being serial AND USB together and it was being updated monthly with new MCU's but it seems they weren't making enough from it so it's pretty much completely dead and buried.

The JDM, well they just work - on a hardware serial port that is!

Great thing is I can do all the ICD stuff on pretty much any chip with the FlashLab board so I'll still develop on that then use the new programmer for the main burning/ICSP work.
Just don't tell the missus I've just spent another £20 :D

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #91 on: August 17, 2012, 06:46:51 PM »
The newer PICs can optionally program via JTAG which allows a larger option for 3rd party programmers. 

I've had several programmers that have ended up just getting thrown away.  It's kind of racket with those I think.  You have to get a new one every few years.  I'm sure it's not on purpose, it's just the way things go as chips evolve.  There was a time not too long ago where you couldn't even get a programmer on the cheap.  It seems they've been around forever, but they haven't.  It wasn't until after EEPROM programmable MCUs came out around the mid 1990's that you could get one.  It certainly was a boon for hobbyists.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #92 on: August 17, 2012, 06:58:03 PM »
I remember at college the programmer was locked away and only brought out for very special occasions when a chip needed burning and you had to make sure nobody turned on the lights in case it messed with the program before you could cover the EPROM window.

Thankfully things are now more abundant - and an awful lot easier for the hobbyists like you say.

Been mulling over whether I can use this old JDM board for the socket but link the ICSP port up to the new programmer when it arrives.  Not sure if it will work but if not I'll throw a quick one together on some strip board with the same links so I can program anything from an 8 pin up to a 40 pin MCU.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #93 on: August 18, 2012, 05:05:50 PM »
Well today I mocked the entire circuit up on two breadboards and the flashlab (second breadboard just had the LCD on to keep it out of the way).

Managed to alter a bit of the code around and managed to get it working pretty much spot on.  I've not included the MOSFET pairs as I'm still waiting for those so I have just linked the voltage divider control pin to an LED so I can see that working and the LCD power pin to the LCD backlight on the one I've already got (16x2 but the proper one has no back light).

Everything seems to be working as expected.  Voltage  controls work well and with no real issues, same with the main trigger.  Sleep modes and power up/down works perfectly and I've included a feature that if you press the Vup and Vdown buttons together it settles at 3.5v which is the default at power up after dropping the batteries in.  Decided that if the display is off then the first press of either the up or down button will do nothing at all to the adjustment but just trigger the display to turn on, then after that the buttons work as normal.

Only had one strange occurrence where it went on a 50% cycle at about Hz for no reason at all after firing, it only lasted a few seconds but I've got an inkling that was due to the switches not seating 100% in the breadboard as after re-seating them it's not happened again.

So all in all - yes, I'm impressed - 4.2v on a vivi-nova is absolutely lovely with the 2.4ohm coil head!

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #94 on: August 20, 2012, 08:17:25 PM »
Just a quick one guys - does the ACS712 allow current to flow between pins IP- & IP+ at all times or only when the sensor is powered via VCC?

Just working on the schematic again and as I'm still waiting on components I wondered if Dave or Craig you know off the topof your head as I can't see any reference to it in the datasheet at all.

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: Beginnings of another MCU mod - but using PWM
« Reply #95 on: August 20, 2012, 08:38:39 PM »
Just a quick one guys - does the ACS712 allow current to flow between pins IP- & IP+ at all times or only when the sensor is powered via VCC?

Just working on the schematic again and as I'm still waiting on components I wondered if Dave or Craig you know off the topof your head as I can't see any reference to it in the datasheet at all.

All the time

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #96 on: August 20, 2012, 08:45:47 PM »
Cheers Dave. Should make my life a little easier then :)

Can't wait to get all the bits in and start testing for real - even with the parts I'm running now it makes for a great vape.  Now I've got to decide what I can fit where and get it down in size enough to fit into a tube.

I guess the Provari uses some seriously small smd components to fit everything into an only 0.9" diameter tube!  Not sure I'll manage that myself, but it won't hurt to try :)

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #97 on: August 21, 2012, 04:15:36 AM »
Well another part of the order arrived today - and here's exactly how small that 8x2 LCD really is!

I think I might need to do a bit of wizardry with the wiring to get that fitted right - my first idea of through hole mounting pins really won't work :D

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #98 on: August 21, 2012, 06:04:28 AM »
And here's the latest schematic with the parts split over 3 boards.  I've gone for a power control board that can be made nice and beefy to handle current, a middle board to house the MCU and associated parts and a top board that contains the LCD display and buttons.

Might move a few things around to perhaps reduce the 3 boards to 2 but I'll know that more once I've had a go at laying out the PCB's to see what sort of room I'm likely to have.  The ACS712T module is an all in one pre-set one I picked up cheap off eBay on it's own breakout board so that will be connected using the header pins directly to the bottom board.

If I can get it right I'm hoping to achieve a maximum height of the PCB of 19mm (¾" roughly) by 50mm wide (2" roughly) and about 13mm tall (½" roughly).  This should then mean I can get away with a sub 1" tube to mount it all in.

So I think that should just about complete the schematic unless there's something glaringly obvious I've set out wrong - always possible :)
« Last Edit: August 21, 2012, 07:27:50 AM by sterling101 »

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #99 on: August 21, 2012, 12:23:38 PM »
Just before I dive in and try and do a layout of the power board PCB, I have a question for Craig really.

The N-Channel MOSFET's I've had delivered are SOT-23 and are rated at 5.4A constant load.  Only thing that's baffling me slighly is how the heck to get a 3.81mm (0.150") trace to the pins as it's so damn small?

Any pointers greatly appreciated :)

Failing that I might go back to the old faithful TO-252 as that's a much larger footprint to be working with!

Breaktru Forum  |  eCigarette Forum  |  Modding  |  Topic: Beginnings of another MCU mod - but using PWM
 

gfxgfx
gfx gfx
Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!