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, 01:28:23 PM
*
gfx* Home | Help | Search | 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 95101 times)

0 Members and 3 Guests are viewing this topic.

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
1st Attempt w/ a Microcontroller
« on: February 10, 2012, 07:34:34 PM »
Just received my micro-controller parts and slapped together a circuit and a program for a mod. Got it all working with a Basic LCD display as a prototype.
I will attempt to use the OLED display shown which is real small and thin which would be perfect for a small box mod.
The controller is also tiny. The photo shows it hooked up to a FTDI breakout board which is need ONLY for programming. Once completed, the FTDI and cable will not be needed.
I am also looking into a MCU chip which is ΒΌ of the price of the controller used ($5). I can program it from the MCU shown in the photo.
I can't believe I pulled it off with only one day of experience with a micro-controller. Anyway it's a nice toy to play with.  :laughing:

« Last Edit: March 07, 2012, 12:35:10 PM by Breaktru Admin »

Offline fsors

  • PV Master
  • *******
  • Joined: Dec 2011
  • Location: USA
  • Posts: 451
  • Karma: +57/-1
Re: 1st Attempt at Microprocessing
« Reply #1 on: February 10, 2012, 08:05:51 PM »
Very Cool Dave! Congrats! I look forward to seeing what you create with it! :applaude: :thumbsup: :rockin smiley:

Offline Dznutz

  • Super Member
  • *****
  • Joined: Dec 2011
  • Location: Colorado
  • Posts: 150
  • Karma: +25/-0
  • Gender: Male
  • Always learning
Re: 1st Attempt at Microprocessing
« Reply #2 on: February 10, 2012, 08:51:02 PM »
hmmm dang you Break now I feel I n eed to play as well.  :laughing2:  but good job looks good so far  :begging:

Offline Dznutz

  • Super Member
  • *****
  • Joined: Dec 2011
  • Location: Colorado
  • Posts: 150
  • Karma: +25/-0
  • Gender: Male
  • Always learning
Re: 1st Attempt at Microprocessing
« Reply #3 on: February 10, 2012, 08:53:58 PM »
Did you use the code from the site I posted or did you write your own?

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt w/ a Microcontroller
« Reply #4 on: February 10, 2012, 09:07:01 PM »
Did you use the code from the site I posted or did you write your own?

No Dz. Got some ideas from Goggling and had to edit/add what I needed. I have a little "C" programming knowledge from years back. Mind you I said a little. Can only do basic stuff in "C". Also know a little "C+" and "C++". Mostly do Visual.Net Basic with my other software. All self taught from books. I was a DUNCE in school. Went to a Vocational/Trade High School
« Last Edit: March 07, 2012, 12:34:53 PM by Breaktru Admin »

Offline Dznutz

  • Super Member
  • *****
  • Joined: Dec 2011
  • Location: Colorado
  • Posts: 150
  • Karma: +25/-0
  • Gender: Male
  • Always learning
Re: 1st Attempt at Microprocessing
« Reply #5 on: February 11, 2012, 01:35:14 AM »
Yeah well me 2  :D but still looks like it is coming together for you  :yes"

Offline fsors

  • PV Master
  • *******
  • Joined: Dec 2011
  • Location: USA
  • Posts: 451
  • Karma: +57/-1
Re: 1st Attempt at Microprocessing
« Reply #6 on: February 11, 2012, 04:35:15 AM »
I do not care wHAT SCHOOL YOU WENT TO YOU ROCK!!!! :rockin smiley: :rockin smiley: :rockin smiley:

Offline Dznutz

  • Super Member
  • *****
  • Joined: Dec 2011
  • Location: Colorado
  • Posts: 150
  • Karma: +25/-0
  • Gender: Male
  • Always learning
Re: 1st Attempt at Microprocessing
« Reply #7 on: February 11, 2012, 12:23:29 PM »
I cant wait to see what you come up with because you make some kick ass mods

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: 1st Attempt at Microprocessing
« Reply #8 on: February 11, 2012, 05:39:37 PM »
Very nice, should be able to come up with something really cool using that.

I'm also programming my project right now, though I'm using assembly.  C is actually easier and faster, but there are still some of us old assembly die hards out there.

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt at Microprocessing
« Reply #9 on: February 11, 2012, 07:27:13 PM »
Very nice, should be able to come up with something really cool using that.

