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, 07:11:16 AM
*
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 107594 times)

0 Members and 3 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 #100 on: August 21, 2012, 02:36:50 PM »
You'll get some additional resistance at the joint of the pin with a package that small.  Another consideration is that you'll want the MOSFET to be able to withstand the current pulse if a short occurs so you might want to use a bigger one anyway.  I use the SOIC-8 packages myself.  Atomizer shorts are not uncomon, usually a connector failure, but you'll want your mod to be able to deal with it when it happens.

When fitting small parts on larger traces, you can offset pads on the traces so they clear the space between the pins.  You can use a little copper fill to square off the end of the trace or use copper fills to run the heavy traces to begin with.   You'll want copper fill around those drain and source pins for heat sinking anyway.

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 #101 on: August 21, 2012, 06:04:10 PM »
I think I'll go with the larger one - completely my fault as I was looking at the SOT-223 packaged ones then managed to click the order line for the SOT-23.

I've just finished the first draft of the PCB based on the schematic and I've dropped the fuse and polarity protection MOSFET - just for the sake of saving space.
So the bottom board is mostly very large traces with the main atomizer MOSFET, LDO and one of the MOSFET pairs along with the voltage divider.
Middle board is the MCU and the second of the MOSFET pairs to control the power to the LCD and the top is just the LCD, 3 switches and associated hardware.

Spent all day on it so kinda snow blind with it now so will go over it all piece by piece in the morning - hopefully it'll be right and I can get a print out done to see if it's play time :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 #102 on: August 21, 2012, 10:04:01 PM »
Just had a failure moment while trying to find a translucent cap to stick on the trigger button - it seems they're just not available for the 6mm x 6mm tact switches.
So I have the choice of sticking a normal LED in place or my new idea of side lighting the lcd and use those LED's as the trigger indicator and to flash the on/off/low batt shutdown sequences.  Not sure it will look ok though, suppose it's personal preference really.  I personally don't like plain LED's on a tube mod but like the illuminated switches like on the ego batteries.  The idea of flashing the screen came to me after trying to work out how to illuminate the screen  without drawing too much current or taking up loads of space.  Then I thought of a digital lcd watch and remembered the side illumination technique so will try wiring up the new screen tomorrow and do a few tests to see what will work best.
Just figured after remembering the old style backlight there's probably no need to duplicate the LED signal if it's bright  enoughand the screen and switches are all together so should look ok.

Any thoughts on whether a flashing screen would capture your attention enough to check it?

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 #103 on: August 22, 2012, 04:56:20 PM »
On mine, the screen is normally dark and only lights up when it needs to.  When there's a fault, it lights up to display the fault including a low battery, over-current, and atomizer short.  I've had lots of faults monkeying around with these rebuildable atomizers.

I ran into the same issue with my own mods.  You just don't notice the screen light up when holding it in your hand.  In my case, I added a tri-color LED above the trigger sensor in front to provide various indications.  It flashes red toward my line of sight to tell me to look at the screen.  That works out well with a box so I don't know how you'd do something similar with a tube.

You're out of pins on the MCU so that's going to be a problem to add any more indicators.  Maybe you can drive an indicator toward line of sight off the LCD power switch.  It will show you obvioulsy when the screen lights up. 

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 #104 on: August 22, 2012, 05:05:23 PM »
Exactly my thoughts too - need something that will grab your attention and an LED isn't a problem to drive off the LCD power line.
I've managed to condense a couple of outputs into one so I've got a free one I'm going to use purely for indication purposes which was going to be just for the LCD backlighting.

Maybe stick something around the actual 510 connector that will illuminate through a lens?  Plenty of options I suppose but if I start with the  LCD backlight then move on toward adding a little more then it should be relatively simple.

