Categories
Maker Taiwan

Make the most of solar power

It didn’t take the arrival of a horrendous electricity bill to the Taipei Hackerspace to start thinking about reducing my electricity footprint. In the last half a year there were two solar power projects on Kickstarter that I signed up for: the Solar Pocket Factory (SPF), and the Foldable USB Solar Cell (FUSC). Generally there’s a lot of sunshine here in Taiwan (when we don’t have a typhoon), and even if I cannot power my laptops from it, could certainly try to power my smartphone…

It turned out that I needed both Kickstarter projects to make one good device.

The Foldable USB Solar Cell looks awesome and not bad at 7W and 5W (the two pieces I have). The voltage output doesn’t seem to be very stable, or has strange behaviour as it doesn’t charge my attached phone when there’s too much direct sunshine. Thus I cannot really use this directly with devices.

The tiny solar panels in the Solar Pocket Factory are very fragile and I couldn’t really make them into an actual working cell yet. On the other hand, it came with a 2000mAh battery and a circuit called Li-Po Rider Pro, by Seeed Studio. This circuit us solar cell or USB input to charge a battery , plus have a good output circuit to charge a USB device either from the battery when there’s no sunshine or from the input when there is.

Putting together the Foldable USB Solar Cell and the Li-Po Rider Pro, we have something that kicks arse indeed! Since I only have one circuit and Seeed doesn’t seem to sell it separately, I thought I could improve on things if I use both solar

USB adapter for parallel panels

The easiest idea I could come up with is creating a USB adapter to connect the panels in parallel (thus practically summing them up as current sources).

USB connector wiring, from the Tech Support Guy forums
USB connector wiring, from the Tech Support Guy forums

This plan needs two male USB A connectors (the “cable” type on the picture) to plug into the panels, and one female USB A (the “device” type) to provide the single output. Then female VCC pin is wired to both male VCC pins, and the GND pin similarly to the GND pins. The D-/D+ pins are not in use in this case.

Parts on the working desk
Part for the solar panel connector. One female and two male

The connectors came in as $0.40 each, the wire I don’t remember but probably a few cents. I fortunately had both black and red to use with the GND and VCC. Things are better colour coded.

Soldering together the middle two pins, and hook the ones on the side with wires (here the black wire for the Ground line)
Soldering together the middle two pins, and hook the ones on the side with wires (here the black wire for the Ground line)

First the middle two pins of a male and a female connector is soldered together, just to provide mechanical support. The end of the cable is stripped and hooked around the touching pins (the GND pins on this picture). The two pins + wire is then soldered together, with enough solder to stay, but not that much that the other pins could touch.

Finished soldering, a bit too much solder, but at least it holds
Finished soldering, a bit too much solder, but at least it holds

Did the same thing for the VCC pins + red wire. Finally added some more solder to the central pins. It was pretty stable like this, though I guess it would be better to have some sort of external housing for it or another way to increase the mechanical rigidity of the connection.

The extension cord to the extra male connector
The extension cord to the extra male connector

Finally the other connector is soldered, making sure that the right pins are connected (the same as the other male USB). The connectors are then wrapped in a bit of duck tape for some rough insulation. These parts will be outside, both in sun and rain, nothing much can break, but better not test whether I’m right about this particular point…

Cover and plug into the secondary solar panel
Cover and plug into the secondary solar panel

Plugged into the secondary (5W) solar panel, and into the primary (7W) one as well. Duck taped everything down onto the roof well enough that they are not blown away too easily (though I’d better check on them in a bit, the wind is howling just now outside).

Primary solar panel with the adaptors
Primary solar panel with the adaptors

As an aside, the duck tape doesn’t seem to like the sunshine. It sticks its sticky parts on everything, that part doesn’t seem to spell fun for the future.

Ready to charge

When everything is connected, the panels will get pretty good sunshine for the bigger part of the day. I don’t think they reach max capacity, because the angle is never ideal, but from the practical point of view, they get enough sunshine to max out the attached 2000mAh battery between device charges.

