Automating the Nespresso Coffee Machine part 1

wp-1482139836728.jpg

I like drinking coffee first thing in the morning, however preparing coffee in the early morning is not something I’m a big fan of, so I decided to use my particle photon to automate the coffee making process. Thus turning my normal Nespresso machine to an IoT enabled machine.

The steps for this build are quite simple, it requires the following components :

  • Particle Photon
  • Servo
  • Power Bank
  • Paper Clip
  • Rubber Band
  • Velcro Tape

To build it connect the Servo to the photon, noting that the data pin must be connected to one of the PWM enabled pins, in my build I used Pin D0.

Use the paper clip to twist and attach on the servo keeping it in place using the rubber band, this serves as the push rod that’ll press on the coffee maker’s button.

wp-1482139836728.jpg

Attach the servo to the Nespresso machine using velcro and tape, you’ll need to adjust the servo angles on the code to work with your machine and how the servo is attached to its body.

Connect it to IFTTT service and enjoy your coffee, Personally I then created a DO button on my phone to press the first thing in the morning.

Continue reading

Particle Photon First Impressions

wpid-20151022_133007-1.jpg

The particle photon maker kit I ordered arrived and I finally was able to take it for a spin and I’m quite impressed. A tiny wifi enabled chip that can realise almost any IoT fantasy you conceive, Within few minutes of unpacking it, I was able to get it online and within an hour I had my first project up and running.

image

The chip itself is surprisingly small, small enough to make it possible to embed it into most fabrications, and it has a very low profile as well. But the real selling point in my opinion is the cloud backend, particle managed to greatly reduce the hassle required to set up an arduino IDE by providing it through a neat and simple web console. Being an IoT chip relying on the internet for most of its features can’t be held against it, the photon is built to be used in use cases in which internet is available naturally its a lot less impressive without internet connectivity.

Screen Shot 2015-10-23 at 4.14.39 PM

Unlike Arduino there is no IDE , instead you build your “sketches” in the cloud, and then flash it wirelessly to the device of your choice, this allows for easier upgrade if the devices are embedded and physical access is challenging. You can still use the micro USB to connect to a laptop and debug over serial much like you would with an Arduino, a node.js spark CLI framework is required though for this to work.

For my first project I decided to build something simple and fun. A realtime desktop data display device, an paper lantern that lights up in different colours to alert me of programable events. The great thing about particle products is how they can be represented as a channel on IFTTT, so you can program it to respond to any of the numerous IFTTT triggers.

image

I’ll discuss the implementation and code of my project in my next entry.

 

 

 

The rise of the co-Founders

It is no longer a technology race, its a marketing race. Almost any software can be built or copied at a similar quality, its all up to marketing and customer grabbing at early stages of the product life cycle.

Recently I noticed an increasing trend of using the term “CoFounder and CEO of” on linkedin. The majority of the self described CEOs are fresh graduates or have just joined the IT field. Few of these startups are significant or were ever heard of out of the scope of their owners’ immediate circle of friends. It doesn’t stop at tech startups really it seems like everybody is trying to build something to call his own for a whole array of different reasons be it financial or the mere thirst to get the bragging rights or even in some cases peer pressure. (i.e. “in” people and fashion blogs)

Silicon valley parodied the culture of launching irrelevant startups quite nicely

Silicon valley parodied the culture of launching irrelevant startups quite nicely

The notion of being a middle-class salary man is no longer fashionable, As a generation we were raised that each and everyone of us is unique and destined for greatness settling into a life of corporate obscurity is not something can cope with easily. Financial reasons play a role here as well as startups appear to some as a quick way to make it into the double commas club (millionaires club) after all how hard can it be to build up a company and then sell it later for a couple of millions right. Given how the entry barrier is particularly low the common perception is that you don’t have to put a lot on stake in order to build a tech startup, All whats needed is a good idea and a couple of customer and things will organically evolve. Everybody can be an over night entrepreneur.

