Any embedded engineers/hobbyists here?

blujeenz

Loafing since 2013
LV
42
 
Joined
18/10/15
Posts
2,682
Awards
33
Age
63
Location
Cape Town, South Africa
Long story short, I had this idea to convert a Nasty Bar dispo vape into a wind speed meter.
At the moment Im using an Arduino Mega 2560, a 64x32 i2c display and 3 vape batteries, which seems a bit over the top for one input from the spinning cups.

So I pulled a dispo vape apart to see whats inside.
Turns out, if the dispo has a screen its usually a bunch of leds driven by a micro controller (thats where the embedded part comes in).

The one in the Nasty bar is a PY32F030EK28. LQFP32, according to the datasheet its 30 I/O pins, 8K ram and 64K flash running at 48Mhz, so twice the performance of an Arduino UNO.
Theres a person on Github that made a PY32Duino board using one of these chips, goes by the username of HALFSWEET, Chinese alas, so very little docs in English.
IOsetting on Github has PY32 templates but Im not a coder so no idea what to do with them.

So far Ive managed to erase the chip using a serial-USART cable and the PuyaISP software, chip had read protect enabled (fancy that, a China vape that doesnt want you to spy on their firmware, lol)
hence the erase.

I tried uploading a blink file in Arduino IDE and one of the leds that is connected to the UART Tx flashed indicating traffic, but nothing happened on reset.

So I was wondering what software I would need to use to develop an app on this IC?
Most of the Puya docs are in Chinese and the ones in English are mainly just data sheets.

Heres some pics, bottom of the pcb showing the little 7mmx7mm ic with a reset wire soldered onto pin4 because it wasnt broken out to a pad anywhere.
The 4 soldered pads on CON1 are SWD, but the J-Link debugger I bought was a clone and gets blocked by the official Segger drivers.

py32F030.JPG



Pic of the bottom power board showing the 2x 6pin power mosfets, NP1216, 12V 16A out of something the size of a rice grain.
py32 mosfet.JPG


I thought it would be nice to have a resources page on the forum with whats inside the thrown away vapes, might help others, but it helps nobody if only Im aware of it.


The Vapengin Mars 2 has an obscure ic that I couldnt find any info on and its a smaller LQFP24 5mmx5mm, MC9904BOZG.
But I turned one into a battery charger as it has a LP4073 ic which is 1amp capable.

I changed the 2.4K resistor which limits charging to 500ma to a 1.8k one, now it charges at 900ma, gets a bit hot hence the need for a heatsink.
vapegin charger.JPG

U1 is the MC9904, Q! and Q3 are mosfets, 2209 Wm, once again some obscure chip with no datasheets.
MC9904.JPG
Anyway, it charges a Samsung 3000mah in 1 hour from 3.8v to a max of 4.15v, no more need to buy expensive Nitecores. :)
 
With everything you just said the only part I fully understand is, "Anyway, it charges a Samsung 3000mah in 1 hour from 3.8v to a max of 4.15v, no more need to buy expensive Nitecores. :)"

Nice experimenting
 
Keep us updated. It would be interesting to see what you get done on these chips
 
Keep us updated. It would be interesting to see what you get done on these chips
Nothing exciting for a while.

At the moment Im tracing out all the leds that interest me, about 38 out of the 100 total.
The IC only has 30 input/output pins, so some Chinese magic is happening.
It seems to be only a 2 sided pcb thankfully and I use a dental pick tied to a lead on the DMM to test connections.

So far I have one out of the 6 leds on the power bar at the bottom, so you might have a few more birthdays before Im finished. :-D
 
I only used it as chargers. Don't have the time to do much anymore, but even so nothing close to what you're doing now.
 
Finally came across the tool chain that is used to develop on these ic's. https://github.com/TDLOGY/py32f0-template-project/

I need a Jlink debugger/programmer, alas I bought a cheap clone and the official drivers reject it as a clone.

Next is VS Code, ARM GNU toolchain and Make.

So... pretty much like reading a fault from a Ferrari OBD port that says oxygen sensor on bank 1, but not knowing where it is or how to get to it.

Guess I'll start with the University of Youtube and work my way up from there.
First stop is a fast moving video in Vietnamese with minimal subtitles, this is going to be fun.:-D
 
Last edited:
Finally got most of the IC's pins mapped.
Fortunately the outer ring of 42 leds was fed by 1 transistor which was "gated" by a pin on the ic that I can now use as an input.

So next step would be to create a roadmap in english and then convert that to code which is uploaded to the ic.
Arduino seems to use C++ in the IDE so I spose that would be a logical 1st choice.

py32 mapped.JPG
 
In other news, I got hold of 8 plus dispos and pulled them apart to see what was inside.
Turns out only the Nasty Bar 20000 puffs and BLVK bar 20000 have the PY32F030 ic inside.
Their circuit boards and layout are pretty similar with the only difference being the leds on the front.
 

Attachments

  • nasty & blvk1.jpg
    nasty & blvk1.jpg
    142.7 KB · Views: 2
  • nasty & blvk 2.jpg
    nasty & blvk 2.jpg
    150.7 KB · Views: 3
In other news, I got hold of 8 plus dispos and pulled them apart to see what was inside.
Turns out only the Nasty Bar 20000 puffs and BLVK bar 20000 have the PY32F030 ic inside.
Their circuit boards and layout are pretty similar with the only difference being the leds on the front.
Hi, do you think these pc boards could handle DL. as in an RDA with an 18650. Before your initial post I was thinking of trying one of these pcb's in a mod..
I only rebuild the coils and refilled them for re-use, but that's how far knolledge spans
 
Hi, do you think these pc boards could handle DL. as in an RDA with an 18650. Before your initial post I was thinking of trying one of these pcb's in a mod..
I only rebuild the coils and refilled them for re-use, but that's how far knolledge spans
Probably not, even MTL is a struggle.
I turned a Vapengin Mars 2 into a MTL squonker, but even my thinnest kanthal coil killed the onboard batt in 30min.
They're designed for 1amp, maybe 2 amps max.
Even though the mosfets are rated 12v 16A, its probably just safety margin.

The mesh they seem to use is like spider webs, very delicate.
I've tried to re-cotton a few and have failed.
 
Some more progress on the project, somewhat small, but as Darwin would say, any progress is good progress.

While thinking about how to light up the leds on the front of the Nasty bar, I came across 7 segment displays and cross checked the vape with the datasheet of a 3461AS 4 digit display.

Turns out the vape has a similar naming convection, just different pins obviously.
Just hope the code for leds wind speed calculations doesnt exceed the size of the flash, otherwise I have to go with plan B and use an I2C display from the 1st meter I made.

Nasty 7 segments.jpg

Im just using the top 2 digits for wind speed at the moment and then progress to batt % later on.

These are common cathode leds so in order to light up a 11km/h wind, you drive pin 27 and 28 low, being the common pins, with segments B & C high, ie pins 31 & 30.

Usually each segment needs a current limiting resistor, but strangely theres none on the vape.
Perhaps the current requirement for the tiny smd leds doesnt exceed the max output of the µC.
 
Hi there,

I believe that I might be uniquely qualified to help. I can read Chinese, am a software dev, father was an electronics engineer, have played around with microcontrollers before, and mostly understand what you posted. Let's chat. PM me.
 
Back
Top