I'm also programming my project right now, though I'm using assembly.  C is actually easier and faster, but there are still some of us old assembly die hards out there.

Wow Craig that's fantastic. Looks real cool. Can't wait to see it in a mod. Man that's a lot of circuitry. Is that the Boost circuit that you've been working on? I guess you'll be using the Li-Po 20c cell with that.

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: 1st Attempt at Microprocessing
« Reply #10 on: February 11, 2012, 10:03:42 PM »
Thanks Dave,

The board sits on top of this 2200mAh 20C LiPo.  The cell tabs bend around and solder to the board on the left next to the USB charging connector. 

Unlike Arduino, programming for the 16 bit PIC I'm using is done though a 5 pin header and a PICkit2 programmer/debugger.  Hard to make out in the photo, but the programming header is right under the red clip.  My photos suck because my camera is on the fritz and I still haven't replaced it.

The extra chips on there are things like small signal mosfets to isolate controls from the MCU and voltage detectors for safety features.  It senses a lot of different stuff for safety features like over-discharge protection, over-current protection and atomizer short-circuit.  It also has charging onboard with a full suite of safety features like battery temperature sensing and transient voltage suppression.  I tried to keep the parts list to a minumum, but the component counts always grow fast when you start adding features, and I have just about every feature I can think of.

I use the boost circuit that I emailed to you in that schematic before.  It can put out 30W.  Let me see if I can get a photo of it at max output.  It's tricky to photograph because my home-made load bank overheats at that output so I can't leave it on too long, though the booster itself can output 30W continuous without getting too hot.  I call it my Powerblock.  Of course my wife calls it the "stop going to bed so late e-cig".

Okay here we go. 

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt at Microprocessing
« Reply #11 on: February 11, 2012, 10:45:59 PM »
Thanks Dave,

The board sits on top of this 2200mAh 20C LiPo.  The cell tabs bend around and solder to the board on the left next to the USB charging connector. 

Unlike Arduino, programming for the 16 bit PIC I'm using is done though a 5 pin header and a PICkit2 programmer/debugger.  Hard to make out in the photo, but the programming header is right under the red clip.  My photos suck because my camera is on the fritz and I still haven't replaced it.

The extra chips on there are things like small signal mosfets to isolate controls from the MCU and voltage detectors for safety features.  It senses a lot of different stuff for safety features like over-discharge protection, over-current protection and atomizer short-circuit.  It also has charging onboard with a full suite of safety features like battery temperature sensing and transient voltage suppression.  I tried to keep the parts list to a minumum, but the component counts always grow fast when you start adding features, and I have just about every feature I can think of.

I use the boost circuit that I emailed to you in that schematic before.  It can put out 30W.  Let me see if I can get a photo of it at max output.  It's tricky to photograph because my home-made load bank overheats at that output so I can't leave it on too long, though the booster itself can output 30W continuous without getting too hot.  I call it my Powerblock.  Of course my wife calls it the "stop going to bed so late e-cig".

Okay here we go. 


That's simply amazing. What more can you ask in a mod. You covered all the bases. Great work indeed.

Offline fsors

  • PV Master
  • *******
  • Joined: Dec 2011
  • Location: USA
  • Posts: 451
  • Karma: +57/-1
Re: 1st Attempt at Microprocessing
« Reply #12 on: February 11, 2012, 11:52:05 PM »
Wow Craig That's Fantastic! :popcorn: :popcorn: :beer-toast:

Offline pnguin

  • Sr. Member
  • ****
  • Joined: Dec 2011
  • Location: St. Louis, MO
  • Posts: 96
  • Karma: +19/-0
Re: 1st Attempt at Microprocessing
« Reply #13 on: February 13, 2012, 04:23:11 AM »
BAM! That's the sound of my jaw hitting the floor. You guys are amazing. :rockin smiley: :thumbsup: :applaude:

Offline Chaos

  • Jr. Member
  • **
  • Joined: Feb 2012
  • Location: MI
  • Posts: 4
  • Karma: +0/-0
Re: 1st Attempt at Microprocessing
« Reply #14 on: February 14, 2012, 02:35:48 AM »
I'm seeing more and more modders getting into microprocessors lately. Evolv's even coming out with a 'Modder's kit' that uses Darwin electronics and a variety of add-on modules. Future's looking really cool!

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: 1st Attempt at Microprocessing
« Reply #15 on: February 20, 2012, 02:52:22 PM »
Hey Dave,

