Advertisement
crocos

DIY Kankun Wifi smart-plug-based fog machine.

Dec 12th, 2015
1,030
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.82 KB | None | 0 0
  1. DIY Kankun Wifi smart-plug-based fog machine.
  2.  
  3. The following tale is not advised as a good way to do this. Instead get a ESP8266 and hack AT commands at that. This was done purely to see how breakable these things are.
  4.  
  5. I bought 2 Kankun Small K Smart Plugs at #Kiwicon this year, not knowing a damn thing about them and just planning to pull them to bits anyway, see if I can get an FTDI into them or something.
  6.  
  7. Of course the instructions were in Chinese - which I don't read nor speak - so not a lot of good.
  8.  
  9. What's that? A QR code? Excellent - that led me to a website that I was able to get an iOS link from.
  10.  
  11. Huh. The app is in Chinese too. I see a pattern here. Stuff this, must be a better way.
  12.  
  13. Oh well, off to that repository of knowledge: Google. The Kankun plugs have quite a community behind them - including this G+ community:
  14. https://plus.google.com/u/0/communities/115308608951565782559 with lots of helpful and interesting tidbits.
  15.  
  16.  
  17. OK: First thing. Get the bugger going.
  18.  
  19. "Amcrest Connect" for iOS. Free from the App store. Sorted in under 2 min.
  20. Or apparently this app for Android (Note: I used iOS, so link is untried): http://kk.huafeng.com:8081/android/Smartwifi.apk
  21.  
  22. So great: I've got a basic wifi switch which I can turn my ropelight on and off via a phone app. It's a start I guess.
  23.  
  24. However I know from the G+ community that these things have a SoC running a variation of OpenWRT. It's got a web-server in there. CGI script time!
  25.  
  26. Again, rather than reinventing the wheel, I grabbed the CGI shell script from here: https://dl.dropboxusercontent.com/u/32357/Kankun/Kankun%20Hacking.pdf
  27. which also has instructions for SSH'ing in (un/pw, etc)
  28. I then hacked it to do what I want - in this case, turning on for 10 sec and then turning off.
  29. Note: I've since found much nicer scripts from the KK switch community here:
  30. https://github.com/Mattadlard/kankun-2
  31. https://github.com/mattjoyce/kankun-json
  32.  
  33.  
  34. Sweet! Works a treat. Now the fun stuff - pulling it apart and getting the multimeter out.
  35.  
  36. Spadging and prying at it worked - just popped out, no screws, only clipped in. I unmounted the main board (TEAN E120339 94V-OML1 - general purpose board, used in a few Android Stick processors and cheap tablets, in the configuration in the Kankun it comes with an Atheros wifi chip and an ESMT flash chip). The board was press-mounted by 6 pins - assuming G, VCC and 4 GPIO pins for controlling the two LEDs and the relay, but for my purposes I didn't check as I wasn't going to stuff with that. Instead I hacked at the 240vAC side - it wouldn't be needed as a K plug. I preserved most of it except what I had to de-solder to get at the relay and transformer and remove them, soldering wires in-place to bypass them.
  37.  
  38. To figure out what voltages, I disconnected the SoC board and used a 12VDC feed from a AT PSU I had lying around from days of yore into the 240v side. PUSH BUTTAN GET POWAH! It was enough to figure out what the step-down on the transformer was with the MM.
  39.  
  40. So the first version, the low-power side was all off a LiPo battery & step-up. Then I realised: Why? The relay is disconnected from the 240, I've wrapped and isolated everything. Just connect the 240VAC on the Kankun to the back of the IEC socket. Sorted. No voltage mucking required.
  41.  
  42. I pulled open the fogger until I could see the heater core and pretty simple board inside - 10 min later I knew which two wires I needed to bridge to make the fluid pump trigger - was fairly easy once I'd traced it back to an internal relay triggerable via the radio relay.
  43.  
  44. Wired the relay in "piggy-back" configuration to optionally bypass the existing relay in the fogger then plugged in the SoC board.
  45.  
  46. Moment of truth: the 240 is connected.
  47.  
  48. I wait. No "let the smoke out" smells emit (well, other than the usual for a fogger).
  49.  
  50. The fogger is up to temp.
  51.  
  52. I choose the "On 10s" bookmarked URL from my phone.
  53.  
  54. SUCCESS! A 10 second plume of fog shoots across the room!
  55.  
  56. Now I've got a fog machine I can use from my phone, from a script, from... pretty much anywhere I like. =-)
  57.  
  58.  
  59. Future possibilities:
  60. I'm thinking I'll get a cheap low power PC (maybe a RPi) to act as a control server instead of needing to connect to each Kankun unit individually.
  61. Will take a look into at this scheduling replacement-back-end (to replace the Chinese scheduling server): https://github.com/jdgordon/kankun-magictimer
  62. Also will have a very basic page (or AJAX if I get fancy/bored) so I can control multiple units from the one web-page.
  63.  
  64. It'd actually be pretty easy to re-assemble it back to stock form at this stage, nothing actually destructive has been done to the plug that a gentle dollop of solder or two wouldn't fix. Ditto the fogger. I suspect that the water based fog is a BAD environment for this, so it's very likely I will pull it apart again.
  65.  
  66. Cheers!
  67. crocos / @SliceOTrav
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement