Search This Blog

Saturday, September 30, 2017

The Secret Life of USB Chargers

I am writing this so that I and you can understand what USB charging technology is about.  One thing that's clear is that all phone and vaping charging system are not created equal.  Some work better and/or faster than others.

I want to create one that does as good a job as possible so that my new creation can, as quickly and efficiently as possible, charge you phone.

So first we need to understand the standard USB interface.

First off, the USB 1.0, 2.0 and 3.0 interface has the same pins on the top of the connector.  Typically these are used for the charging process (from here):
You can see more here but the basic idea is that all three standards are compatible from the charging perspective.

Another common issue is why do certain chargers work better than others charging a given device?

Well, for one thing USB communicates information.  In the case of non-charging applications D+ and D- are basically very fast serial lines for sending data around.  

From this site we see that the way a charger sets D+ and D- allows the phone to determine if the charger supports its needs.  This table showing how D+ and D- are set by the charger, taken from the linked site, shows some options:
  • 2.0V/2.0V – low power (500mA)
  • 2.0V/2.7V – Apple iPhone (1000mA/5-watt)
  • 2.7V/2.0V – Apple iPad (2100mA/10-watt)
  • 2.7V/2.7V – 12-watt (2400mA, possibly used by Blackberry)
  • D+/D- shorted together – USB-IF BC 1.2 standard
  • 1.2V/1.2V – Samsung devices
So you can see that your generic USB 1A charger does no good on your iPhone.  In fact your iPhone will generally barf if offered a mere 1A.

So to build a generic device capable of usefully charging most or all phones (and everybody has their own phone favorite) it will be necessary to emit the proper D+ and D- voltages.

The basic wiring diagram looks like this (from here):

Apparently the values of the resistors don't matter except in the contexts of battery drain.  The specific voltages as indicated above matter exactly.  How we get there probably does not.

Note that all the values in the table above are above 3.3V so that we can use Atmel GPIO pins to set them via a resistor network.

If we replace these resistors with potentiometers then a user can set them for their phone if they have a voltmeter.  Typical Atmel's used here don't have digital-to-analog converts (DACs) but we would need that to drive this directly.

Here's some ideas:



In order to get 5V from 18650's we need a regulator such as the Pololu 5V, 2.5A Step-Down Voltage Regulator D24V22F5.


This will generate 5V from series/parallel 18650's.  In addition, it supports an enable feature (EN pin) allowing it to be disabled via a control signal (drawing a 5-10 micro amps - normally 1ma if no EN).

Tuesday, September 19, 2017

A Mod You Can't Regulate or Tax as Such

(I spend far too much time on this vaping shit...  Oh well.  And yes, Virginia, your DIY mod is free and clear - but this is not about that.  I want to see end-user, finished, ready-to-go products sold in stores everywhere that have the same legal properties as home built DIY.  And, yes, sales tax cannot be avoided here.)

As I discussed in the last post I am now making an open source "battery pod" (OSM1 is now "the battery pod.")  The pod will probably support a deans connector, a USB-A female connector and a 510 connector.

This device is not and will not be, in my opinion, a thing which can be regulated as a "tobacco product" nor is it, in my opinion, taxable as a "vaping product."

Why?

Because it's dual use.

A battery pod for charging a cell phone AND 510 flashlight AND it's up to the user as to how they, the user, not me or anyone else who makes one of these, use it.

Here's the idea (lower left):


Or this (my big ugly OSM1 mod)...



Again, you can see the little USB connector on the lower left.