How's it going with this, making any progress?

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt at Microprocessing
« Reply #16 on: February 20, 2012, 04:00:01 PM »
Hey Dave,

How's it going with this, making any progress?

Right now I have it on the bench. Removed the 16x2 and replaced w/ an LCD 8x2 display and calculates Vout, Amps, Resistance and Power. I double checked it w/ my multimeter and it seems very accurate, which surprised the hell out of me. Particularly the ohms readings.

The OLED is on hold, I bought several 27 pin FFC / FPC connectors and all were half the size I needed. Can't find any to fit. I may have to directly solder but I'm holding off from doing that for now.

Also did some more research and this OLED requires 3.3v and 7v-15v which would be a pain. I can tap the 8.4v battery out but have to make another regulator for 3.3v unless I make a voltage divider circuit (not very efficient I believe.)
Not sure if all Micro controllers are like Arduino but I can feed 8.4v to raw in and it will regulate to 5v out at VCC. This takes care of powering devices such as LCD's. Perhaps I can voltage divide it here or at the battery out for 3.3v.
And.......... the code for OLED and SPI ....... this is where I may have some trouble. The LCD's are a piece of cake.

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: 1st Attempt at Microprocessing
« Reply #17 on: February 20, 2012, 04:52:33 PM »
It sounds like that OLED is a bust.  It really is so much easier to use a 16x2 or 8x2 text mode display.  The main objective is to deliver numeric information.  Do we really need anything other than a text mode display to do that?  My feeling is that a graphic mode display is just overkill in this instance, though I've used them before, but for projects that actually require graphics.

The logic for most displays is 2.7 to 5.5V, but the display itself can require much higher voltages to drive the contrast.  Most have a built-in charge pump that covers it for you.  A charge pump is a simplistic capacitive booster that only works for very low currents.  When a COG (chip-on-glass) display has one on-chip, you just need to add a few external capacitors.  Personally, that's a requirment for me in any display.  There's just no reason to go with a display that requires an external charge pump when the vast majority have them built-in.

I get my displays from these guys, have been for a long time.  They have a wide product range and prices are reasonable for onesy twosies.  You can also find their stuff at places like Mouser and Digikey.

Your Arduino module has an on-board regulator which is handy.  Some MCUs have a pretty wide operating range, but you often want to regulate supply voltage to act as a voltage reference for your analog to digital converters.  Some controllers have a built-in voltage reference independant of supply voltage, but that's not a common feature.  I have no idea if that's the case or not for the ATmegas used on the Arduino boards.  You can also use a separate voltage reference chip if you need one.

On my project, I just finished the program last night.  I ended up with about 2500 lines of code (in assembly) so I'm only using about half the available program memory.  I'm pleased about that.  You just never know how much program memory you're going to need until you're done.  I wanted to use a part with minimal space.  You don't want to pay for more than you need.  I still have plenty of room for expansion if need be too.  Pretty happy I'm done with that part.  Programming is not my favorite part of electronics.  Now I'm on to the mechanical.  Need to come up with an enclosure.  I have a guy locally that can do 3D printing with high impact plastic so I'm going to give that a try.  Need to do some mechanical drawings, again not my favorite aspect of electronics.

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt at Microprocessing
« Reply #18 on: February 20, 2012, 05:59:39 PM »
That amazes me that you program in Assembly. Very impressive. My hats off to you. Your amazing Craig.

Yeah this OLED is not worth the trouble, thought I was going to add a graphical bar-graph (battery life) or logo image but text is really all we need. Bar-graphs can be accomplished with characters but being I'm using an 8x2, no room left.

I've seen this tiny display w/ a built in charge-pump reasonably priced:


Bi-directional communication would be nice, tuning into a Wattage or amperage via the controller. Maybe way down the line.

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt at Microprocessing
« Reply #19 on: February 20, 2012, 06:44:34 PM »
I think the size of the 8 x 2 LCD display will fit nicely in a small box. The results are tight. No room for a space between values.
Note: have to look at my math code on rounding the numbers. the power calc is slightly off. Should have been 6.71w. The resistor, amps and voltage are dead on. Compared against my MultiMeter.


Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: 1st Attempt at Microprocessing
« Reply #20 on: February 20, 2012, 09:18:38 PM »
Well, I don't know if programming in assembly is worthy of any compliment, but thanks anyway.  Most people use C.  Assembly is repetitive and tedious but what I like about it is you can write really tight code since you're working at the machine level.  You have absolute control over what's happening in the processor.

I like the looks of that little display from what I can tell in the photo.  Looks like it has a low pin count which is a good sign.  Any more info on it?

I use bi-directional SPI comms on the digital pot to verify its setting before engaging the converter.  I use mono-directional SPI comms on the display.  I haven't had any issue treating the display as a dumb device.  Usually, you can take for granted your display is producing what you tell it to.  Though there's nothing wrong with error checking and of course, you have to have it with a touch screen.  It frees up a pin on the controller without it.  I have a 28 pin controller and I'm using all 28 pins.

I actually did a hack to get around driving the display's reset pin because I don't have a free pin on the MCU for it.  I'm driving my display with only 4 of the MCU's pins.  I use SPI out, SPI clock, register select, and display power.  The display hasn't glitched once since I got the timing nailed down for my reset pin hack.

I ran into the rounding issue as well.  Initially, I was truncating, but found it's kind of weird when your resistance indication shows you should have more current than you do.  So, I added a little quip to round up the least significant digit on resistance and wattage. 

A bar graph for battery level is about the only useful graphic that comes to mind, but I don't think it's a particularly noteworthy feature.  You can see how I handled battery level in the photo, with percentages.  I would have liked to use a voltage reference on my ADC's low side to get higher resolution, but it would increase the part count too much.  So...I just go in jumps of 10% and then go in jumps of 1% when capacity is in the single digits.  It works out since battery voltage starts spreading a lot below 10%.  That's where it gets into the steep part toward the end of the discharge curve.

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum

Offline CapeCAD

  • Jr. Member
  • **
  • Joined: Feb 2012
  • Posts: 3
  • Karma: +8/-0
Re: 1st Attempt at Microprocessing
« Reply #22 on: February 24, 2012, 08:35:37 PM »
You might also be interested in the pc1602K-Y4 http://www.powertip.com.tw/products_2.php?product_id=1171043916&area_idbk=1170985616 16x2 LCD from Powertip. Code is the same as your larger 16x2.
« Last Edit: February 24, 2012, 09:24:33 PM by CapeCAD »

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: 1st Attempt at Microprocessing
« Reply #23 on: February 24, 2012, 09:14:31 PM »
That link didn't work, here's what I got on a search.  That one is 53mm wide, still too big for me.

I'm seriously scrounging for a smaller display.  The smallest one I've found that isn't a segmented LCD (which I'm not interested in) is the one I'm already using (seen in the photo I posted).  It's 41mm wide and is available from Newhaven in both a character mode and a graphic mode, pick your poison.

I'm looking at doing another mod that requires an even smaller display, about 35mm wide instead of 41mm and I'll be damned if I can find one.  I actually saw one on alibaba.com which is that Chinese wholesale site you always end up getting directed to, but they only sell in large quantity.

I can't believe demand is so small for tiny graphic and character FSTN displays that nobody stocks them for sale in small quantities.  I even asked Newhaven and they said no, but they could make one for me, if I want 1000 of them.

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt w/ a Microcontroller
« Reply #24 on: March 07, 2012, 01:33:59 PM »
Been playing around with an Atmel's ATMega328 Processor in 28 pin DIP package. Chip came pre-loaded with the Arduino Optiboot (Uno 16MHz) Bootloader. Installed it on a Programmer breadboard I made which I plan to also use for loading my own bootloader on future chips.
Chip worked fine and loaded simple sketches on it several times. The second day, I loaded a new sketch and received an error: Avrdude: stk500_getsync(); Not in sync; resp=0x00. Did some googling and found several people having similar issues. Seems to be communication problems. Tried every possible means unsuccessfully to get it working.
Finally this morning with changing devices to write to and com ports as I did yesterday, it worked  :banana: . Must be buggy Arduino software because the settings are the original settings.

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #25 on: March 07, 2012, 04:39:04 PM »
Ah, the joys of software bugs with embedded systems.  I can't tell you how many times I've run into issues with something like that.  A lot of times, I think to myself, "there's no way I'm ever going to figure out the problem, " but I haven't been permanently stumped yet.  A person can usually figure out anything given enough time and determination.

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt w/ a Microcontroller
« Reply #26 on: March 07, 2012, 04:59:30 PM »
Ah, the joys of software bugs with embedded systems.  I can't tell you how many times I've run into issues with something like that.  A lot of times, I think to myself, "there's no way I'm ever going to figure out the problem, " but I haven't been permanently stumped yet.  A person can usually figure out anything given enough time and determination.