Now I've gone and jinxed it haven't I? :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 #105 on: August 22, 2012, 05:15:20 PM »
I use light pipes for my charging indicators.  Nothing fancy, just some clear acrylic 1/8" rod cut to size.  Works quite well.  You could possibly do something like that off the LCD backlight.  If it were me, I'd go ahead and use the extra pin for an indicator.  That way you can flash it.  Nothing better than a red flashing light to tell you when there's a fault.

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 #106 on: August 22, 2012, 05:32:21 PM »
Well the backlight being at the top of the unit should make it nice and easy to add a lightpipe in place.  The other idea I had was to mount the connector in an acrylic tube (I've got the connector from an SD Keyring that fits perfectly in some acryilic tube I've got) so it would be a lovely ring of light if I use a nice high power led.

Plenty of options though.  Could even try using a voltage controlled LED and have different colours if I can get it right :)

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 #107 on: August 22, 2012, 09:04:58 PM »
Well I've just finished wiring up the tiny 8x2 display and it works lovely!
However I'm considering not using through wiring as it was a real ball ache to get it right as the pins are so close to the display itself so had to be very careful about heat transfer to the plastic.

Think I might go with tinned contacts and tinned pads on the board to almost smd it in place - there will be about half a mm gap but I think it should be possible by pushing a wire through the hole and heating that to form the link.   Clip it off and move on to the next one.  These 10 pins have caused me a little trouble but the result it fantastic :)

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 #108 on: August 23, 2012, 07:28:06 PM »
Just been messing with switching power on and off to the screen and I can see a few problems there with it not recovering fast enough to receive the data intact.
When you're running your display Craig, do you actually pull the power from it or just leave it on but with no activity being sent through to the display?
I've had this test rig running for 3 days now and I've still only used a third of the battery up - so I'm wondering if it might not be too much of an issue leaving it on?

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 #109 on: August 24, 2012, 02:56:16 AM »
You could leave it on I suppose.  It's up to you what you want your idle power consumption to be like.  In my case, it's minimized absolutely so the device does not require a power switch.  Also, I use a non-removable cell so idle power consumption is more of an issue.  My idle current draw is 7.5uA and drops to 250nA when battery voltage falls below 3.0 Volts.

I've run into problems like that with LCDs myself.  Normally, you should not have any issue cycling power on the LCD.  If you are, it's likely a timing problem.

Try adding a small delay before taking the LCD out of reset after power on.

Make sure all data and control lines are low prior to putting the LCD into reset and powering it down.  Make sure no data or control line is brought high until after LCD power on and taken out of reset.

Try increasing delays between initialization commands.

Verify you are not exceeding the LCD's data bus speed or switching from data to instruction to data too fast.  You can easily do that even with an MCU at 4 MHz.  I typically need to add delays for parallel buses.  For the serial ones, I usually need to run down the bus speed some amount and put delays between send commands in code.

Well, hope that helps.  LCDs can be tricky sometimes.  The vast majority of the the time, issues are just due to incorrect timing.
« Last Edit: August 24, 2012, 03:13:03 AM 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 #110 on: August 24, 2012, 08:53:23 AM »
Well I managed to stumble over a similar problem on one of the PIC forums and they fixed it by sending a clear to system bit BPF.1 which basically deep resets the LCD it seems.
So I do that once the LCD has been powered, wait for 10ms and then start sending data to the display.  All now seems to work fantastically.  I think, seeing as the power consumption on this LCD is so low (max 1ma), I'll probably only use the one MOSFET pair for the voltage divider.
That way it resembles my test bed how it is now with the LCD power being driven by a pin on the MCU.
Still doesn't give me any more pins to play with, but at least it's a little more room on the PCB to play with :)

Still find it funny that even though I've had the voltage divider powered up using the 2x 3k3 ohm resistors I'd got knocking about it's now into it's 4th day of the battery not needing charging - and that's with giving it some hammer at 4.2v last night too!