I uploaded a new case in ShopBot format (basically set of CNC commands) under the file names n2*.sbp on the GitHub.  I am redoing the big orange version above to add a USB as well (it's under analytics2.ai).


(Red = V (sign) cut, black = alignment holes, blue = holes, green = cut out with tabs)

(Also looks like I have found at least one enthusiastic user!)

In order to deliver power at 5V 2A via the USB A female I'm going to try out this buck power converter.

I should have this put together and working, i.e., charging my phone, next week.

So the question is "what is my gadget now?"

It's a USB battery pack and has at least two uses: one is to charge my phone, the other to run my R/C helicopter.

Perhaps I can even vape with it... or use it for a 510 flashlight module...???

SIDE NOTE:

Before we go further there's a general problem with doing this in "the real world," e.g. China.

Everybody and their brother uses boost power supplies to create steady voltages for powering things, e.g., mods, robots, etc.  Steady means "continuous" DC voltage.  I get why but it makes no sense for certain applications, e.g., a flash light or vaping, where you can more efficiently switch the power on and off via a square wave (PWM).

So for this design you could tap off the batteries before my Arduino PWM and run the little buck converter to down sample the 8.2V-7.4V from the batteries to 5V @ 2A.  This particular buck supply shouldn't draw any current unless it's in use, i.e., charging a phone.

The four 18650's in the big orange case give me plenty of phone charging power.

Next is to put some weaponized frosting into the mix...

The Chinese can't really do this because they have so much invested in boost-style power supply systems for things (of course they can but will they catch on?)  No one in China pays the kind of taxes we pay to have to vape.

BACK TO THE MAIN IDEA:

Going back to the original post on this we can use the radio to tell our phone if our charging pod is running out of power.

We can take this all the way up to Facebook if we want, i.e., data from by battery pod moved wirelessly up into the internets...





Sunday, September 17, 2017

Thoughts on "Dual Use," Regulation and Vaping

In order to make a power system "dual use" it's necessary to ensure at least two, simple, obvious, legitimate uses a given device.  Similarly, the device must operate as-is under those circumstances.

For example, a USB charger with a micro-USB connector cannot control what a user plugs it into.  So whether I plug it into a vape or phone it does the same job.  Hence it cannot be, as the FDA says, a "tobacco product" or necessarily taxable as a "vaping" product.

As far as I can see this is due to legal "intent" - the intent of the seller (see this example).

The example describes a modern "glass" seller where all the glass is labeled "for tobacco use only."

The question is whether the state can prosecute if the glass item has multiple purposes (use for marijuana or tobacco in the case of the example).  Clearly if the seller intends to sell the item for illegal use (consumption of marijuana for example) then it's a crime.

However, by selling the item labeled "tobacco use only" it's clear the item, if purchased in that context, by itself does not determine how it will be used.

I think just like the USB charger.

If the purchaser uses it for marijuana then that's their problem.

How the user will use an item is the user's business, not the sellers.

So what does this mean?

In practical terms it means that, for example, an 18650 battery, which works well in fancy flash lights I own, and which fits in a variety of vaping devices, is "dual use."

Here's a couple of example of "dual use" power systems from amazon.com:

https://www.amazon.com/Hanperal-18650-Resistant-Battery-Bicycle/dp/B018A96ZVK

https://www.amazon.com/TLIFE-Portable-Charger-Battery-Display/dp/B01N1MZWTZ/ref=sr_1_sc_1?s=hi&ie=UTF8&qid=1505678328&sr=1-1-spell&keywords=18650+battery+pod

Clearly the batteries work in vapes, but still amazon.com sells these units and the batteries (see this).

Quite honestly nothing interesting here.

So if I sell these items in a vape shop, USB charger, 18650 battery, etc. no problem, no tax, no FDA.

Now if I build a 18650 (or 21700 or 20700 or whatever) battery pod that has a variety of connectors (usb, 510, whatever) then clearly the device, specifically if labeled "for charging use only" is not a vaping product or a tobacco product, at least as far as I see it.

It really can't be.

Just like my iPhone is not really a tobacco product (even though the FDA says it is), or is it???

And what about 0 nic e-liquid?

(Really, how about flavoring.  "0 nic" anything is not a tobacco product.)

Is it in fact a "tobacco product" (even though the FDA labels it as such) or just flavoring for cooking like King Arthur's Coconut (ingredients: flavoring, PG)?

So what I imagine is the following being sold anywhere (like amazon, Walmart, etc. because they already are):

1) A line of "flavoring" sold in regular bottles (as below):