You got that right Craig. Many times I've been perplexed with a problem from programming to mechanical issues. The best solution... for me is to walk away and come back to it a bit later. That always works.

Got the chip driving the 8 x 2 LCD and the ecig modding circuitry. The calculations and sensor readings are a bit higher than when I had it hooked up with my Arduino Pro Mini. Must be a timing difference between the chip and the Pro Mini. Guess I'll have to tweak it a bit.

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #27 on: March 07, 2012, 05:19:58 PM »
I'm sure you'll get it dialed in. 

I have a similar issue with my latest e-cig mod.  I use an operational amplifier chip to amplify the signal from the current sense resistor.  I do that so I can use a low value current sense resistor.  That minimizes power loss.  The op amp is required to put the signal level in the correct range for the MCU's ADC. 

Every assembly has a different op amp with a different input offset.  That's normal, but I have to tweak the code to compensate for it.  The idea was to make the code generic so it doesn't have to be tweaked for every assembly.  I'm thinking I'll have to add a calibration routine at some point.  Fortunately, I've only used about half my MCU's program memory for a fully functional program which is much less than I initially thought it would take.

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt w/ a Microcontroller
« Reply #28 on: March 07, 2012, 05:41:41 PM »
Can I run this by you Craig?
I'm calculating for Battery life. 8.4 volts is 100% and for the low voltage I went with 6.6 volts and would be 0% battery life.
That's only 1.8 volts between 100% and 0%. I have it all mapped out and working good. Just looks weird looking at something like 20% battery life and still having sufficient vaping time left.

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #29 on: March 07, 2012, 06:47:47 PM »
Not unusual.

Li-Ions have a wierd looking discharge curve.  It starts out steep then goes more flat then falls off quickly.  You get differnt shapes depending on cell chemistry.  For example, the LiPos I typically use are less steep at the front of the curve than other cells I've used.

The best thing to do is to manually plot the discharge curve for the particular cell or cells you are using.  You can make a simple load bank with some high power wire-wound resistors.  Just mount them to a metal plate for additional heat sinking.

Once you've plotted your curve, you can associate voltage levels to state of charge using a table in code.  What I do is take a sample when the cell is NOT under load.  That's how my table is based.  The MCU checks cell voltage when the cell is not under load.  The reason is that load may very which could invalidate your state of charge table.  Your table would only be good for the load under which that data was gathered.  So, checking under no load gives you a reference that is fully independant.

I think it sounds more complicated than it is.  Once you've done one, it's really pretty simple.  Here's the one I'm current'y using.  The first column is the sequence of 30 second discharge intervals.  The second column is voltage with no load.  The third column is the 10 bit ADC reading in hex.  The fourth column is the state of charge in percentage with the associated ADC reading.