Here's a pic of the display hung off the breadboard.  Excuse the soldering, but I'm struggling with my hands atm so fine work is being a tad difficult (hence going for reflow for the main project!).

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 #111 on: August 24, 2012, 09:17:26 AM »
Nice looking display  :rockin smiley:

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 #112 on: August 24, 2012, 09:24:51 AM »
Handy thing is, that battery display is wrong on that picture.  Only just noticed but doing the reset on the LCD wipes my custom characters so have just fixed that bit :)
The lines for the battery level should be vertical not horizontal, it's about right on the battery level though - it's hardly moving at all on these two 16340's!
As soon as the ACS712 turns up I can plug it in and show the ohms too - code's in place, just have the ADC input tied to ground to show unknown resistance for now :)

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 #113 on: August 24, 2012, 03:53:32 PM »
Well having stumbled upon this little image of the internals of a Provari.....



I thought it was quite a good idea using the positive input as a battery contact so have added that to the lower board.
I should be able to knock up a nice slab of metal to drop down after being soldered onto the PCB and work as a stable battery contact along the edge of the three boards.  Then I can use a similar sort of thing to push onto the interior of the tube to pick up the negative supply similar to the kick.

Here's the not very complete PCB layout anyway - have done it in ExpressPCB for ease as I'm messing around with layout etc and I've got the import into eagle pretty much sorted too.

I still have a bit of work to sort out the LCD connection as having routed the traces to the contact points I then realised I wanted the display the other way around!  Pretty simple job, just a bit of re-tracing required.

Offline Topper

  • Full Member
  • ***
  • Joined: Mar 2012
  • Location: Bulgaria
  • Posts: 49
  • Karma: +13/-0
Re: Beginnings of another MCU mod - but using PWM
« Reply #114 on: August 24, 2012, 04:08:22 PM »
Amazing job till now  :rockin smiley:
I'm reading every one post of your guys and feel like in lesson "How to build perfect AVP"  :popcorn: ;cheers;

PS:When opening a Wish list

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 #115 on: August 24, 2012, 04:20:55 PM »
Well I wouldn't call myself an expert by any stretch of the imagination - it's been a couple of decades since I did any real electronics at Uni so I'm having to re-learn quite a bit as I go :)

Certainly though if I can get all this compacted down enough and farm the fabrication out I'd probably do similar to the Nivel chip and do short runs for people as once I get the reflow plate sorted I'll be cooking on gas, well electricity at least :)

I'm still looking at the cigar tube though and wondering if I can make this fit.  It's certainly short enough and at 19mm gives me about 1.5mm to spare width wise it's just whether I can work the stainless to make it all look ok as when I was trying to drill a hole to mark out the display outline I went through 3 drill bits without making so much as a scratch on the tube!

Offline Topper

  • Full Member
  • ***
  • Joined: Mar 2012
  • Location: Bulgaria
  • Posts: 49
  • Karma: +13/-0
Re: Beginnings of another MCU mod - but using PWM
« Reply #116 on: August 24, 2012, 04:37:51 PM »
I'd made some homebrew VV with electronics from TI and KIS in tubes of flashlights  :wave:
So you have and end caps, springs and so on. You should make only the top cap with 510 treat (Craig have very slick by him own design and made in China)

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 #117 on: August 24, 2012, 05:05:19 PM »
Craig is a Mod God - absolutely the person I aspire to when building this up.

If I can make this half as good as his I'll be over the moon :)

Tempting on the flashlight though - if I can get one that has the right dimensions at the right price I'd definitely take it.

Offline Topper

  • Full Member
  • ***
  • Joined: Mar 2012
  • Location: Bulgaria
  • Posts: 49
  • Karma: +13/-0
Re: Beginnings of another MCU mod - but using PWM
« Reply #118 on: August 24, 2012, 05:12:26 PM »
Look @e-bay for 18650 flashlights and take some nice looking and cheap  8)

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 #119 on: August 24, 2012, 05:14:28 PM »
I'm actually just browsing right now - just looking at some that might be ok, but need to get some listings with measurements to be sure :)

Offline Topper

  • Full Member
  • ***
  • Joined: Mar 2012
  • Location: Bulgaria
  • Posts: 49
  • Karma: +13/-0