2) A line of battery pods with a USB charger output port (USB A female) along with other ports such as 510's, deans connector, etc. (as below):


3) As far as I know I can buy liters of 100mg nicotine (for example) or a liter of synthetic nicotine (say here) or in a plant (say a tomato or pepper) without concern for regulation or taxes.  But if I sell small quantities in some specific context, like to make insecticide, there is no tax or, at least today, regulation.  But somehow in smaller quantities when sold in conjunction with #1 and/or #2 above (or in a vape shop) magically it's "regulated."

Given all this it's very hard to understand what is not actually a product which can be regulated.

Vaping tanks, for example, and perhaps other similar things...

But then I can use them for marijuana or "wax" - so in fact is that no "dual use" as well?

The FDA doesn't regulate Coconut flavoring today.  If I sell it in the vape shop will they?

I suppose somehow only if I intend it for "vaping."

In any case in the short term I plan to build generic, multi-use open source items and publish their plans.

It also seems prudent that devices be configured for their final purpose electronically by their users.  So any battery pod I build won't do anything at all until after you purchase it and configure it to do so with your phone.

And, for example, on the hardware side, adding a female, USB-A output to the giant open source mod so that it will charge my cell phone.

Sunday, September 10, 2017

OSM 1 - Edit 002

Updated the basic code (main.cpp in Touch32u4_1/Touch32u4_1) to support both AVR (7.0) and Arduino IDE (1.8.3) (located here: https://github.com/OpenSourceVaping/OSM1).  Mostly this involved redoing everything in a more organized and professional manner.  Other than the _BV() macro there really isn't much difference other than the AVR compiler seems to initialize the chip differently than the Arduino IDE (mostly what seems like not setting things like ADC registers to known states).

Added support for the newer "Pro Micro" SparkFun-style Atmel 32u4 chips.

You'll need this: https://learn.sparkfun.com/tutorials/pro-micro--fio-v3-hookup-guide/installing-mac--linux

You'll also need this if your Micro Pro has a "Chinese" CH340G/CH341G Serial USB implementation (see https://kig.re/2014/12/31/how-to-use-arduino-nano-mini-pro-with-CH340G-on-mac-osx-yosemite.html).  Depends mostly, I think, on how cheap the Micro Pro is and where it originates from.  Apparently they couldn't get the usual FTDI driver use here in the US.

Also added a simple limiter code to prevent "full power" from hitting the coil.

Next steps will include a new, smaller two battery case using the Pro Micro.

Working on LED flashlight module that, when combined with planned updates, will create a very powerful flashlight.

Sunday, September 3, 2017

OSM 1 - Programming via a Phone

Using standard Arduino's as parts of mod allow a vendor to sell the mod without software, hence it's a brick (or just an Arduino, not

It can't do anything, can't fire a coil, useless.

If the customer downloads software to install on the Arduino then the brick becomes useful.

Perhaps as a flash light.

Perhaps as some kind of wireless IoT sensor.

Perhaps as a mod.

Some ideas (I haven't tried them yet but...):

http://www.instructables.com/id/Program-your-Arduino-with-a-Android-device/

iOS (iPad): https://www.youtube.com/watch?v=z73WehtsE-A

iOS: http://makezine.com/2011/07/18/59-cable-lets-you-connect-iphone-to-arduino-no-jailbreaking/

There are probably other ways too...



OSM 1 - Edit 001

Small change to boost output:


Corresponding software update as of today on OpenSourceVaping at GitHub: https://github.com/OpenSourceVaping/OSM1

I was masking off the compliment of the bits I was interested in.  Now that it's fixed it works great.  Duty cycle goes from 0..~50%.  The extra resistor moves the range returned by the Spectra up a bit.  Still not sure why the Atmel ADC is only seeing about half the range I am interested in...

Here's a Mathematica script to estimate power output:

Manipulate[
 Module[{vrms, duty, watts}, 
  "Coil Ohms=" <> ToString[ohms] <> "\n" <> "Volts=" <> 
   ToString[volts] <> "\n" <> "Duty Cycle = " <> 
   ToString[N[duty = (dc)]] <> "\n"
   <> "Vrms = " <> ToString[vrms = N[volts*Sqrt[duty]]] <> "\n" <>
   
   "Amps = " <> ToString[amps = N[vrms / ohms]] <> "\n" <>
   
   "Watts = " <> ToString[N[watts = vrms*amps]]], {volts, 2*4.2, 
  2*3.7, -.1}, {dc, .001, 1, .001}, {ohms, .12, 2, .01}]

The only tricky calculation is the Vrms relative to a pulse.  Other than that it shouldn't be a problem to convert this to any other language.

Ultimately the code on OSM will dynamically sense the coil ohms and adjust the power output.  This is something the PrimusZ did (unfortunately at higher power the built in batteries didn't really last).  Effectively this provides accurate power levels and "temperature control" because if we periodically (say a few times a second) sample the coil ohms and adjust we keep the same power output regardless of any coil resistance changes.

Using this we get about 200W with a fresh set of batteries and a MELO 300 .17 ohm tank:


The MOSFET should allow us to get up to about 400W.  However, the MELO seems to just barely handle the 200W before the juice gets jumpy.

If anyone is interested I have the Eagle layout for the power sleeper board.

OSM #2 will likely use the Atmel sleep coupled with a wakeup triggered by the SQ-MIN-200.  That way we can shut off the radio and ourselves when "not in use."


Saturday, September 2, 2017

"Open Source" Mod 1

 After some work I have created the basis for my “open source” mod.

Now before I begin I understand that

A) There exists DIY for mods.  Yes, I know.  I am not really interested nor do I really care about the details of those.  I am only really interested in the “intellectual property” and supply chain aspects of how the work I describe can be used to create “dual use” and “open source” on a vast commercial scale.

B) My ideas are dumb.  I accept that and I don’t care what you think in that regard.

C) The mods and technology I describe are not what you like, not “main stream,” etc.  I don’t care.

D) This version is “too big.”  Yes it is.  So is my iPhone 6S.  All I care about is that it serves my purpose.  Change, like winter, will come.