Code: [Select]
01  4.17  3C8 - 100 (968)
02  4.16  3C5
03  4.15  3C3
04  4.14  3C1
05  4.13  3BF
06  4.12  3BD
07  4.11  3BB
08  4.10  3B9
09  4.10  3B7 - 90 (951)
10  4.09  3B5
11  4.08  3B3
12  4.07  3B0
13  4.06  3AE
14  4.05  3AC
15  4.04  3AA
16  4.03  3A9
17  4.03  3A7
18  4.02  3A5 - 80 (933)
19  4.01  3A2
20  4.00  3A0
21  3.99  39E
22  3.98  39B
23  3.97  399
24  3.96  397
25  3.95  395
26  3.94  393
27  3.94  392 - 70 (914)
28  3.93  391
29  3.93  390
30  3.92  38E
31  3.91  38C
32  3.91  38A
33  3.90  389
34  3.89  387
35  3.89  386
36  3.88  384 - 60 (900)
37  3.87  383
38  3.87  382
39  3.86  380
40  3.86  37F
41  3.85  37E
42  3.85  37D
43  3.84  37C
44  3.84  37A
45  3.83  379 - 50 (889)
46  3.83  378
47  3.82  377
48  3.82  376
49  3.81  375
50  3.81  374
51  3.80  373
52  3.80  372
53  3.79  371
54  3.79  370 - 40 (880)
55  3.79  370
56  3.78  36F
57  3.78  36E
58  3.78  36E
59  3.78  36D
60  3.77  36C
61  3.77  36B
62  3.76  36A
63  3.76  369 - 30 (873)
64  3.76  368
65  3.75  367
66  3.75  367
67  3.75  366
68  3.75  366
69  3.74  365
70  3.74  364
71  3.74  364
72  3.74  363 - 20 (867)
73  3.73  362
74  3.73  361
75  3.72  360
76  3.72  360
77  3.72  35F
78  3.71  35E
79  3.71  35D
80  3.70  35C
81  3.70  35B
82  3.69  35A - 10 (858)
83  3.69  359 - 9  (857)
84  3.68  358 - 8  (856)
85  3.68  357 - 7  (855)
86  3.68  356 - 6  (854)
87  3.67  355 - 5  (853)
88  3.67  353 - 4  (851)
89  3.66  351 - 3  (849)
90  3.63  34A - 2  (842)
91  3.59  341 - 1  (833)
92  3.54  336
**  3.50  32C - off (812)
93  3.47  326
94  3.39  312
95  3.24  2F0
96  2.70  ---   

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt w/ a Microcontroller
« Reply #30 on: March 07, 2012, 07:44:06 PM »
 :thankyou: Excellent Craig. Plotting the curve is a great method.  :beer-toast: I'll have to give it a go.

What I was doing was calculating as mentioned here:

Battery Life Calculation for two 3.7v Li-ions in series (fully charged 8.4v)?
Two Li-ion batteries are 8.4 volts when it’s fully charged and about 6.6 volts when it is fully discharged. That’s a total of 1.8 volts that represents the full range of charge on the two batteries. To make a good guess at how much charge your battery has left, you can assign a percentage of charge remaining that is directly proportional to the battery voltage.
If the battery voltage is 7.5 volts, how much charge is left? Beginning with 6.6 volts representing no charge or 0% charge available, subtract 6.6 volts from the voltage that you read. So 7.5 – 6.6 = 0.9 volts. Since there are only 1.8 volts above 6.6 volts that represents the full range of charge, we can divide the difference that we just calculated by 1.8 volts to get the percentage of charge remaining. 0.9 volts / 1.8 volts = 0.5 or when expressed as a percentage, multiply by 100 and get 50%.
Here’s the procedure written as a formula that is applicable to 8.4 Volts total Battery reading:

OPEN CIRCUIT BATTERY STATE OF CHARGE CALCULATION

% Charge = SOC

% Charge = ((Measured Battery Voltage – 6.6 volts) / 1.8 volts) x 100

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #31 on: March 07, 2012, 08:18:58 PM »
Well, you can use a linear calculation for battery capacity.  It makes coding much easier since you don't have to implement a table in code and you don't' have to do any discharge testing on your cells.  However, because voltage changes with state of charge in a non-linear fashion, you will see an obvious difference in the time it takes to go from say 90% to 80% compared to say 50% to 40%.  In other words, the accuracy of your meter will suffer obviously by using a linear calculation. 

Setting up a table is much more work, but it's your device and your call.  Personally, I think a table is required.  I prefer to have my battery capacity meter as accurate as possible and I think it's worth the extra effort.  If that's not as important for you, then the much simpler method may be in order.

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt w/ a Microcontroller
« Reply #32 on: March 07, 2012, 08:26:53 PM »
Yes your way is definitely the better way to go. I did notice rapid changes in percentage during my testing.
Still have a lot of work to do with it and only devoting minimum time on it. If I find some time I will try your method. Thanks again..
Tomorrow I have to change out 4 shocks on my truck. Just received 4 shocks in the mail today. So doing it tomorrow is out of the question.

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #33 on: March 07, 2012, 08:50:47 PM »
Yes, it does take quite a bit of time to see through projects like this to the end.  It's quite involved.  I started my current project around six months ago and I'm only now to the point where I can start thinking about an enclosure for it.  Lots of mechanical drawings to do and that's still going to take a while yet.

