-
• #27
Wow, it's surprising about the piezo - my understanding was that they didn't actually draw much power at a voltage... that they were more like capacitors where the change of voltage took power.
Maybe something is shorted on your device? I guess there may also be a resonant frequency where the piezo actually makes a decent amount of noise.
So just to be clear, you actually bought https://www.aliexpress.com/item/1005005726070115.html and that's what is in the picture above? Looks like a total bargain.
-
• #28
So just to be clear, you actually bought https://www.aliexpress.com/item/1005005726070115.html and that's what is in the picture above?
Yes, exactly. Getting two with untracked shipping would be $9.75 total including VAT and shipping for me. I actually got three with tracked shipping so it was $5.6 a piece :-)
Yes 32mA looks like short, maybe the battery cannot give much more than that, not sure what the wiring can be to work like that.
-
• #29
not sure what the wiring can be to work like that
it is GND -> some transistor/FET marked Y2, switched by pin D14 -> one side of piezo -> 12ohm piezo/speaker -> 10ohm resistor -> VCC
so 22 ohm in total between VCC and GND when D14 is low (more precisely 22 ohm between VCC and top of the FET)
That is a bit strange because I=U/R = 3/22 ~= 136mA but I guess that battery cannot give more so the rest is internal resistance of battery
EDIT: attached picture - red are both sides of the speaker, R is 10 ohm resistor, V is VCC, G is GND
1 Attachment
-
• #30
So it is not piezo but something called magnetic buzzer, matches this picture and description https://www.aliexpress.com/item/1649570962.html
EDIT: or this https://www.quartz1.com/price/techdata/VS5030B.pdf
-
• #31
I tried to replace this magnetic buzzer by piezo but it does not work, it makes no sound, found explanation here https://www.murata.com/en-eu/support/faqs/sound/sounder/char/sch0007 - "You cannot produce a sound from a piezoelectric sounder by simply replacing an electromagnetic buzzer with a piezoelectric sounder in this circuit."
I also found another buzzer from similar cheap tracker tag and that one is 15ohm and is much louder. sadly it is also quite a bit bigger so won't fit inside. It looks like this one https://www.aliexpress.com/i/1005005047243506.html
Anyway the one on the board posted by parasquid is still not that bad, the other boards have the 10 ohm resistor replaced by higher values and those are more quiet. Also I don't see diode there.
As for the SPI flash pinout on the cheap NFCBoxLink ones I got last time - it really matches USON-8 package - VCC,GND,/WP,/HOLD pins are all in correct place and VCC, GND are connected. It is same SPI flash package as used on Raspberry Pico board - found 2MB chips here https://www.aliexpress.com/item/1005004379141351.html - will try to kill at least one NFCBoxLink board by adding it via reflowing by hot air. It is not that much useful there, I know, but still :-)
-
• #32
found 2MB chips here https://www.aliexpress.com/item/1005004379141351.html - will try to kill at least one NFCBoxLink board by adding it via reflowing by hot air. It is not that much useful there, I know, but still :-)
So I got couple of those W25Q16JVUXIQ USON-8 2x3mm flash chips from that aliexpress shop and tried one with this Amiibo board and it works :-)
>var sf=new SPI(); // SPI flash =SPI: { } >var FCS=D19;FCS.write(1); =undefined >sf.setup({sck:D12,mosi:D11,miso:D18,mode:3}); =undefined >sf.send([0xab],FCS); =new Uint8Array(1) >print(sf.send([0x9f,0,0,0],FCS)) new Uint8Array([255, 239, 64, 21]) =undefined
Got flash ID from the chip - 239, 64, 21 = 2MB winbond flash :-)
Photos here https://ibb.co/album/yhhkwZ, left = modified board with W25Q16JVUXIQ added (I also previously removed buzzer, was trying to add piezo or something else), right another original board with no modification
Still, it is probably not that much useful, but I simply wanted to try :-)
It was first test of hot air gun I got recently https://www.aliexpress.com/item/4000525251154.html
Never did this before. It worked 3rd time. First it looked OK but I got no response over SPI, on 2nd try it got worse and moved in wrong way, third time I added more flux realigned and it works now :-) I did not add pull up resistors to WP and HOLD but seems to work without it (did not try writing yet).EDIT: and BTW the shop lowered the price even more https://www.aliexpress.com/item/1005005571264919.html I see it as US $2.70 including VAT. Ordered another two pieces with $2.77 aliexpress saver shipping so it was total US $8.17 including shipping for two = about $4 for one :-) let's see if I really get it with this untracked shipping.
-
• #33
Nice work! I bought some in April and got fake ones..... Will check for a dealer that ships to Germany.
-
• #34
and got fake ones.
Oh, bad luck. All I got were good nrf52832, no issues at all.
First I ordered
https://www.aliexpress.com/item/1005005845252482.html , https://www.aliexpress.com/item/1005005829460356.html and
https://www.aliexpress.com/item/1005005820599424.html one was different board than the other two, these were relatively expensive - about $9 including shipping. Then I got few more of this third variant with empty SPI flash pads - current link in previous post, these were cheaper.Now I have 3 flashed with Espruino, each board different variant, and also got couple of spare unused ones of the third variant - could send you some to Germany if you don't find good seller. Only one variant has buzzer that is actually audible from a distance, the rest is very quiet so the buzzer is mostly worthless - maybe good as a feedback that you clicked the button but the microswitch click is good enough for that too. Or maybe as a feedback that NFC communication started but when using the phone it already vibrates for that.
-
• #36
I did not add pull up resistors to WP and HOLD but seems to work without it (did not try writing yet).
Just a followup - I found out that I bought W25Q16JVUXIQ where the last Q means it is permanently in Quad SPI mode after reset and this mode cannot be cleared. However normal SPI commands still work in this mode so it is OK, the only difference is that /WP and /HOLD pins are data pins and its classic functionality is disabled which is actually good for me as those pins are floating (in theory it is even possible to wire them from unpopulated pull up resistor pads to some nrf pins to have quad mode working but it is not worth it)
So everything should work as floating WP or HOLD would not interfere with writes however I could not make writes work with software SPI! All other SPI commands worked - getting ids , putting in and out of sleep, reading unique 64bit id, reading all 3 status registers, write enable (0x6) (the WE bit in status register is set), even the writing or erase command (0x2, 0x20) would clear the WE bit in status register but the data did not change. Checked various flash protection bits and everything was disabled as it should be by default according to datasheet but still nothing.
So I built 2MB SPI flash storage area into the firmware by adding
'NFC': { 'pin_a':'D9', 'pin_b':'D10' }, 'SPIFLASH' : { 'pin_cs' : 'D19', 'pin_sck' : 'D12', 'pin_mosi' : 'D11', 'pin_miso' : 'D18', 'size' : 2048*1024, # 2MB 'memmap_base' : 0x60000000, }
and the espruino code did not work too
>var f=require("Flash") =function () { [native code] } >f.getFree() =[ { addr: 364544, length: 4096 }, { addr: 1610612736, length: 2097152 } ] >f.read(8,0x60000000) =new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255]) >f.write([1,2,3,4,5,6,7,8],0x60000000) FW addr 0x00000000 fail Status 0 =undefined >f.write([1,2,3,4,5,6,7,8],0x60010000) FW addr 0x00010000 fail Status 0 =undefined >f.write([1,2,3,4,5,6,7,8],0x60100000) FW addr 0x00100000 fail Status 0 =undefined >f.read(8,0x60000000) =new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255])
So I enabled hardware SPI in the build and tried that
var sf=SPI1;//new SPI(); var FCS=D19;FCS.write(1); sf.setup({sck:D12,mosi:D11,miso:D18,baud:80000000,mode:3});
and suddenly everything worked. The very same lines now started to work, I even saw for the first time the busy bit set in status register when erasing
>sf.send([0x6],FCS);sf.send([0x20,0,0,0],FCS);sf.send([0x5,0,0,0],FCS) =new Uint8Array([255, 3, 3, 3]) >sf.send([0x5,0,0,0,0,0,0,0,0,0,0,0],FCS) =new Uint8Array([255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) >sf.send([0x6],FCS);sf.send([0x2,0,0,0,1,2,3,4,5,6,7,8,9,10],FCS);sf.send([0x5,0,0,0],FCS) =new Uint8Array([255, 0, 0, 0]) >sf.send([0x3,0,0,0,0,0,0,0,0,0,0,0],FCS) =new Uint8Array([0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8])
And what is interesting is that since then also the software serial and the builtin espruino flash storage started to work - I could erase again and write different data and it all works now.
So not sure what really happened. Did not try removing battery yet if it breaks again, will try.
-
• #37
Just FYI this Amiibo is probably quite popular so there are several additional models.
There is still this basic keychain type for ~ $4USD see e.g. https://www.aliexpress.com/item/1005006521163109.html however now some sellers are part of the "choice delivery" offer with free returns and free shipping over 10 USD so when getting more they are really cheap now.
There is $8 model with li-pol battery inside and usb-c charging - I just received one (from same seller, see previous link) - see https://ibb.co/album/CKkBWt it has same quiet buzzer and has four leds, two blink when you push button, two light up when it is put on charger so not sure how many gpios are connected to them - 2 or 4.
There are also some $15-$20 models with display see e.g. https://www.aliexpress.com/item/1005006770284160.html some have li-po battery inside, some have only CR2032 so check the listing details. I did not get that one yet.
They are all nrf52832 based. The one with display sometimes use name "pixl" or "pixl.js" since it was perhaps inspired by Espruino pixl.js and uses same or similar display - google "amiibo pixl.js" for details or check this https://github.com/solosky/pixl.js/ looks like there are several revisions of the hardware one having OLED screen.
-
• #38
Only one variant has buzzer that is actually audible from a distance
Do you know if there's a reliable way to get that one with louder buzzer? What kind of sounds can it produce? Could I connect it to my Bangle to have it act as a small speaker?
-
• #39
Thanks! Interesting about the Pixl.js one! I can understand the name Pixl but adding '.js' on the end is really strange...
I just hope I don't end up with people buying the Espruino Pixl.js and getting fed up it doesn't do the loot box things out of the box
-
• #40
Do you know if there's a reliable way to get that one with louder buzzer?
No, I don't even know which seller it was and even then the stock could change. But I bought 10 pieces of bigger "7525 Passive" one from https://www.aliexpress.com/item/32864653388.html and desoldered the small one and wanted to solder some thin wires to it put it to some space inside (it does not fit on the PCB and the case is too thin there anyway), I verified it fits in one place in the center where the thin hole is but did not actually finish it. With the slightly bigger one with rechargeable battery it could be done too there is even more space inside but maybe desoldering the buzzer on that one may be more complicated without hot air. However the rechargeable battery could last longer with the buzzer than CR2032.
-
• #41
So I tested the $8 one with rechargeable battery and I have mixed feelings about it.
First I measured current drawn from battery with original firmware when it is sleeping and got ~ 6uA. This is not bad at all if my meter shows correct value.
Then I flashed Espruino build I already had for those small $4 keychains and it worked while debugger was attached over SWD but when I disconnected debugger it went into reboot cycle blinking the LED. After some head scratching I figured out it is missing support for internal nrf52 DC/DC! After building another firmware with this disabled the reboot loops stopped. Interesting that it worked while debugger was attached. Probably the DC/DC has different modes based on current and with low current it rebooted.
Then I tried to figure out LEDs etc. It is still the same, there is one (RED) led on pin D20 however this one is not visible from outside at all! It is next to 32MHz crystal on the back of the device. Then the LED2 is D17 and this is visible under the blue button. It is actually pair of two LEDs from both sides. Then there is another pair but it does not go to nrf52 at all, it shows charging state and goes off when the charger chip stops charging full battery. No other extra pin is used, even no analog pin reads battery voltage so you don't know how much is left. They probably still kept original CR2032 design. Maybe checking
E.getAnalogVRef()
going below 3.3V could signal empty battery.Then I tried buzzer and this is the worst bit in a way. When trying previous code
function freq(f){if(f === 0)D14.read();else analogWrite(D14,0.96,{freq:f});}
it immediately reboots when trying any sound!Perhaps mix of DC/DC disabled with weak voltage regulator and/or missing/weak capacitors cannot cope with the current drawn by magnetic buzzer even with duty cycle of 0.96 (i.e. only 4/100 on, 96/100 off)! I found out it does not reboot immediately when I set it >=0.973 however it still reboots when BLE radio draws more on connect/disconnect. 0.98 seems to be safe enough but the sound is not very loud. However it is similar to most of the other keychains (so quite poor). Unfortunately my guess that li-po battery could give more current and louder sound was wrong.
So it is still quite capable device for the money when only button/led/BLE/NFC is needed but the design could be better. I'll see how long the battery lasts.
Too bad there is no spare GPIO going to any trace to reuse. However since the analog pins on the nrf52 are next to each other I can perhaps solder some voltage divider from battery to the middle of them and won't damage anything else. Then I can pick the best one to read the value. They are tiny but 4 of them is big enough area I guess.
-
• #42
So now I got also the "pixl" one, size comparison is here https://ibb.co/album/MZPf8P
It has Li-Po battery and even 2MB SPI flash which shares SPI with the ST7567 LCD
The pinout described here
https://github.com/solosky/pixl.js/blob/main/fw/application/src/boards/board_lcd.h
matches the hardware.It is relatively expensive compared to other ones, got one for 14 USD (which is even more than the Magic 3 watch) however it has NFC and passive B/W display so may have other use cases. And today when I searched it on aliexpress again I got the "pick 3 items" ChoiceDay deal and it was only for $8 so got few more. And BTW in same deal the simple keychain amiibo is for $2.69 including VAT/shipping. So you may try searching aliexpress for "pixl" or "amiibo", maybe you'll get the deal too.
There is no buzzer and the rocker switch on the top acts as 3 buttons (uses 3 gpios). Three pads on PCB near the NRF52382 corner are RST,SWDCLK,SWDIO so the RST could be repurposed for something.
There is blue LED and when charging it also lights up red led which turns off when charging is finished.Unlike with the bigger one without display here the battery voltage is connected to analog pin so you can get the voltage. Also this one has the optional inductor so internal DC/DC can be enabled and works fine.
-
• #43
Maybe checking E.getAnalogVRef() going below 3.3V could signal empty battery.
Since that time I had simple interval checking voltage every second and toggling LED if it is below 3.27V and today I noticed it started blinking and voltage is 3.18V now. So it lasted about 2 months on single charge just advertising and sitting on table (Date() says February 25 1970), that is very similar to smartwatches like Magic3. And even if I can't measure battery voltage directly the getAnalogVRef can be used to detect low battery when it gets below 3.3V.
-
• #44
@fanoush Seems like you got pretty far with the pixl version. I've just received one with the LCD and I'd like to pursue getting the screen going. Have you made a board file for it you can share? I've never used NFC before so I'm not sure how to enable it (other than making sure D9/D10 are NOT built as regular GPIOs).
-
• #45
I have it running now: display, buttons, led, backlight. But spi flash is not behaving (I have had this issue with a few other SPI flashes on watches). Builds OK, Storage seems to accept writes, but when you go to read, the files soon disappear. I've tried with build DEFINE for explicit sleep/wake, doesn't help.
-
• #46
Nice, I only had basic board file from other amiibos with no display or SPI flash storage defined, for testing display I used https://www.espruino.com/ST7565 . Did you enable native pixl.js display driver (possibly including bootloader support)? BTW, one pixl board I got works but has high power draw no matter what I do and dies in few days, others are fine. Visually they look identical, no visible shorts or something. Will try enabling spi storage files and test writing.
For NFC nothing special is needed, just enabling in board file https://github.com/espruino/Espruino/blob/master/boards/PIXLJS.py#L35, easiest test is calling http://www.espruino.com/Reference#l_NRF_nfcURL and phone will find it and open browser
-
• #47
Cute little thing...
1 Attachment
Ah! No wonder I thought the battery went flat so fast. Thanks for the piezo hint (I tried playing a beep when the button was pressed but I reset the pin after the button is depressed).