E) Someone’s already published or put out DIY like this.  Again, I don’t care for the reason stated above.

What I am interested is in creating what is effectively “Linux” and “commodity hardware” for vaping.  (If you don’t know what these are you can stop reading now.)

I am currently unaware of anyone attempting this, but if someone is, please let me know.

Everything I do, and hopefully that others contribute, is intended to be fully “open source” and fully sharable.

Everything I post subsequently related to mods and vaping that contain software or hardware designs are published under the MIT Open Source License printed below:

Copyright 2017 Lexigraph, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software, electronic circuit designs and schematics, hardware designs, images and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

The first release I am making under this license is “Open Source Mod #1” (OSM1).
It’s heritage is the PrimusZ and so what’s here is oriented toward manufacturing (no, it’s not manufacturable directly as is but I am keeping that in mind).

I have posted here (http://lwgat.blogspot.com/2017/08/open-source-vaping-overview.html) about my goals.

OSM1 has a couple of things that I think make it interesting: No mechanical buttons, dynamic (while-you-vape) control over power level, mechanical sleep mode.

These may or may not be interesting - I haven’t ever tried the first two.  The third item is so that we can attach wireless radio software and the mod won’t run down while not in use.  It’s not a requirement by any means but it’s interesting.

Various open source software is available for iOS and Android to control this.  I'll post more on this later...

This version uses an Arduino Micro as a controller (here as sold by Adafruit https://www.adafruit.com/product/1086 and https://store.arduino.cc/usa/arduino-micro).

Why not use a DNA-200 or whatever you ask?  Because I want to tinker with the software and the Atmel 32u4 (http://www.atmel.com/Images/Atmel-7766-8-bit-AVR-ATmega16U4-32U4_Datasheet.pdf) used on it (and on the Adafruit Feather Bluefruit LE https://www.adafruit.com/product/2829) which is essentially an open source PrimusZ controller.

(Arduino and Adafruit publish schematics, PCB layouts, etc. under various open source licenses.)

So to this end below are some pictures of the case, the schematics and software.  I just finished getting it working so I have no idea if its reliable or safe.  Use my ideas at your own risk.

EVERYTHING PROVIDED HERE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

If anyone has any interest I will publish more details on OSM1.  I am moving on to OSM2 which will use the Bluefruit LE instead of the Arduino Micro.  This will enable your cellphone to access data in the mod, control the mod, and manipulate its performance.

Here's the schematics:



GitHub source here:  https://github.com/OpenSourceVaping/OSM1

This requires Atmel Studio 7 (Studio 6 should work too).  The code should almost work under the Arduino development environment but I haven't completely gotten there yet.  I started to move code into common.cpp from main.cpp but ran out of time.

I use Atmel professionally so it was the easiest.  You'll need the USB AVR Mark II flasher to update the Micro.

The changes are only really cosmetic - macro's like _BV that don't exist, etc.


Friday, September 1, 2017

"Hate" For Nicotine

A few years ago I wrote this (http://lwgat.blogspot.com/2014/05/usp-nicotine.html) which discusses why and how nicotine is a chemical compound completely unrelated to tobacco.

I find this particular interesting in relation to companies like paypal.com that espouse various policies to protect us from "tobacco products" (for example requiring "pre-approval" to sell "non-cigarette tobacco products").

Clearly this is a bullshit policy based on non-science and nonsense.  A chemical compound, not unique to the tobacco plant (it's found in peppers, tomatoes, potatoes), is hardly "tobacco."  Water (H2O) is found in tobacco too...  Is it a "tobacco product?"

A vape mod without any liquid is clearly not a tobacco product either, yet by FDA design...

Falsely advertised as containing nicotine...

Vapers are not the only target of this sort "discrimination."  Companies that sell CBD oil, for example "Highland Pharms," have been forced out of regular "payment processing" channels as well (because the DEA has classified CBD oil as a "Schedule I" drug; see this).

Interestingly there is a Judicial Watch lawsuit that attempts to access emails from the Obama administration related to the FDA and vaping:

The emails sought by Judicial Watch could shed light on how the Obama FDA arrived at the decision to strictly regulate e-cigarettes, despite its own admission that it had done inadequate research – and, in fact, that the devices helped smokers quit tobacco,” said Judicial Watch President Tom Fitton. “The American people deserve to know if a corrupt government power grab put the public health at risk.

So here we are, pressured by the "illuminated of society," to avoid even knowledge of the forbidden, i.e., vapes.

And to not hear what is said...

This is just like the "banning" by Google and others of, for example, "white nationalist" web sites (see this on the demise of the "Daily Stormer" by Facebook).

We don't like what you do or say so you are banned or denied or excluded or shut down...

Would you even know what else was banned???

Good thing the host of the Daily Stormer isn't black... except, er, wait, aren't there black vapers being denied access to knowledge about the health benefits of vaping through Google's and Facebook's secret banning?  Don't blacks die disproportionately more often from cigarette smoking?  (See this CDC web page.)

Yet important health information is denied...

Don't think this is true, then see this Forbes article on how Google attempted to push Forbes around about it's Google +1 button thing.

So let's instead ban menthol, disproportionately again preferred by blacks... (see this).

Seems like this preference is tied to race.

So isn't Google, Facebook and all the rest racist?

Doing something just because it affects black people is racist.

I wonder...

"Hate" seems to include a lot more than speech in the minds of the great "tech" companies.

So, vaper's, how does it feel to be hated...?

I for one, don't like it.

I vape on and off, I use and don't use nicotine.

In fact sometimes I have an explicit desire not to use nicotine.  But how can I tell when I grab a bottle of juice if even the ones without nicotine say they have it?

Sure seems like someone hates me just for being me.

So again, vaper's, how does it feel to be hated...?

Or perhaps "hate" is the wrong word.

Remember what it's like to have the older kid take you candy?

We used to call that bullying...

Hmmm....