Hope things go smoothly with your automotive work.  I do my own maintenance on my truck, but the car goes in to the mechanic.  That thing is just way too hard to work on.  Every time I try, I end up with a bunch of busted knuckles.  I think my skin is worth the labor costs.

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt w/ a Microcontroller
« Reply #34 on: March 09, 2012, 10:02:25 PM »
Have it all wired up on 3 breadboards patched together and put together this attached Schematic made with Eagle Software. The Schematic was harder than the actual wiring which I had hand sketched on several separate circuits. WHEW!
Now if I can put the actual circuits in the washer and dryer on HOT setting, I'd have it made.

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #35 on: March 09, 2012, 10:46:59 PM »
Don't know if that's intentional or not, but the schematic is too small to read.

I actually do have mine on three different CAD drawings.  I skip the schematic part in Eagle.  You don't have to start with a schematic to design your PCB in Eagle.  I find it easier to do my electrical drawings in CAD, though it's probably not what most people would do.  You have to manually create the "nets" when using Eagle's board editor without a linked shematic.  It's a pain, but I find Eagle's schematic editor more of a pain.

I watched a re-run of Iron Man the other night and was thinking how much I wish I had that computer to do my assembly for me, so yea, put it in the HOT cycle.

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt w/ a Microcontroller
« Reply #36 on: March 09, 2012, 10:59:27 PM »
I've done only one other schematic with Eagle before and started w/ the PCB first. I just wanted to put all the circuits together because I had bits and pieces of it on separate sheets. I'm sure yours is way more sophisticated than what I have here. I know you build yours from the ground up and I'm mainly using components.
Yes there is a reason the schematic is scaled down. I don't have to tell you why.

Yes Eagle was a pain and the resulting PCB that was created from the schematic is a mess. I won't be using it. Best to make it separate like you said with CAD, you're right it is much easier that way. It took me forever to match devices to use. The LCD is too big. Couldn't find an 8x2 in the library. Yada, Yada, Yada...

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #37 on: March 09, 2012, 11:53:53 PM »
That's what makes Eagle a royal pain.  You can define your own devices and put them in a personal library, but with a linked schematic, you also have to define and link a schematic symbol.  Eagle has a pretty clumsy device editor.  You can define devices for the board editor quickly when you don't have to do that.

The intention with Eagle is to start with a schematic and the suite is designed to be used that way.  In fact, pretty much every PCB design suite is meant to be used that way.  However, it's just so much easier to define your own devices than to hunt for hours on end in the truly overwhelming number of canned devices for one that may or may not fit your needs.  Even when I find the library device for the exact part number I'm using, it's never what I want.  For one, I need the pads about 50% longer because I hand solder everything.

One thing that can be done to make things easier is to find something close, copy it into a personal library, then edit as required.

Another issue I have is with the "ratsnest" you start with when designing your board.  That's the actual terminology, it's called the ratsnest.  It can become unmanageable when you have higher pin counts.  When designing a board without a linked schematic, the ratsnest is built one connection at a time.  I find it much easier, though it's not the way you're supposed to do it.

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt w/ a Microcontroller
« Reply #38 on: March 22, 2012, 06:19:21 PM »
Finally received my PCB boards:


Online geothee

  • Full Member
  • ***
  • Joined: Mar 2010
  • Posts: 35
  • Karma: +2/-1
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #39 on: March 22, 2012, 10:48:42 PM »
Friggin' awsome. Can't wait to see it in action mon

Offline banshee

  • Full Member
  • ***
  • Joined: Jan 2012
  • Posts: 25
  • Karma: +8/-0
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #40 on: March 23, 2012, 09:51:18 AM »
I love the whole concept of a micro-controller mod breaktru. Nice going.
and I love what Craig has done. Excellent guys..  :begging:

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt w/ a Microcontroller
« Reply #41 on: March 23, 2012, 10:09:49 AM »
Thanks guys. I'm just a beginner when it comes to micro-controllers/processors. Craig is the man. He is a real Tech. Real professional designer.

Offline rrtwister

  • Full Member
  • ***
  • Joined: May 2010
  • Location: Portland, Or
  • Posts: 37
  • Karma: +8/-0
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #42 on: March 24, 2012, 10:39:53 PM »
To read an output voltage from the 08100w with a micro-controller such as the Arduino, can I just send it to any analog input pin?

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt w/ a Microcontroller
« Reply #43 on: March 25, 2012, 08:24:09 AM »
To read an output voltage from the 08100w with a micro-controller such as the Arduino, can I just send it to any analog input pin?

