codersarepeople Posted December 30, 2016 Share Posted December 30, 2016 Hello all, I know a lot about coding but very little about electricity, so I was hoping to get some feedback on this idea. I have wanted a charge doctor for a while but didn't want to shell out for it. I know it has quite a few features including fast charging, but what I'm solely interested in is charging to 90% automatically instead of hurting the battery by overcharging or forgetting and leaving it charging overnight. For christmas, I received an HS110 TP-Link Smart Plug (about $40). While it has no official API, it seems to have some people who have been hacking on it. This particular node API (https://github.com/plasticrake/hs100-api) allows you to turn on/off the plug and check the power consumption. (Currently, checking consumption is unsupported, but it will hopefully get support in the future). Given that, would I not be able to write a repeating script to determine when the consumption of the plug reaches some level and then turn off the plug? Is this feasible? It would also be nice because you wouldn't need a different connector for each individual EUC. Link to comment Share on other sites More sharing options...
codersarepeople Posted January 3, 2017 Author Share Posted January 3, 2017 Update, even though nobody was asking anyways I got this to work beautifully. With my Smart Plug, if I want to start my EUC charging and go do something else, I simply plug it into my HS110, and run the following node.js script. The EUC will then charge to ~90% (whatever that cutoff current corresponds to) and then the charger will turn off. const Hs100Api = require('./index.js'); const client = new Hs100Api.Client(); const plug = client.getPlug({host: '192.168.113.104'}); const checkTime = 30000; //check current every 30 seconds // turn off when current reaches 1.0 A // got this recommendation from // http://hobby16.neowp.fr/2016/12/01/voltage-threshold-on-charge-doctor/ const cutoffCurrent = 1.0; function startMonitoring() { plug.getConsumption().then(function (e) { var current = parseFloat(e["get_realtime"]["current"]); console.log(current); if(current < cutoffCurrent) { plug.setPowerState(false); return; } setTimeout(startMonitoring, checkTime); }).catch(console.error); } Link to comment Share on other sites More sharing options...
Chris Westland Posted January 3, 2017 Share Posted January 3, 2017 Cute! How did you decide on 1A as the cut-off? For just monitoring, I could see using the Kill A Watt which has been around forever (I have one and they are very useful, but unfortunately not programmable like the Smart-plug) Link to comment Share on other sites More sharing options...
codersarepeople Posted January 3, 2017 Author Share Posted January 3, 2017 Thanks! As I mentioned in a code comment, I used this blog post http://hobby16.neowp.fr/2016/12/01/voltage-threshold-on-charge-doctor/ which says that 1 A corresponds approximately to 90% charge, depending on the battery. The blog post says you can also do it by voltage, but I have an inmotion which has a smaller battery...I still need to do experiments with my KS14C to determine the cutoff current/voltage. I didn't know about the Kill A Watt, as I'm just getting into hardware stuff, but it looks nice at least for monitoring. Link to comment Share on other sites More sharing options...
andress Posted January 3, 2017 Share Posted January 3, 2017 But are you not reading the current at AC 110V? Thats not the current that goes to your unicycle but since you have high voltage euc and low voltage country the difference isnt that big Link to comment Share on other sites More sharing options...
codersarepeople Posted January 5, 2017 Author Share Posted January 5, 2017 Good point but as long as the cutoff is decided empirically then it shouldn't matter Link to comment Share on other sites More sharing options...
captainwells Posted March 8, 2017 Share Posted March 8, 2017 On 1/2/2017 at 11:10 PM, codersarepeople said: I got this to work beautifully. With my Smart Plug, if I want to start my EUC charging and go do something else, I simply plug it into my HS110, and run the following node.js script. The EUC will then charge to ~90% (whatever that cutoff current corresponds to) and then the charger will turn off. Won't the battery be drained if you unplug the charger from the wall but leave it plugged into the EUC (if no reverse voltage protection diode like on Gotway)? Link to comment Share on other sites More sharing options...
Gimlet Posted March 8, 2017 Share Posted March 8, 2017 1 hour ago, captainwells said: Won't the battery be drained if you unplug the charger from the wall but leave it plugged into the EUC (if no reverse voltage protection diode like on Gotway)? That was my first thought too. A lot of charging transformer have no reverse flow protection so if you cut the power to them but leave them connected the secondary coils will stay energised and drain the power back out of the battery. Link to comment Share on other sites More sharing options...
codersarepeople Posted March 8, 2017 Author Share Posted March 8, 2017 Huh I haven't had that issue; not sure why. Could it be that the IoT plug has a reverse voltage protection diode? Tbh I don't know much about electricity/circuits, I'm very software oriented. Link to comment Share on other sites More sharing options...
captainwells Posted March 9, 2017 Share Posted March 9, 2017 13 hours ago, codersarepeople said: Huh I haven't had that issue; not sure why. Maybe you don't have any older Gotways? They added a blocking diode in the current generation. I'm not aware of any other brands that had that problem. 13 hours ago, codersarepeople said: Could it be that the IoT plug has a reverse voltage protection diode? No, that wouldn't matter because the IoT plug is not connected between the charger and the wheel. 13 hours ago, codersarepeople said: Tbh I don't know much about electricity/circuits, I'm very software oriented. Same here. Link to comment Share on other sites More sharing options...
chowski Posted March 9, 2017 Share Posted March 9, 2017 This is a wonderful idea. Will give it a try if I can find a similar product. I used to use a normal analog timer plug to charge 1 or 2 hours after each use, depending on how empty the EUC battery is. But now I've learnt that leaving the EUC plugged in to the charger without mains power will cause the battery to drain as well :-/ I suppose this is only an issue if it is left plugged in for long periods of time. The solution I will be trying is less elegant than yours. I intend to use the Charge Doctor and analog timer together so that it will achieve the same effect (i.e. cut off charging after battery is full, and timer then cuts off main power when time is up) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.