gfxgfx
 
Please login or register.

Login with username, password and session length
logo
 
gfx gfx
gfx
19694 Posts in 1260 Topics by 5033 Members - Latest Member: jackiehinchey November 18, 2017, 01:13:44 AM
*
gfx* Home | Help | Login | Register | gfx
gfx
Breaktru Forum  |  eCigarette Forum  |  Modding  |  Topic: 1st Attempt w/ a Microcontroller
gfx
gfxgfx
 

Author Topic: 1st Attempt w/ a Microcontroller  (Read 49728 times)

0 Members and 3 Guests are viewing this topic.

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +243/-1
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #100 on: July 25, 2012, 05:33:20 PM »
The (numerous) PIC MCU's I've got are all 5v so will need to use an LDO to get the voltage for it, but the ADC should only need a simple potential divider to bring it into the range that the ADC can cope with.  I was considering an external current sensor for checking the ohms of the atomizer but wondered if a voltage divider could also work for that as with a known resistance and a set voltage across the divider it should be a very simple piece of math to calculate the atomizer ohms.  I'd guess I'd need to have the atomizer on the ground side of the divider though and use another MOSFET to switch out the rest of the circuit from the actual atomizer driving circuit to make sure it's not going to fry the ADC channel when actually triggering the atomizer.  The only thing I need to play with is the lowest voltage I can output through the atomizer without actually triggering it which will probably be a trial and error thing I'd guess.

You can power the MCU at 5V or even 3.3V, then use a complimentary MOSFET pair to drive the power FET at battery voltage.  That will give you the lowest possible RDS(on).  With the low frequency, the propegation delay of a complimentary pair should not be an issue.  If it is, lower the frequency.  I use a MOSFET pair in my current mod to control input voltage to the converter.  The MCU drives a small signal N-channel MOSFET at 3V that in turn drives a P-channel power FET at battery voltage. 

You'll get a better reading on resistance if you measure current and divide it into voltage.  It's much simpler hardware wise to measure current than to build an ohmmeter into your design.  Measuring current is cheaper, simpler, and way more accurate.  Just use the current sensing chip Dave uses in his mods.  It will work well.  Since you know when the MOSFET is active, you know when to measure current.

You dont' have to, but I would use a P-channel MOSFET as the PWM switch.  That also makes it easy to put your current sense on the low side.

Use a simple resistor dividor to drop the ADC input for battery voltage within tolerance for the MCU.  In my current mod single cell mod, I run the MCU at 3V, so I use a divider with a 4.7k and 10k resistor on the ADC input.

Since you'll be running the MCU at 5V, you can do a low battery detection at whatever voltage you like.  A low voltage cut-out would be optional and possibly desirable if using unprotected cells.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #101 on: July 25, 2012, 07:04:53 PM »
Some good ideas there Craig!

Guess my first job will be to get some MOSFETs in and start testing code.
Might be worth seeing if I can get some LDO's and MOSFETs from TI on sample as they delivered the power reg boards incredibly quick from their base in the US to the UK - 2 days all in!

Any other hints on stuff I may be able to get while I'm there will be a great help too :)

Leigh

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +243/-1
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #102 on: July 25, 2012, 07:40:24 PM »
TI makes good stuff.  They make good LDO regulators and and good charger controllers.  I've never even looked at their MOSFETS.  Every time I do parametric searches on vendor sites, it's always the Fairchild MOSFETs that have the best specs and pricing.  So now I just head straight to Fairchild's web site.  They'll send you free samples for the asking. 

http://www.fairchildsemi.com/search/tree/power-management/mosfets/discrete-mosfets/

Microchip makes LDO regulators with really good precision if you want a solid voltage reference. They have 0.5% accuracy where most are 2%.  They won't send me samples anymore though.  Not sure what I did to piss them off or if they just aren't sending them to anybody.

I don't use any of the Microchip LDOs right now because I need ultra low drop-out and ultra low IQ for my mods.  On Semiconductor makes the best LDO regulators for that kind of thing.  I'm using an NCV551.  They offer samples, but you have to pay shipping and handling which can make them cost more than if you buy them from Mouser or somebody.  Though, if I can't find stock, it's a way to get the parts in small quantities.

Offline sterling101

  • Super Member
  • *****
  • Joined: Jul 2012
  • Location: UK
  • Posts: 180
  • Karma: +16/-0
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #103 on: July 25, 2012, 08:16:59 PM »
I tried ordering a few samples earlier from Fairchild but it wouldn't let me do it.  Said something about it not meeting their sample order criteria.  I'm guessing it's because I'm in the UK they don't want to ship overseas :(

Still, if I can find some adequately suitable stuff from TI it'll be a good starting point to populate the breadboard!

I've started a new topic so I can put bits on there instead of filling Dave's thread up too much as I'll be working on some block diagrams tomorrow prior to transferring onto a schematic so I should have something worth looking at within 48 hours :)

Offline TubeWatts

  • Jr. Member
  • **
  • Joined: Jul 2012
  • Posts: 13
  • Karma: +4/-0
Re: 1st Attempt w/ a Microcontroller
« Reply #104 on: July 25, 2012, 10:15:04 PM »
Ok well first off this is a TON of information to take in for someone who has never done anything like this before but i like a challenge haha. I am planning on making a box mod but start out with it just hanging out to get it down. Im going to be using:

Arduino Mini Pro 3.3v
FTDI Breakout 3.3v
Serial enabled 16x2 or Basic 16x2 LCD
      With 2 display settings via button
          Display 1, Line 1
             Volts, Current
          Display 1, Line 2
             Battery Guage(4 bar like cell phone or percent), Watts
         
          Display 2, Line 1
             Battery Volts loaded and unloaded
          Display 2, Line 2
             Ohm's for atty, and i cant think of anything for a second reading yet. (i might put the battery percent here)
Ok so now for the questions.

I am going to be using 1 18650 aw imr. Which is unprotected because i want to code in a 3.0V power cutoff but i havent been able to find how to do it.
 or would it just be better to get some protected batts.

Also i am a bit confused how i am going to get the current reading. I have heard of people using something like a current meter of something like that. I know i can get the voltage reading with the arduino but i need current so i can use the arithmetic to get watts and ohms.

Lastly i have heard of circuits used to measure discharge rate of batterys because i want to get accurate battery life. Do any of you know how to do this. I did a quick search on candle power but didnt find much about the actual circuit for it.

Thanks guys this has got to be one of the most inspiring forums. I have got so many ideas bouncing around i have a hard time keeping the organized haha.


Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +243/-1
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #105 on: July 26, 2012, 02:48:25 AM »
Hehe, I know what you mean about project overload.  I had three going at one point, but I finished one and put the other on the back burner.

For a single cell, you can make a cut-out pretty easily with a voltage detector and MOSFET.  If using an MCU, you can use a voltage detector to drive your LDO regulator's enable pin.  That will shut down the MCU and drop current draw close to zero on low voltage detection if you set things up right.

http://www.onsemi.com/PowerSolutions/product.do?id=NCP300

The other option, like you said, is to use a protected batt.  The only time you really need an IMR cell or other high drain cell is if you are driving a booster or using a low resistance atomizer with a smaller cell like a 14500.

To get a current reading, you use the MCU's ADC (analog to digital converter).  You need a signal proportional to current flow.  You can get it with a current sensing chip or with a current sense resistor and differential amplifier.  You can use a higher value current sense resistor to eliminate the need for an amplifier, but it wastes a lot of power.  The current sense chip is the easiest, most efficient way to go.  One you have a return value from the ADC for current sense, you just do a little math in code to convert it to an actual amperage value.

Voltage is set by the user so it's known unless you are using variable wattage.  With a current measurement, you can calculate resistance and power in code by dividing or multiplying voltage and current.  You could use an ohmmeter circuit to measure resistance prior to energizing the atomizer, but that's the hard way to do it.

To set up your battery capacity indicator, you measure cell voltage with the MCU's ADC.  Then you use a table in code to assign battery levels to ADC measurements.  You need a discharge curve for the cell.  You can plot that manually with a stopwatch and a load bank.

A load bank can be made easily and cheaply with 1/2 Ohm 50W wire wound resistors in series.  You just use test clips on the connections between them to get various loads.  You'll use the hell out of it in testing.  You can mix up the values a little if you want particular resistances.  For example, throw a 1 ohm in there and a couple 1/4 ohm ones.  Bolt the resistors to a heavier gauge aluminum plate.  Some heatsinks glued on to the plate with heatsink epoxy are helpful as well.

Another thing you can do for a makeshift load is buy a 10 ft length of 16 AWG nichrome wire.  You can just put test clips at various points on the wire coil to get exacting loads up to 3 Ohms.  Though the wire can get pretty hot and melt your test clips if using the little plastic ones (speaking from experience).

Okay, hope that helps.

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3299
  • Karma: +784/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt w/ a Microcontroller
« Reply #106 on: July 26, 2012, 08:17:20 AM »
Boy there has sure been a lot of interest in building MCU mods here and on other forums.
I hope in a couple months when the vapers community are dominated with MCU mods by the new breed of modders  :thumbsup: , Craig and I are not forgotten... Craig who??? breaktru who???   :laughing2:

Offline poorboy

  • Sr. Member
  • ****
  • Joined: May 2012
  • Location: Manila, Philippines
  • Posts: 60
  • Karma: +9/-0
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #107 on: July 26, 2012, 10:55:32 AM »
Iam learning a lot just by reading your threads breaktru and craig. Im also reading this http://www.ladyada.net/learn/arduino/ . The only thing thats bothering me is how to start with my own sketch. :( i really hate math!

Offline Pantera

  • Sr. Member
  • ****
  • Joined: Feb 2011
  • Location: Arizona
  • Posts: 90
  • Karma: +11/-0
Re: 1st Attempt w/ a Microcontroller
« Reply #108 on: July 26, 2012, 11:24:30 AM »
Iam learning a lot just by reading your threads breaktru and craig. Im also reading this http://www.ladyada.net/learn/arduino/ . The only thing thats bothering me is how to start with my own sketch. :( i really hate math!

If I'm not mistaken, math will have some relevance in programming at some point.  :Thinking:

Offline poorboy

  • Sr. Member
  • ****
  • Joined: May 2012
  • Location: Manila, Philippines
  • Posts: 60
  • Karma: +9/-0
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #109 on: July 26, 2012, 11:33:23 AM »
Yes it is i guess i'll be using a calculator once again. :)
« Last Edit: July 26, 2012, 11:36:25 AM by poorboy »

Offline TubeWatts

  • Jr. Member
  • **
  • Joined: Jul 2012
  • Posts: 13
  • Karma: +4/-0
Re: 1st Attempt w/ a Microcontroller
« Reply #110 on: July 26, 2012, 04:09:07 PM »
Thanks Craig tons of useful information.

Alright well i spent a good 6 hours last night trying to figure out this problem and find the right chips to use so check this out and tell me what you guys think about this.

I was looking at this for the circuits. http://breaktru.com/smf/index.php?action=dlattach;topic=244.0;attach=449;image

And i noticed that you only have power going to your D.P. when your actually firing the device so how do you change voltage when your not firing?
Well i thought about it and i found a new DP that might work AD5112 its a I2C 64 tap that im going to use connected to the Arduino instead of using buttons straight off the DP. I know ill still need buttons but changing the voltage by serial seems easier.

Then i still have the problem of the MOSFET firing both chips at once. So what i was also thinking is using a Switch connected to one of Arduino's I/O's that whenever i press a UC or DC it turns the AD5112 on for about 5 sec then shuts it off. But when you fire the device it powers up both. I think i could also use the INHIBIT pin on the 08100 but i dont know how that one works. Or would it be fine to leave the DP on all of the time (current draw?)

Then i noticed at the top of the same schematic it says V1 is 7.4-8.4v. I plan on using all 3.3v boards and equipment so what would i need to change?

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +243/-1
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #111 on: July 26, 2012, 05:00:26 PM »
A pot with 64 taps is probably not going to be good enough resolution.  The pot I use is 256 taps.  I used 128 taps on my first attempt at a mod with a digital pot and still had trouble getting the accuracy I wanted, though 128 taps is probably okay if you're not picky.

My solution to the problems you are discussing is to run the MCU full time and just put it to sleep when it doesn't need to do anything.  All MCUs have a low power sleep mode.  An LDO regulator (for the MCU) with low quiescent current draw can get idle current consumption down quite low, in the tens of micro-amps.  You set up the MCU so it wakes up when a button is pushed.  Then run a timer in code that puts the MCU into sleep mode after a time of inactivity.

Offline TubeWatts

  • Jr. Member
  • **
  • Joined: Jul 2012
  • Posts: 13
  • Karma: +4/-0
Re: 1st Attempt w/ a Microcontroller
« Reply #112 on: July 27, 2012, 06:21:29 PM »
Hmmm.. i thought anything bigger than a 64 would be too many. Im a definite electronics noob!! Which one would you recommend?

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3299
  • Karma: +784/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt w/ a Microcontroller
« Reply #113 on: July 27, 2012, 06:26:22 PM »
Hmmm.. i thought anything bigger than a 64 would be too many. Im a definite electronics noob!! Which one would you recommend?

The more steps the better/finer the adjustment. If you take the number of steps and divide them into the DP total resistance you can figure out how many ohms each step would increment/decrement.

Breaktru Forum  |  eCigarette Forum  |  Modding  |  Topic: 1st Attempt w/ a Microcontroller
 

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