Not to get into too much detail:
No! Sending in voltage above VCC to an analog pin will damage your MCU. Make a voltage divider to bring down the voltage to less than VCC (5v or 3.3v)
                  R1             R2
   GND ----/\/\/\----*----/\/\/\---- Vin (6.0v or Max reg. output voltage)
                            |
                            | Vout
                            |
                            v
                   ANALOG PIN

I use R1=15k and R2=15k.

You will use the AnalogRead function. It reads the value from the specified analog pin. AnalogRead will map input voltages between 0 and 6.0 volts into integer values between 0 and 1023. (I used 6.0v as my max reg voltage)

  value = analogRead(pin);

  vout = (value * 6.0) / 1024.0;
  vin = vout / (R2/(R1+R2));
« Last Edit: March 25, 2012, 01:30:05 PM by Breaktru Admin »

Offline Madmanmacguyver

  • Full Member
  • ***
  • Joined: Mar 2012
  • Location: Dallas Texas
  • Posts: 38
  • Karma: +12/-0
Re: 1st Attempt w/ a Microcontroller
« Reply #44 on: March 30, 2012, 04:21:04 PM »
so Breaktru hows the microcontroller thing going...kinda curios myself as I have a project myself involving one and some Nixie tubes...mine won't be to portable as Nixies require a High voltage power supply which makes it kindof bulky and a power hog...

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt w/ a Microcontroller
« Reply #45 on: March 30, 2012, 04:53:21 PM »
Got about a half a dozen more wires to solder to the PCB. Waiting on several different boxes to put it in. Can't find anything nice. I did get a Hammond this week that was pretty cool but if only it was a bit deeper. I spent days looking through literally thousands of models.

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #46 on: March 30, 2012, 08:48:54 PM »
I hear that.  Enclosures are always the hardest part for me.

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt w/ a Microcontroller
« Reply #47 on: March 30, 2012, 08:54:46 PM »
I know what will probably happen... It'll end up in some crappy box

Online Breaktru

  • Administrator
  • PV Master
  • *****
  • Joined: Nov 2008
  • Location: NY
  • Posts: 3344
  • Karma: +792/-4
  • Gender: Male
  • PLEASE participate in this forum
Re: 1st Attempt w/ a Microcontroller
« Reply #48 on: April 01, 2012, 04:41:26 PM »
I completed wiring up my Micro-Controller mod on a custom made PCB I designed.
When I had it on 3 separate breadboards it worked great. Didn't have the charging circuit or the internal power supply for powering the MCU.

Right now I have it all wired up w/ charging circuit as shown at: http://breaktru.com/smf/index.php/topic,543.0.html and the internal power supply.
The vaping is powered by an OKR-T/6 and is putting out 3.6v to 6.0v. The internal power supply is outputting 5v for VCC.
The Charging circuit is working great so far. Running (vaping) w/ batteries in Series and charging in Parallel.
Being it's the first test run w/ charging I cut a piece of my Welding Blanket (fire blanket) and covered the batteries with it and a Halon Auto Fire Extinguisher placed over. I know.. I'm paranoid after the near explosion the other day w/ an Ultrafire.
I also didn't want to jeopardize my laptop USB ports if something went wrong so I am using a 1amp output wall adapter to power the USB charger:



Still looking for a good box to house it all. Got 5 yesterday but I'm not excited about them. Waiting on another.

Offline CraigHB

  • PV Master
  • *******
  • Joined: Nov 2011
  • Location: Reno, Nevada
  • Posts: 2023
  • Karma: +246/-1
  • Gender: Male
Re: 1st Attempt w/ a Microcontroller
« Reply #49 on: April 01, 2012, 09:33:50 PM »
Being it's the first test run w/ charging I cut a piece of my Welding Blanket (fire blanket) and covered the batteries with it and a Halon Auto Fire Extinguisher placed over. I know.. I'm paranoid after the near explosion the other day w/ an Ultrafire.

Hehe, that's pretty paranoid, but I've never actually had a Li-Ion burst into flames on me, well not unintentionally.

I always use a wall wart.  I'm not willing to make my PC an expensive power supply.

Anyway, good to hear it's all coming together.  Should be interesting.

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!