A website can be built and launched and wouldn’t cost more than a month’s salary hosting the product on the cloud can guarantee a easily affordable operational cost, in theory you can run the website forever securing the “entrepreneur” status for as long as you have it online. I’ve written an article not so long ago about the rise of social entrepreneurs in post 25 January Egypt and how few if any ever make a profit. People confuse having a successful product with having a successful startup, For the first the success is measured by hits/downloads/user-base while for the latter it all comes down to being revenue positive at some point (or at least the prospect of it). More importantly owning your website and URL doesn’t equate being an entrepreneur managing your own startup. Having a killer idea is not as valuable as it used to be, almost any idea can be replicated at an even higher quality what really matters is traction and a growing user base, given the social nature of most products it all comes down to the critical mass of users. Even if you are moving into a new area with no competitors once you achieve anything that resembles a success -and given the low barrier of entry- competition will show up.

Being an entrepreneur and managing your own startup is much more complicated than simply launching a site and getting a couple of hits everyday, there is a certain leap of faith required in order to actually manage your own startup towards success, usually this entails quitting your job and relying on your newly found venture for income. Being a part time entrepreneur almost never works, a CEO/co-founder is expected to spend 16 or 18 hours a day working on his brain child, doing it in the few hours you’ve got left after work would never cut it. So unless you are willing to do that please do not call yourself CEO/Co-Founder of one thing or another.

Still why not do it, with a low entry barrier and almost zero operational cost all of us can be entrepreneurs, the co-founders and CEOs of one thing or another. Profit, value and sustainability are all irrelevant, after all it is all about the bragging rights and the 15 minutes of fame.

**note : To be clear I realise that I sound as if I’m making sweeping generalisations there, however this is not the case, this article is about the type of “entrepreneurs” who do it for all the wrong reasons.

USSD API on Android

I’m currently trying to build a small widget that shows you several statistics about your cell phone usage, this would require using USSD codes and catching their responses. I scoured the internet for a solution however wasn’t able to reach one.

The only available solution which is mainly a hack relied on catching the logcat entry and displaying it, unfortunately this was fixed in subsequent versions of android and now USSD response doesn’t appear in the logcat.

There is even a Facebook page created just to request this feature from google…anyway if anybody manages to find a way to handle USSD responses please do share.

On Local Open Source Products

I was called earlier this week by some technology show inquiring if I’d join a forum discussing the local Open Source Projects, and the reasons why the are rather scarce. I ended up not being able to join that forum, but it did get me thinking, I can’t think of even a handful of products that originated in our region, or even contributions to existing products. Even with the recent startups/innovation boom, I don’t recall seeing any opensource code to speak off.

After spending some time googling around and searching for any serious opensource project i was only able to find a Linux distro (Ojuba) that was developed in our region and seems like even that project was stopped 2 years ago. I also recalled seeing some Egyptian themed redhat based distro but can’t recall its name, I’m sure however it was discontinued. Other than that I wasn’t really able to find any mention worthy Open Source projects to speak off. Still I was able to find several Open Source fonts and even music…so seems the Open Source shortage is limited to code.

In the last 5 years several products emerged, some where complex enough for its code to be open source worthy, kngine for instance with their semantic web based search engine…it faded out of the scene now, but i believe it’d have persisted if he chose to open source it. Same applies to several other projects that may have failed business wise, but would have definitely left an impact if its code was shared with the world. So why aren’t people sharing their code with the world in our region as they do in other places.

There are several approaches to open source code development for instance:

  1. an individuals building such an amazing algorithm then sharing it on github for the world to use.
  2. A Company builds a really interesting product and decides to release its code for developers knowing that they still own it as intellectual property even though the world can see the code you can’t use it to earn money without contacting that company first.
  3. A group of developers collaborate to build a project then share its code to the world.

My thought process led me to question the motivations that lead source code to be shared. I believe in cases of individuals code is shared as a way to gain credit, after all who doesn’t know Linus Torvalds, or Phil Zimmermann, and their contributions. Even though their code is free to use, they still made more fame and subsequently money out of their products than they’d have if they sold it to some corporation. As for corporations, sharing the code serves to allow people to port and improve it, also to go over the code and increase the resilience through a process of global peer review, a really decent example here would be Android OS, open source and with millions of variations out and yet not nearly as many security issues as iOS.

