Arduino based automatic aquarium fish feeder

I had setup a aquarium at home recently and realized the need to feed the fish twice a day. Since necessity is the mother of invention, I therefore decided to setup some kind of mechanism which will feed the fishes at regular intervals.

I looked at assembling something with 555 timers but found after some research on internet that they are not suitable for such long delays (twice a day). The next option was digital timer circuits and pre-assembled modules but looking at the cost factor arduino seemed a good option although using a micro controller for such a project seems to be a overkill but i think what matters is it fulfills the functional requirement with the lowest cost. I wont mind even using a RaspberryPi if its the cheapest 🙂

With an old vaseline box, few electric concealing pipes and a stepper motor I managed to setup something which did what i wanted it to do. Every 12 hours the arudino code is triggered and it signals a stepper motor to rotate 1 clockwise and 1 anticlockwise rotation. There was no particular reason for the clockwise and anticlockwise part , its just that i felt that it would be more fun that way.

The demo video shows a plate which acts as the manual override which can be used to test the system till we are confident that everything is working as expected.

How i built my Media Center PC (HTPC)

Below is my current desktop machine (YES i still use a desktop) configuration.  I use Fedora Linux with GNOME desktop.

AboutPC

Listed below are very short steps which would serve just as a pointer to setup a Linux based Media Center PC aka Home Theater PC as there is a lot of information available on the internet for each pointer.

  1. Added RPM fusion repository in software source.
  2. Installed gstreamer multimedia codecs as by default Fedora cant play various media formats due to license restrictions.
  3. Installed pulseaudio volume control GUI app.
  4. Since I have a SPDIF connection from my desktop to my Yamaha Audio Video receiver, I selected the SPDIF option in pulse audio volume control configuration.
  5. Configured pulseaudio to play the surround sound formats.pulseaudiovoumecontrol_spdif
  6. Installed KODI , the excellent media center app.
  7. Configured Kodi to enable SPDIF Passthrough.
  8. Made Kodi aware that my AV receiver can understand Dolby Digital AC3 and DTS surround sound format.
  9. Enabled Dolby digital transcoding so that Kodi does the hard work of converting the new surround formats such as EAC3 to the format which my AV receiver understands.This I feel is an excellent feature as this enables me to play newer formats without the need to upgrade my AV receiver.kodi_spdif
  10.  Get a file with surround sound format to test your setup. I used a simple but excellent one available at http://www.lynnemusic.com/surround.html .
  11. Play and Enjoy surround sound music!  🙂

 

Browsers and http session keep alives

Recently came across a situation when I found out that Chrome and Internet explorer behave differently in case of http session keep alive’s. The behaviour observed was that Internet explorer closes a connection after a fixed interval whereas Chrome keeps the connection alive for a longer duration.

When a web page is requested, the browser downloads the required page along with other components.  If the server wants the http/https session to be kept alive, IE will keep the connection open TILL its own timeout limit . The default is 1 minute. After this the browser has to open a new http/https connection in case there is a need. Chrome on the other hand keeps the connection alive by sending a TCP keep alive packet 45 seconds after the last http session request.

When a connection is kept alive, the server would keep the port and its related resources like threads/memory on the server longer. Whenever a new connection is made, it requires a handshake to be done between the browser and the server where they speak on which port would they use, which protocol etc. While this may be light handshake for a http session, https means they need to talk about security certificates and the encryption keys which means a lot more talking. The user has wait till this talking is done and his webpage displayed or banking transaction is completed. With low powered mobiles which have a less number of CPU cores, low RAM or a poor network connection this might not be a pleasant experience. This would also mean the battery drains faster as the CPU has to do extra work.

Chrome therefore could be keeping the connection alive so that end user has a better user experience even though it puts some extra load on the server.

While it seems obvious that it should be the default behaviour, there may a reason why IE behaves this way. For a long time, IE has the browser which has the largest installed user base. With longer keep alives, servers would need to keep extra resources to support those users. With increased processing power at the desktops along with faster internet bandwidth, reconnecting a disconnected http/https session would not be so costly as was earlier with low power CPU/ low RAM and low network bandwidth. Disconnecting a minute after the last request was made sounds a reasonable design decision.

Root MotoE 1st gen (Lollipop 5.1)

I had a MotoE 1st gen with a insufficient internal storage issue. I have been the unofficial and unpaid brand ambassador of the new Motorola brand of phones for quite some time. The only issue with this phone is that it has limited internal storage and apps like WhatsApp and Facebook which like to eat internal storage in their lunch and dinner leave no space for anything else. This is when I decided to root this phone, luckily which was out of warranty.

I first rooted a MotoE 1st generation phone  in 2015. So this time i.e. in 2016 when I got a chance to root the other MotoE , i was expecting the whole process to complete in a hour or two. To my surprise, it was a tough job when I actually started to work on it. The technique which I was using earlier in 2015 did not seem to work in 2016. Internet still showed me KingoRoot app as the only one way to root the phone and it was not working. Some other ways like flashing a custom recovery like TWRP was not working as well.

When I was about to lose hope, an flash of thought struck me. The only difference between the 2 techniques was the OS of the phone. During my 2015 rooting, the phone had a Kitkat OS. This phone which I was trying to root had Lollipop as a part of system upgrade. I decide to downgrade the OS which was possible as some good people at XDA had made available the Kitkat firmware of that phone. I downloaded the firmware, set up the phone on Kitkat and then tried rooting the KingoRoot way. As I expected, it worked 🙂  . I installed TWRP and Link2Sd and excellent app which allows you to create move all apps on SD by creating shortcuts /Linux symbolic links pointing to a Linux partition which makes your app think that it is still using internal storage. Please note that this is not the same as APP2SD feature which works only on very limited apps and in my opinion is useless most of the time. The paid version of the app also allows you to move data folder like Whats’s app video, images folder to the SD card. I manually did that part by executing unix commands using adbshell , the details of which I will write in a separate post.

Special thanks to makers of KingoRoot who make rooting as easy as clicking a button. I wish the app had given a helpful error message saying the OS degrade part (assuming they know about it 🙂 ) but no worries as I finally achieved what I wanted to.

Caps lock indicator for Ubuntu

I have a Logitech wireless keyboard K400r which I feel is a really good product except for one thing – No indicator lights for dual mode keys like Caps lock / Num lock etc.

Its a pain every time you need to enter passwords. I had to check the status by typing some dummy text in a text editor before actually typing the passwords. After some time of bearing the pain, one fine day I tried to search if there was some kind of application which displays the current status of these buttons on the screen. To my pleasant surprise, there was already a Ubuntu app available called the indicator-keylock . Found the app in the Ubuntu software center and did a 1 click install.

capslock

Life is little easy now 🙂 .

CyanogenMod 11 on my Samsung Galaxy SL GT-9003

Flashed CyanogenMod 11 (based on Kitkat) on a old Samsung Galaxy SL GT-9003 which I managed to get my hands on. I wish the phone had little more CPU power and RAM to run Kitkat in its full beauty but it is way better than getting stuck on Gingerbread which was the last official update from Samsung.

Thanks to a developer on xda-developers.com for creating a build for my phone.

http://forum.xda-developers.com/showthread.php?t=2534312

 

Resolve Internal storage issue in Android

Budget phones usually have less internal storage memory which results in “Storage space running out” error in Android Kitkat / lollipop or something similar in older phones. I had to face this issue many times as I prefer and also recommend budget phones 🙂 . I have resolved this issue using the steps explained down for the following phones -:

  • Moto e
  • Micromax A67
  • Lenovo A390
  • HTC Explorer A310 (pico)

Steps: (Following these steps will void your warranty)

1. Install a recovery like TWRP or CWN whichever is available for your phone. Internet and xda-developers are your best friend. This allows you to do advanced stuff like backing up your entire ROM even if that feature was not provided by your device manufacturer.

2. Root the phone. This will give admin rights to your phone. This steps vary for every phone model. Again there is a wealth of information on xda and internet.

3. Take a backup of the entire ROM using the recovery software installed in Step 1. It is usually a one click process which saves the ROM as a file on your SD card.

4. Create an ext4 partition on your SD card. This partition is needed as there is Linux running in the internals of Android and latest version of Linux prefers ext4 file system. This can be done by a partitioning software like Gparted on your PC. I use it on my Linux machine.

5. Once rooted then install Link2Sd or something similar app on your android phone .This app will help you move or link (shortcut ) the applications which are present in phone storage to the new ext4 partition which was created in Step 4. Without rooting your phone, this is not possible as this step requires administrative rights. This app also allows you to remove bloatware which was installed by the device manufacturer. Almost all apps except the system apps can be moved/linked to the SD card. All apps need to be linked/moved manually. It is advised not to touch system apps.

5. Reboot the phone. Any new apps that are installed from this point will be automatically linked to the SD card.