Hold the panels down, plenty on sunshine (at least this afternoon
Hold the panels down, plenty on sunshine (at least this afternoon

The Li-Po Rider Pro circuit is under the roof, so it doesn’t get any rain (at least I hope!), and has a little ledge to charge a phone safely as well.

solar8
Charging circuit and filling up my phone

Since all the devices were pretty much full when I checked in the Hackerspace after I finished this setup, the test whether combination of the two solar panels does indeed increase the power is not foolproof. Otherwise I would have charged a device from a low battery level to a bit higher with one panel, then later switch to two panels and see the different slope of the batter charge versus time. Normally at high charge levels (90%+) the slope is varied by the charging circuit (to preserve the lithium battery’s life), thus that level is not really good to test the difference between the single / dual panel situations.

One thing does suggest, though that the plan worked. Before this modification, charging a phone discharged the Li-Po Rider Pro’s own battery (there’s a touch switch on the circuit to get an approximate charge level, indicated by the lighting up of 0 to 4 LEDs on an LED bar), even in full sunshine. This time it seems that both the phone and the storage battery is charged up, indicating larger incoming power than before. I will check it again next time, though (the Nexus 7 tablet we have will be great for that, it has much larger internal battery than my HTC Butterfly phone)

Possible improvements

There are a few things I could improve on the setup, focusing on usability.

I hope to get a longer USB cable to reach from the roof to inside the Hackerspace, and set up a charging station within the room. This way people don’t have to keep their devices out of reach while charging, and there’s no chance of being ruined by a sudden rain.

I hope to get a larger capacity Li-Po battery. 5-10.000mAh could be good, then it would likely have enough power all the time to keep charging people’s devices, and not standing idle being full when not charging something, while easily emptied by a single device.

The roof also has plenty of more space, so getting a bunch of other panels, combined with the first two upgrades, would make it really beneficial. These foldable panels would be better portable, and keeping them in one place feels a sort of waste.

Ultimately it would be awesome if I could have a purely solar-powered phone. Because it would mean some money saved, but also, and mostly, because I can.

Categories
Programming

Automating the hell out of it

Even before the 4-Hour Work Week made me more serious about this, I really enjoyed automating tasks, that benefit from not needing to remember to do, or would be troublesome to do otherwise. This frees up a lot of time, keeps a bunch of problems away, and it is actually quite fun when the information comes to me instead me going to it.

Now I have automated checking my bank account and credit card balance, updating dynamic IP of server, ebook sales numbers, and network clock synchronizing. There are some general ideas that I summarize, then give an intro to all of those scripts.

Banking script

Tools

Most of my scripts are written in bash, because it’s relatively straightforward to hammer out simple stuff, and it is surprisingly simple to do a lot of things once I have thought enough about a problem. The Advanced Bash-Scripting Guide is always on my reading list, but I usually get to check only the parts that are relevant to the given problem. You can get quite far with a few simple constructs.

The most common parts I seem to come across:

  • if-then-else constructs: if [ -f ‘directory ‘]; then echo “Found!”; fi
  • for loops: for f in *.png; do optipng $f; done
  • loading the results of a command into a variable: VAR=$(command)

For most other problems with a little keyword-fu there’s always an answer on StackOverflow or on the web.

Another group of scripts uses Python, when a bit more data-manipulation is needed, like web scraping or JSON parsing. Actually, all of the scripts could be rewritten in Python for consistency, and it would probably be be simpler too, which is something for the future.

As a general tip, most of these scripts need tweaking, and all of them are sort of alpha-beta quality code. To facilitate hacking and reduce heartache of mangled clever code, I keep everything in git repos. I share those repos online, so have to make sure there are no secrets checked in, ever. It helps to strategically use .gitignore, separate files for the secrets, and having an example how that secrets file should look in the inside.

Most of these scripts are run periodically by cron, so it is worth having some basic knowledge about how to schedule it.

Some scripts send me emails under specific circumstances (some after every run, some when new information appears), and for good delivery I have set up postfix to use Gmail as an SMTP relay. This way I’m sure to receive the emails and receive them quickly.

Scripts

These are the scripts I use most often and the longest. Still, many of them are under development and adjust them whenever I learn how to do things better. I list the links to all their repos, where it can be improved.

Banking account balances

My two main bank accounts are queried once a day for available balance and I’m notified by email. Both accounts needed quite a bit of web scraping (and got them done at two different OpenHack Taipei events). The banks’ websites are pretty awfully organized (iframes within iframes within iframes; not using CSS classes and id), though it doesn’t have to be good for me, it has to be good for the bank.

Cathay United Bank

The cathaycheck (click for repo) script queries the available balance at Cathay United Bank by logging in with curl, and parsing the final page with Beautiful Soup. The script can be a skeleton for any other website where on has to log in and then navigate over a series of pages to get the information. The required HTML variable names can be extracted with the help of the Inspect Element tools in Chrome.

At the moment the credentials is stored in the crontab command, which is not really ideal, should rewrite to use a secrets file, though given that it runs on a server where I’m the only user (and root), for me there’s no practical difference at the moment. I have set it up to receive an email at the end of the day with the current balance.

ANZ Taiwan credit card

The anzcheck (click for repo) script queries my spending with the ANZ Taiwan credit card. Again bash for logging in and Beautiful Soup for parsing the final page. It needs a bit more logic extracting information from a table, because the websites developers added no classes or ids to the items to make it easier to understand – or for them to style, but that’s not my problem.

Just recently updated that it extracts the spending items added to my balance on a given day, so I can will never be caught by surprise again (hopefully). Since many of my charges go to companies that have Chinese names, I quickly run into the problem of having to tell my Heirloom Mailx (that I use to send emails on my ArchLinux box)  that the text I want to mail is plain text, not an attachment. With some hacking the solution was to add a few more commands to “mail” so it knows that the text is UTF-8. From “sendthatmail.sh” in the repo, the parameters needed are:

-S sendcharsets=utf-8 -S ttycharset=utf-8 -S encoding=8bit

I could still extract some more information from the bank’s website, though nothing really urgent.

No-IP address updater

At the Taipei Hackerspace we have a handful of servers running, but the residential internet connection is provided by Chunghwa Telecom only gives us a dynamic IP address. Applying for a static IP seems to be pretty troublesome, so in the meantime I’m using a script on one of the servers to update the IP address associated with our dynamic tpehack.no-ip.biz address.

The no-ip-bash-updater (click for repo) script is forked originally from elsewhere, but I have rewritten it quite a bit so that it

  • needs no extra file to store the current IP address, but compares external IP with a DNS query
  • stores no secrets in the file

It uses a pretty straightforward API call with HTTP authentication, the only real logic in there is to check when that call actually needs to be made.

E-book sales

Recently I have helped a friend to publish an ebook version of How to Start a Business in Taiwan on Leanpub, and of course I want to know when there are any sales are made (disclaimer: I don’t get a cut of the sales, all goes to the author). The leanpubsales (click for repo) script is written in Python, because using JSON there is easier than it would be with bash. The call otherwise is quite simple, just keep an external file around to check if the sales number have increased or not, if yes then send an email. To send an email conditional on the output the the script the “ifne” command from moreutils is very useful (meaning: “if input is not empty”).

The query is run periodically, and lovely to receive the results. I will surely set up a script when I get my own book ideas published on Leanpub.

RTC correction

As a physicist in atomic physics, which is the area of science very much concerned about keeping precise time, keep all my servers’ times synchronized with network time protocol (NTP) using chrony. One difficulty is that the real-time clock (RTC) of those computers is pretty crappy and drifts away. Wouldn’t be a problem if I never restart them, but a pain if I do: after restart it can be tens of seconds away until the time is synchronized again.

Chrony can sync NTP and the RTC, but it doesn’t do that automatically, I have to trigger it manually. Instead I have written up an rtccorrect (click for repo) script that is run every 2 hours or so (could be done just once a day, actually), and eliminates the drift of the RTC.

Server backup

For backing up data between servers rsync has proven invaluable. I have a couple of scripts that do just that, though those are among my oldest ones and at that time I haven’t separated out personal information (way too easy to inline every credential, email, login, and all that), so I need to sanitize that. A couple of  ideas about these backup scripts:

  • sometimes higher transfer speed can be achieved by messing with the ssh algorithms, eg. passing “-e ‘ssh -c arcfour'” to rsync
  • more often there’s even better performance when there’s an rsync daemon running on the remote computer (though with Raspberry Pi, both cases are still frustratingly slow)
  • can exclude some files if no need to transfer them, eg: “–filter=’- *.part'”
  • using rsync not just to transfer but to mirror, the “–delete” (delete at target if doesn’t exist at origin) and “–archive” are pretty useful

For these backups I also use the Dead Man’s Snitch to know when things didn’t work out, e.g having a similar command in the cron list, where backup.sh is my script’s name, xxxxxxxx is the snitch ID from my account:

backup.sh && curl -s https://nosnch.in/xxxxxxx > /dev/null

This way I got to know when my backup server was dying all the time because of bad heatsink, or my host server by flaky hosting company….

Afterword

I guess there will be just more automation in the future, and maybe many of these scripts can be ported onto a common base so new ones are made much easier. What else do you guys automate?

Categories
Startups Taiwan

First sale of an ebook I helped to publish

Recently I was helping a friend to publish the ebook version of his paper book, called How to Start a Business in Taiwan. About 50% the reason was that I like the book and hoped to get into more people’s hands, and 50% I wanted to see what is it like getting an ebook out the door and bought by people.

Just a while ago, it had its first sale (hopefully the first of many:). *champagne!*

How to Start a Business in Taiwan on Kindle
How to Start a Business in Taiwan on Kindle

I guess it is a very humbling experience that it took some 5 days of promotion effort to make that sale. That is even before I count how much time I have spent converting the Word doc into Markdown, and tweak the looks. The technical details to that I have written up in a guest blog post on the books website.

The marketing side is still under development, and the numbers are too low to draw a lot of conclusions from. The most surprising thing to me is how many people actually click the “buy this book” link and then they don’t follow through. Then also the half a dozen people who I followed up on earlier discussion to tell them about the ebook version, they say “ah, it’s awesome, I’ll go get it, I’ve been waiting for it” – then nothing happens.

Of course, there can be a lot of reasons for this, here are some of my guesses:

  • The website UX does not work well for them (ie. the are put off by the process)
  • People don’t know/like Leanpub
  • People are lazy
  • The price is too high
  • The sales copy is bad, so people don’t think a business book can worth that much for them (ie. price is perceived to be too high)
  • Spreading the word at the wrong places, thus wrong audience

… and probably a hundred other reason that I wouldn’t think of – or 171, since the book’s page had that many unique visitors in the last few days who left empty handed. I wonder what would be a natural next step to improve on this conversion rate.

It was a very fun thing to do, though, and got me psyched up to get my two idea-stage books going. And about ebook publishing in general, will definitely try to get more people onboard who have writing tendencies.

Also, this invaluable learning, as I’m setting up my startup now, a good reminder that people will not easily/often buy into my “awesome” idea, will have to work cleverer on that. Rejection therapy in its earnest.

(Disclaimer: I have no financial interest in the book,  ie. I won’t get any of the sales, which makes things even nicer. I received one original paper copy last spring to review and edit.)

Categories
Life

On Going Fast Nowhere

I do feel like I’m deceiving myself. It feels such that the problems came and pulled me under even before they existed. Like time-traveller problems: come back from the future and they prevent their own birth, by making me put off entrepreneurship, and look for something else. Like open a coffee shop. Or go back being a post-doc…

It’s of course very harsh on those problems, since it’s me who created them, by becoming the not-at-all mythical “wantrepreneur”. I keep talking that much that I convinced a lot of people that I am up to more than I am actually accomplishing. It’s not for the lack of trying, mind you…. depending on the definition of “trying”.

If reading stacks of books about the subject of entrepreneurship counts as trying, then I’m pretty darn hard at work. If networking, or going to events, hearing other people’s experience, asking them for advice counts as trying, I’m still right there in the middle of the pack. If the only thing that counts is whether I made a sale of any kind – well, I got nothing. Let’s even be more generous, count learning as trying in the Lean Startup way – still got nothing. Have plans to have more than nothing, but those “urgent” plans are at the same stage as they were a month (maybe even two months?) ago.

Main conference room on the second day with speakers
APEC Startup Accelerator Leadership Summit 2013

This is all not because I’m stupid, I’d like to believe: my shoelaces are correctly tied  (just checked now), I regularly converse in languages other than my native tongue, and I can keep up a conversation pretty well, according to others. But still, sitting at Starbucks, just having put down the most recent book I’m reading of “this is how you do your business”, I have to ask myself – why am I doing this, and what’s “this”?

Maybe it’s all just fear, fear of the unknown future, where those time-traveller problems come from. Or maybe I don’t care enough. Or maybe I’m holding it wrong. Or maybe I’m just taking this all too serious? Premature optimization of things, before I haven’t tried anything? Waiting for others to show my path, and in the same time rejecting pretty much everyone else’s opinion as they cannot possibly understand and have the same amount of passion to my idea(s) as I have? That even if I yearn for the opposite, I’d rather spend an evening in with the sci-fi novel I’m reading (and which is brilliant so far), than push the limits by testing out the great ideas I convinced myself to have come up with?

My guess: all of the above, and then some. So many rhetorical questions, good grief…

That’s the current status, being full of aspiration and total helplessness. Seeing a lot of great examples, and thinking “I could do that!” and “I could never do that!” in the same time. What causes this? Can all this reading and preparation instead of helping, just piled up inside of me as intellectual pus? That might fit – something that tries to help me, and I have to get rid of to be okay.

Okay, boy. Let’s try something different: I’m calling in a learning ban, and get out to where the real action is, where the real fighting goes on with real bullets. What good is your runway, if you never spin up the propellers to take off?

(May I still finish the one I’m reading now? ….  Fine, but that’s the last one.)
(What if I could avoid some common mistake if I just have read X by Y? ….  Fuck it, use use your common sense instead)
(But, but ….  No but, can go back to your books when you have something exact to learn. You know enough. )
(H…..  Shut up.)

 

Categories
Maker Taiwan

Taiwan’s Open Hardware movement gets a boost

I sure felt different yesterday morning waiting for my turn to give my 30 minutes talk, but in retrospect I’m really glad to have been invited to the Boost Open Source Hardware Movement event, organized by the CTIMES magazine over here in Taiwan. It was the second time try, after Typhoon Soulik cancelled the original event.

CTIMES personnel introducing the Boost Open Source Hardware Movement event
Kicking off the event early Saturday morning

There were 8 speakers scheduled from different companies and background: RS Components, Via, Broadcom, Motoduino, TMI Holding…. and me from Taipei Hackerspace. First I was wondering how do I fit in there, and maybe my talk *was* out of place a bit. Most talks were in Chinese so I could grasp only basic stuff from them, although the slides helped – most people made slides following the “slides are my notes” style, which is not my style, but was welcome this time. It was also great to see seasoned speakers like Richard from Via, and Lucas from TMI giving fun (and informative!) talks.

I did feel I’m in the right company, though. Open Source Hardware is becoming more and more of my focus – or maybe I’m just realizing it now that what I do is called such. Part of the audience were industry professionals and part enthusiastic hobbyists & students, and I had some great chat in the breaks with both kind of people.

I heard about the National Science Fair here (what? I got to check that out!), and how much interesting work people do with interactive hardware and elementary/high school kids. There is waaaay more going on that I can imagine, and there’s a lot more potential to tap into.

Had a chance to gather some industry experience too. Naren from Broadcom, who was responsible for getting Raspberry Pi into production was telling the story how they were expecting only 10,000 orders altogether and got 350,000 on the first day (sold 1.8 million to date), so they had to scramble an entire new supply chain. Thought that came to me was that maybe that’s one of the biggest value of  Kickstarter/Indiegogo is to be able to get an order of magnitude estimate of the demand.

Also heard about Via’s experience in pursuing new design and materials with their APC platform (such as using paper for housing), and interacting with their community. Heard a lot from RS Components how they are building tools for their community, and building the community itself. The demo was fought with technical difficulties (first rule of presenting is not to assume a working/fast internet connection), but it was inspiring nonetheless, and gave me some big (and difficult) ideas for my project: have to see if there’s any good community for scientific/laboratory electronics and hardware building, and if there isn’t then build one.

View of the room during the break time
Break time between the talks, everyone’s scrambling for chat and cakes

One of my favorite part in these events though to meet friends’ friends. This time was no exception, even if there was too little time to talk, I left with quite a few people in mind who I will need to contact soon, because they are doing something awesome and connected to my area of interest, either in hardware or in startups. This is one reason I’m trying to be really generous with my time and making introductions between people who I recon would hit it off well: I was the recepient of that so many times that I got to give back too.

My talk

I was scheduled in the middle of the afternoon just before tea break, and I was one of two people who used English for their talk (out of the 8 speakers). I was more nervous

I’ve uploaded the slides used for the talk in advance as well, so now it’s all out in the open.

My favorite part writing this talk was probably the attempt to summarize the philosophy and values of the maker movement, in a way that would inspire others. Some bits:

  • Don’t accept crappy – everything can be changed and improved upon.
  • Aim for collaborative creation. Celebrate the weird. Don’t mock.
  • Do and then share the results for everyone to learn from it.
  • For things to happen, you have to show up. Don’t wait for someone else to start, build up and inner motivation
  • Everyone’s values are different, a ‘space is often a different canvas for everyone.

So far the feedback I got about the talk is that I should have mentioned the projects people were working on in the ‘space, and upcoming events. That would have made a better ending for sure, and I had an extra 5 minutes or so to do that. Definitely going to emphasize the practical aspect next time.

Another thing I noticed listening to (a bit of) the video is that I need to use much less “ehm” and “ahm”… I certainly don’t remember using any, and consciously trying to avoid it in my talks in the recent years, I guess I need to listen more carefully (and prepare better).

Any more suggestions? What else wasn’t good? Bring it on, I want to become better at this.

More about the Taipei Hackerspace is on the mailing list, which is open for everyone to sign up, ask questions, show their projects, and hear more about what’s up.