I believe the following reasons are why we don’t see that many open source projects originating in our side of the world:

Lack of Time (individuals): Time being one of the most expensive assets we have (and the only one we can’t replenish) is wasted in traffic, red tape and other smaller fruitless activities, the time left after doing all of this isn’t nearly enough to be donate to open source development. Developing elegant share worthy code takes a lot of effort, not to mention the clarity of mind to sit down and plan something.

Lack of Recognition (Individuals): The local eco-systems doesn’t reward people who’ve been involved in even successful open source projects. Most corporate would dismiss that as irrelevant.

Lack of Resources (for Companies): Managing a project to completion is expensive, sharing the code isn’t nearly as rewarding in our region due to the lax intellectual property laws. Your competitors can just take your code and use it as is without crediting or consulting you. and good luck trying to convince a judge that this was actually your code, I don’t believe they have computer code technical advisers in our judiciary system to being with. Furthermore I’m not really sure you can patent code. Sharing your code wouldn’t result in people porting and improving it while retaining the credit, instead it’d result in creating competition and wasting the resources invested in the product.

Please feel free to share your opinions and your points of view on this topic…

Sharing an Image from Bitmap in Android

I had a project that required downloading an image from the internet then calling the sharing intent to share that bitmap, I went through countless entries until I reached the conclusion that it is impossible to share an image directly from a bitmap object, the bitmap must be saved first and then you can share it and if you dont want to keep a copy on disk you have to explicitly delete it.

Here are how I ended up doing it.

1. Save BitMap

String file_path = Environment.getExternalStorageDirectory().getAbsolutePath() +
"/ProjectName";
File dir = new File(file_path);
if(!dir.exists())
dir.mkdirs();
File file = new File(dir, name);
FileOutputStream fOut;
try {
fOut = new FileOutputStream(file);
abmp.compress(Bitmap.CompressFormat.PNG, 85, fOut);
fOut.flush();
fOut.close();
} catch (Exception e) {
e.printStackTrace();
}

2. Share URI from file

Uri uri = Uri.fromFile(file);
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("image/*");

intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "");
intent.putExtra(android.content.Intent.EXTRA_TEXT, "");

intent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(intent, "Share Cover Image"));

 

If you can come up with a hack to share directly from BitMap please do share, but I dont believe it is possible.

 

Samsung S4 Gestures SDK not supporting S4 phones!

Lately I just got myself a Samsung Galaxy S4 LTE, a decision based mainly on the array of sensors it supports that aren’t present in any other device in the market. Gesture control promised to be that one cool feature that I can build intuitive ergonomic apps around. I installed the Samsung SDK following the instructions on Samsung developers site only to get an exception stating that my device isn’t supported, which didn’t a lot of sense since I had the flag ship, the top of the line device and more importantly it had air gestures in many of the native apps. Turns out that the gesture control library requires at least Android 4.3 (Jelly Bean API level 18), while the S4 LTE is running android 4.2.2 with only the american carriers updating to 4.3 for the time being.

Gesture/Motion Control which are present in Samsung S4 devices are only accessible to developers if the device is running Android 4.3, while they have 4.2 factory installed.

Even if I install a custom ROM and bring my device up to 4.3 any app i’d build wouldn’t be useful for most of the users until 4.3 becomes the new standard.

It doesn’t really make much sense from Samsung’s part to release a device that supports certain functionality while the SDK can’t access them using the factory installed Android version, and its not like the features aren’t there, they are there and being used by the system. The only problem is they aren’t accessible through the SDK.

This may explain why these features are under used by developers. The only apps that use these features are either Samsung apps or released by one of their premium partners.

Yes i know there is a work around and you can always access the underlying API, reverse engineer one of the current Samsung apps and figure out how they access the sensors, but too much of a hassle for a simple silly app to be honest.

Reference: http://developer.samsung.com/forum/thread/gesture-not-supported-on-the-s4/201/244204?boardName=SDK&startId=zzzzz~