Re: Beginnings of another MCU mod - but using PWM
« Reply #120 on: August 24, 2012, 05:16:43 PM »
dx.com also good source and free delivery

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 #121 on: August 24, 2012, 05:29:19 PM »
I'm thinking either a couple of these or perhaps a couple of these might do the trick.  Just depends on what the shipping time is like from DX to the UK really.

Should be able to join the two together to get the right height and being aluminium bodied they should be easy enough to cut with the Dremel.

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 #122 on: August 24, 2012, 06:17:51 PM »
Oh dear - I think I might just have found the perfect housing, as long as I can work out how to strip it all down that is!

http://www.dealextreme.com/p/g720-cree-q5-6800k-120lm-1-mode-white-led-flashlight-1-x-18650-110263?item=32

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 #123 on: August 24, 2012, 06:55:13 PM »
The enclosure (or tube) is always the hardest part for me.  I pay through the nose to have them fabbed out on an SLS machine.  Tubes are probably a lot easier, but I haven't done one.  Just boxes for me.  And thanks for the compliment, BTW.

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 #124 on: August 25, 2012, 08:04:06 AM »
And I *think* that concludes the PCB designs.
Won't know 100% until the rest of the components arrive though and I can get it fully set up and tested on the breadboards but if the theory matches the practice this should be good to go as far as running across 3 boards goes!

Ended up ordering two of these last night too - will see how they look when they arrive  :popcorn:

Anyway, here's the new PCB layout with single MOSFET pair driving the voltage divider and LCD panel the right way around so it's viewed with the atty to your left and the buttons to your right.

Still unsure whether to do something different with the main button, but will see what it looks like as I'm going to mock up the boards using some card and see how it looks and if there's anything else that needs moving around at all.

And here's a shot of the display with the correct battery level indicator this time :)
« Last Edit: August 26, 2012, 05:45:06 PM by sterling101 »

Offline Topper

  • Full Member
  • ***
  • Joined: Mar 2012
  • Location: Bulgaria
  • Posts: 49
  • Karma: +13/-0
Re: Beginnings of another MCU mod - but using PWM
« Reply #125 on: August 25, 2012, 09:00:19 AM »
Yes, I'v also ordered some of this flashlights, but I'm afraid that will be a little shorter for your design and 18650 batt. But maybe with 18500 or 16400... Anyway the best try will be at place to put your PCB in the flashes. And think about supporting saddle from some acrylic tube cut off in half (so outside dia of acrylic tube must be 18mm around)

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 #126 on: August 25, 2012, 09:46:27 AM »
I've got some acrylic tube that will fit perfectly into an 18mm enclosure.  My plan is to house the PCB wedged between a lower portion and then use the upper portion as a light guide for the LED to illuminate the screen and also provide a visual indicator in the form of a ring around the atomizer connection.
The basic tests I've been doing should work fine as long as the LED is bright enough, but I'll have a few spare from the flashlights :)

I'm also running 16340 batteries as that's what I've got lying around, and the fact I got two free with a battery holder last week too kind of makes me want to stick with those ones.

Offline Topper

  • Full Member
  • ***
  • Joined: Mar 2012
  • Location: Bulgaria
  • Posts: 49
  • Karma: +13/-0
Re: Beginnings of another MCU mod - but using PWM
« Reply #127 on: August 25, 2012, 12:31:37 PM »
So far so good :)
Keep going right way pal and we waiting for this amazing going mod!

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 #128 on: August 25, 2012, 12:39:38 PM »
Can't wait to get all the components in now - have been vaping with it all day and it's fantastic although being tied to breadboards makes it a little tough to carry around :D

Using two high bright white leds illuminates the screen and gives enough light to illuminate the end cap too - tested using some cardboard tube with the acrylic poking out of the end.  Very effective, but not very pretty!  Has given the theory a good run and it works well in practice.  Now why is our postal service being so slow.... :(

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 #129 on: August 26, 2012, 10:27:36 AM »
Just having a quick think about the readings from the ACS712 current sensor.
I'll do a few tests when it arrives but I'm wondering about using it to detect a short circuit or an atomizer that's got too low a resistance.

What I'll need to do is output a low voltage of about 1V through the atty using the PWM driver (not a problem at all) then check the reading of the current sensor.  If my theory is right, if the VOut from the ACS712 goes above the norm for say 3A then trigger an error and don't allow for the full output of the trigger voltage.
I'm just wondering if Dave or Craig has done anything similar?  Certainly would prevent damage if there's a dead short as the lower voltage probably wouldn't even drive the coil at all.
I'm thinking I may have to send the sensing voltage out via an LPF to ensure it's not pushing battery voltage for however long it takes to sample the current, but I might get away with a short pulse that won't have much of an effect on the battery should a short occur.

So anyone got any views on that theory?

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 #130 on: August 26, 2012, 05:28:56 PM »
You probably don't need to do that.  You should be checking current while the atomizer is energized.  Ideally, you should sample current within a short delay (a hundred or two micro-seconds) after each PWM pulse is applied.  Just flag an error and shut down if the current signal is above a threshold.

To check for a short, you would need to use the ADC or a voltage detector to sample the rise time in output voltage, but it's somewhat redundant to current sensing.  If you're sensing current, you can tell if there's something wrong anyway.  It just depends on if you want to tell the difference between an over-current and short.

Another option would be to check resistance smilar to what you've mentioned, but the additional overhead makes it a more expensive, less efficient solution, especially considering you already have current sensing in place.

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 #131 on: August 26, 2012, 05:41:37 PM »
It dawned on me if I use a 1V pulse I won't "in theory" get the right current reading back from the current sensor.  So it would mess up the resistance calculation for the screen.
So I tried it with a pulse of the selected voltage running long enough to sample a few times and get an average from the current sensor.  Basically anything below a set level of ohms and it throws an error and breaks out without firing the atomizer.

Also started measuring up for fitting things and have had to lengthen the PCB's a touch so I can get enough room to get it all in place without looking silly with the buttons all on top of each other.

Also had an idea about the reverse polarity protection - cut a small notch in the PCB where the positive pickup pin goes and mount the pin back just far enough so it connects to a positive tip nipple but not to a flat negative side.

Can't wait for the current sensor and MOSFET pairs to turn up now - want to get playing with it!!!


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 #132 on: August 26, 2012, 06:02:40 PM »
One problem with that approach to output sensing is you can only detect a problem once prior to energizing the atomizer.  Once the atomizer is energized, you're no longer checking for a problem.  You may or may not have the time to sense resistance between pulses depending on your PWM frequency and duty cycle.  So, if an atomizer powers up okay, then shorts after the check, you won't detect it.  Circumstance can be a bitch :)

You shouldn't need to average readings for the purpose of detection (though you do for data display).  You should get a good reading from a single sample unless there's some design issue that prevents 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 #133 on: August 26, 2012, 06:42:29 PM »
I've popped a marker in that re-checks every couple of seconds so hopefully should be enough to prevent anything nasty from occuring.

Also means it can keep an eye on the battery voltage too :)

Offline synchro

  • Full Member
  • ***
  • Joined: Jul 2012
  • Posts: 43
  • Karma: +11/-0
Re: Beginnings of another MCU mod - but using PWM
« Reply #134 on: August 27, 2012, 05:08:49 PM »
One problem with that approach to output sensing is you can only detect a problem once prior to energizing the atomizer.  Once the atomizer is energized, you're no longer checking for a problem.  You may or may not have the time to sense resistance between pulses depending on your PWM frequency and duty cycle.  So, if an atomizer powers up okay, then shorts after the check, you won't detect it.  Circumstance can be a bitch :)

I know this design is space constrained, but if you're not already it would be a good idea to include resettable fuses.  Backup to what the software should detect but we all know how that goes sometimes. :D

I'm really interested in how this mod turns out, think its going to be fantastic. 

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 #135 on: August 27, 2012, 05:17:47 PM »
I'm going to see if I can get hold of an SMD fuse and stick it in on the bottom board.  Just wish I could buy stuff in lots of 5 or 10 instead of 100 like I'm having to at the minute!

Guess I'll have a few spare parts at this rate that's for sure :)

Just doing *another* re-design.  Trying to get it all together on two boards.  One lower board with the power control etc on it, and the other with the MCU, buttons and LCD.  It's tight but I think I might just be able to do it and it will save a lot of hassle trying to fit it all into a tube in the long run.
I'm finding I'm going to have to flip the upper board around so that the MCU and other components point down to the bottom board and the switches and LCD mount up above.
Really want to make the module around 19mm x 40mm if I can squeeze it all on.  Going to be a tough one though that's for sure!!

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 #136 on: August 27, 2012, 05:51:01 PM »
Yes, you do end up with a lot of extra parts the way you have to order in batches.  I have a large dresser drawer full of extra parts from past projects.  On the plus side, you do sometimes need them for redesigns which happen more often that you'd like.  You're finding that out.  I've probably built at least 3 or 4 interations for every one that I've actually finalized.  Though, I'm really bad about changing stuff without regard for the cost.

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 #137 on: August 27, 2012, 06:20:06 PM »
The problem I'm having is getting hold of 0805 10uF caps in numbers under 1000 units.
Don't know if it's a conspiracy but I'm sure the batches of 100 are disappearing as I click add to basket!

I'm going through the 'is this going to work' stage at tthe minute trying to condense it all down.  I'm sure it will but when you're trying to get rid of as many via's and links as possible and all that seems to happen is another one crops up it can be a bit soul destroying :(

Been laying out buttons too and I think the main trigger wil be better on the opposite face to the lcd.  Just makes packaging easier as it won't be on top of the voltage adjust buttons and it means I can use a larger button cap too.

Also means less footprint on the PCB which I'm all in favour of :)

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 #138 on: August 27, 2012, 08:41:49 PM »
Hehe, soul destroying.  I've run into that before.  I start thinking, "I'm trying to do the impossible here."

I can spend hours waffling on things.  I don't think there's any way around it.  There's usually more than one good way to do something.

Getting 10uF 0805 caps in small numbers is not a problem on this side.  I have a bag of a hundred sitting on the workbench next to me, think I paid 10 cents each for them.  Surprised you're having that much trouble in small quantities with such a common part.

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 #139 on: August 28, 2012, 03:26:09 AM »
Just seems they're not too available over here at the minute.  Might be a rush on regulator caps for mod building :D

Just been mulling over the circuit too and was wondering - do I need two decoupling caps on the MCU or just one on the vdd side?

I added two as before I've used the chips with dual power inputs - a vdd and vss on both sides of the chip but having only a single vdd I'm wondering if I really need the extra on the vss side?  It would certainly mean it being easier to package if it weren't required that's for sure!

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 #140 on: August 28, 2012, 12:45:33 PM »
You normally use a decoupler on each VDD - VSS pair.  They're most effective when close as possible to the two pins.  I'd say you could probably get away with using just one for both pairs, but you probably can not.  Your circuit is going to be very noisey switching those high currents to the atomizer.  It would likely play hell with the MCU without them.  You may even run into issues without a ground plane for the MCU.  Ideally it should be isolated from atomizer currents as well.

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 #141 on: August 28, 2012, 01:00:18 PM »
I could get a ground tap directly from the battery negative no problems - that way only the atomizer and associated parts will be running from that ground plane.
I'm thinking using a copper contact or similar to the case housing for the negative tap.  I should be able to fit a liner in there for a wire directly from the bottom cap area into the MCU board then to keep the two separate.  Also means it's one less wire to connect between the boards which is always handy.
I'll try and fit a second cap in place between vss and vdd on the vss side of the chip.  The one on the vdd side is situated nice and close to the MCU.
So far though I've got it down to two boards at 45mm x 19mm each so it's looking promising!

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 #142 on: August 28, 2012, 01:32:40 PM »
Quick screen grab - I've managed to squeeze it in and moved a few bits around slightly - it's tight but I think it should be solderable as the LED will be on fly leads to raise it up level with the LCD.

Still lots to do but it's getting there now.  SW1 is a fly lead off to the trigger switch itself with the return from the switch elsewhere on the board.  Should make packaging it easier at least - can be mounted in the lower housing then the boards slid into place above.

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 #143 on: August 29, 2012, 04:42:08 AM »
Yay!  New programmer arrived this morning and so did the MOSFET pairs - just the ACS712 to arrive now, order a couple more bits and another lcd module (just for laying down and soldering through jumpers to the board - don't think this test one will survive a de-soldering session!) and I think I'll have all the parts in and ready to go :)

On a side note I found a great way around the ICSP stuff.  A block of FIMO with the shape of the MCU and pins pressed into it, baked to harden then drilled out for the ICSP pins and solid cores stuck through connecting to a header on the back.  Simply hold it down onto the chip and program away!  Works better than I expected - and made another one up out of a PCI socket - just happens to be the right pitch for the SOIC chips :)


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 #144 on: September 01, 2012, 10:15:09 AM »
Well everything except for the ACS712 has arrived.  I've programmed up one of the DIP18 MCU's to build the whole lot up on the breadboard to make sure everything is definitely going to work ok but it looks promising for now.

Keep thinking about switching the positive supply to the atomizer instead of the negative.  I've got a few P-Channel MOSFETS but I don't know if they'll do the job or not as I'm feeling a bit slow today :P
Here's the datasheet to the one I've got anyway - http://tinyurl.com/c2t5s3a

I'm guessing I would just drive it as per the MOSFET pair but using the individual components to get the high current switching side done.

I'm not sure it would really give me any great advantage though as the connector will be isolated away from the main body of the mod so all the change would do is enable me to use a direct connection through the body for the negative to the connector.

Might leave it for now, but alter it in a future revision, which at my current rate might be done before the weekend's out :D

New PCB layout attached anyway.

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 #145 on: September 12, 2012, 01:06:20 PM »
Just a quick update really.  Things have had to be changed around a little with the pin-outs due to limitations in the target MCU but it's not a big deal really.
To accommodate all the changes though it's taken quite a bit of re-coding so I've made the decision to re-do the whole lot of the code from the ground up utilising the new MCU's enhanced functions which should make things quite a bit more reliable too (hopefully ;) ).

So, in time honoured fashion the code currently is sitting flashing the back light on and off every second - the beginning of the LBL technology portion (little blinky lights) :D

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 #146 on: September 12, 2012, 01:32:26 PM »
I'm glad that you are a proficient programmer and are able to over come obstacles like this  :applaude:

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 #147 on: September 12, 2012, 01:42:12 PM »
It's all about the logic with programming - me though, I tend to play it like pick-up-sticks - throw the code in the air and see where it lands :)

Seriously though, for what we need in a PV it's an easy job with very little complicated bits and even then they're just a simple interrupt to sort out (mostly time related things).
Here's a link to one of my other things that's on the boil at the minute - will eventually be a full blown game tied into the Zombie Fallout novels by Mark Tufo but in it's current guise you get to wander around the housing complex in the book dodging zombies that have full AI and reasoning built into their path finding and attack algorithms.  Now that took some real programming :D

http://host-a.net/u/lwindridge/ZombieFallout.exe


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 #148 on: September 12, 2012, 05:07:09 PM »
Yes, MCU programming is a lot different than computer programming.  I've done a little of that, but only what I learned in college.  With MCU's it's more about dealing with electronics rather than dealing with user input and output.  With MCUs you can actually program in assembly if you want to.  There's no way you can do that with a computer program.  Well, I suppose you could, but it would be quite a chore.  MCU programs are usually pretty small.  The one I'm running is in my mod is about 8kB.  You can't do much with a computer program that size.

Offline wwwest

  • Full Member
  • ***
  • Joined: Jun 2010
  • Posts: 42
  • Karma: +8/-0
  • Gender: Male
Re: Beginnings of another MCU mod - but using PWM
« Reply #149 on: September 12, 2012, 05:09:49 PM »
My hats off to you programmers. Simply amazing  :beer-toast:

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!