Personal Blog

    Artículos publicados por lipman

    I would like this time to write an entry about a self-reflection concerning public transport within cities. I like to write my ideas thinking that they might inspire someone and help somehow to build or help developing intelligent cities.

    The adjective “intelligent”, when used in front of “city”, might refer to those futuristic cities we all have in mind where citizens can interact with city environment and have a great experience. An intelligent city should help and response all kinds of citizens requests and citizens, from locals to tourists, from young generation to old people. This is quite a big challenge since we all have a different technological background and culture, but we engineers should aim to make technology available for everybody.

    One of the most important backbones in a city is definitely public transport because it is used by a wide range of different people everyday, that’s the reason why I want to dedicate this entry to it. From now on, I will discuss as well as give some ideas and explaining personal opinions about different elements within public transport service, but I will divide this entry into two parts. The first part is something very general, with no technical details, just the ideas and advantages. The second part will be an approach of developing a little bit this ideas (both technologically and in real life environments, with real disadvantages).

    General Ideas

    Buses and trams

    First element: Geolocation.
    What to implement: send geolocation through the Internet every certain period of time (i.e. every second).
    1st Idea: If we know where the buses and trams are all the time, many applications might be developed to allow users to know where the vehicles are. This will allow users to know whether they can take the vehicle.
    2nd Idea: If we know where the buses/trams and the bus stops/tram stops are, it is possible to make some statistics about how late vehicles are. This is a quite interesting element in a city where certain buses (because of the line) are usually late.

    Public transport in London

    General Idea: When users have all this information available, the reliability of the company increases. People may trust more, will feel more comfortable and the company will try to educate itself to be more punctual. Additionally, in my opinion, some people may choose to move within the city using this transport and the environment would benefit (as well as company’s incomes).

    Second element: Weight sensor.
    What to implement: a weight sensor that tries to guess how many people there are inside the bus, and send this information through the Internet.
    General Idea: this would definitely benefit end users. Sometimes, when we want to go somewhere, we have many choices because of different bus/tram lines and normally, the user is more comfortable when a transport is not full. In my opinion, if the user can choose between a 90% full bus and a 20% full bus, he will choose the last option, and therefore the user experience will be more satisfying.

    Third element: Bus timing display
    What to implement: a simple display which will show the minutes left for each bus to arrive.
    General Idea: This idea, bind with the first element, approachs to make it available for everybody since not all citizens have a smartphone (even though, it an easier way to know when the bus will arrive). This display is actually in some cities nowadays.


    First element: Geolocation.
    What to implement: it’s the same as in the previous section, but in case of taxis there is an additional advantage: panic button.
    General Idea: In some places taxis might be robbed and a panic button which calls the police and send geolocation information when pressed is very helpful.

    Second element: Information about taxi’s/taxi driver’s characteristics.
    What to implement: some information about each taxi available on the Internet.
    General Idea: Not all taxis are the similar since some of them are specific for disabled people and even some of them are bigger than normal ones (7 seats). Depending on person, one may decide which taxi is more appropiate for his/her needs. Another interesting information detail which is importan is the availability, since a user is only interested in those taxis which are available.

    Traditionally this “information” and “geolocation” is being solved by calling to the taxi company and asking for a taxi telling what you need, but I think that people will use more taxi services if it looks more dynamic and available, and they feel closer to the service.

    Public Bicycles

    First element: Availability counter.
    What to implement: a counter (available in the Internet) which tells empty places and available bikes.

    Public bike service in Zaragoza

    General Idea: It depends on the system the city has to borrow public bikes, but in some places, bikes are directly attached to a special parking place, and a the machine is setting them free when an authenticated user identify himself/herself by an RFID card. This machine would be able to count empty places and available bikes and send that information constantly to the Internet, so this way the user can be sure he will have a bike in the origin of his route and an empty place at the end (even if this information is varying all the time). I think this way the use of bikes will be encouraged.

    Second element: QR code for each bike.
    What to implement: a QR code sticker in the bike.
    General Idea: When users are dissatisfied with a service, they can complain and be answered, but in this case, if something happens to you, there is no information or people that you can complain at. A QR code would allow you to complain about one bike (after authenticated) in case the bike is broken or something is wrong with it. This would enhance the service because is a mutual help between the company and the user. The user feels more satisfied and safe and the company is able to repair the problem as soon as possible.

    Developing Ideas

    Implementing something on a public service

    Words are easy to say/write but actually, implementing those ideas might be problematic from money’s point of view. Cities hire public companies to make some services available to the citizens such as the public transport. They make a contract for some years and that company will be able to do it during that period. However, I think in that contract a section where the company says that it provides last [tech] available facilities to the citizens must be included. This will make the business more competitive and the company will have to make an effort on this.

    From the company’s point of view, they might think that if something works is not necessary to fix it, but this thought is quite old and some investment must be done in technology for citizen’s well-being. Anyway, I would be agree even if the city gives some money to the company (less than the 40%) to implement this technology, because it will benefit the citizens, people who use everyday this service.

    Geolocation API

    Before detailing how could this API be, I would like to say that is not even necessary for the company to develop the application for end users, because if they release freely the API, I’m sure some programmer will do it, but I think it would be better if the own company make the program.

    Following API’s description will have a similar structure to the Twitter’s one.

    Example 1: Bus details

    Request to: This will retrieve buses details.

    • bus_id: It will retrieve information about this bus
    • bus_stop_id: It will retrieve information about all buses which stop in this bus stop.
    • line_id: It will retrieve information about all buses which belong to this bus line.
    • street: It will retrieve information about all buses which go through this street

    [bus_id: 123, line_id: 12, type: 3, disabled_people_facilities: true, bus_stops: {1242,3234,652,1532}]
    [bus_id: 236, line_id: 3, type: 1, disabled_people_facilities: true, bus_stops: {536,266,3123,999}]

    If the funny weight sensor is implemented, it may be also here.

    Example 2: Line details

    Request to: This will retrieve information about a line.

    • bus_stop_id: It will retrieve information about all bus lines whose stop id is given.
    • line_id: It will retrieve information about all bus lines which belong to this line.
    • street: It will retrieve information about all bus lines which go through this street

    Example: street
    [line_id: 2, bus_stops: {1242,3234,652,1532}, bus_id: {123, 432, 12, 432, 532}]
    [line_id: 3, bus_stops: {536,266,3123,999}, bus_id: {55, 23, 56, 75}]

    More information needed: information about bus stops

    Weight sensor

    Since I have no idea about mechanics I don’t really know where and how to implement a weight sensor, but I guess it cannot be so difficult since nowadays there are all kind of sensors inside the vehicles.

    The information about the weight may be sent to the server, where depending on the type of bus it sent it, it may apply one or another formula, because different types of buses may weight differently. It’s not a difficult calculation: current_weight – normal_weight (when empty) / 70 (average kg per person) and then we have an estimation.

    About taxis

    An application where users could see where the taxis are would be awesome.
    Feature 1: Taxi driver has always control over his visibility, and when he picks somebody up, the visibility will be turned off.
    Feature 2: A user can see all available taxis around him, and he can request a taxi to come to his place (got by GPS). The program will randomly warn a near taxi, and the taxi is suppose to go there. If the taxi driver doesn’t want, he can reject the request pressing a button.
    Feature 3: When requesting a taxi, the user may include useful information such as seats or some special needs (disabled people).

    About bikes

    Implementing a counter is not so difficult to do since all bikes are directly attached/connected to the mechanism which set them free or lock them. A QR code is a simple link, which may lead the user to a webpage where he/she can write about encountered problems regarding to the bike in a form.

    I can barely remember what exactly happened one year ago, just after a personal incident which directly unmotivated me, regarding my Erasmus exchange program. When I was chosen, early February I think, I had some fears which I can still remember because I still have them from now on.

    As I’ve never enjoyed (or learned how to enjoy) that common behaviour among students and non-students called party (I come from Spain though), I was worried about my environment. I didn’t know whether I will be able to meet people similar to me (not even 100%) and it’s kind of stereotype to go abroad to not-study and partying all the time. Actually, there are some people that they do that in their own countries, so not such a difference from abroad. This fear might have become in a problem called isolation. By the way, it’s worth to say that here I learned that the concept of “party” is quite different depending on (mostly) the country people are from. My other fear was about the language, but it wasn’t a fear actually, it was more like a doubt.

    But in the beginning I also had a lot of motivations to go abroad: firstly, as I said I had an incident which made me glad to run away from the city I was living for the last 3 years. I also wanted to live outside from Spain since I don’t like some characteristics of people/culture that I don’t want to speak about now, and I was curious about other people’s mind. I also had an advantage, because as I’ve lived in other city and said goodbye to my friends, it wasn’t a big difference to go a little bit more far.

    The reasons why I chose Finland were mainly because it was the country that I liked the most among my choices, and at the end of the course, I’m suppose to have an additional diploma (European Computer Science). I also wanted to see how people are here, how different Spanish people are, and everything related to the culture. I really like that kind of stuff. I usually say that it’s also because I like heavy metal and Finland is the heavy metal country (definitely!), but it’s not so important actually.

    The first month I spent here was actually different from the rest of the period, since I attended a summer school. Many people from different parts of the world came just for the summer school and then they left: Canada, Russia, The Netherlands, Italy, Germany… August was a nice month: many hours of sunlight (from 5:30 to 23h), quite warm and I could hike a couple of times with some friends. I remember clearly that when I met people for the first time, the first questions always were “what are you studying and for how long will you stay in Finland”, because I was interested in who of them will be studying with me, but all of them didn’t study the same (so sad…). In the summer school I had my first touch with Finnish education system (that’s what I thought, but then I realized it was slightly different, in a better way). My teacher was from France, and I was quite surprised about the interest he had for us. I could really noticed that he wanted to teach us, and I’ve never had this feeling before, it was really great and I felt really comfortable. In three weeks it’s very difficult to make real friends (at least for my concept of friend it is), but I met really nice people and I enjoyed time with them.

    They day everything started again. I remember quite well this day: after the summer school I was a little bit depressed, because by that time I had to meet new people again, but some time later I will realized that this was a very important moment [in my life] since it was the beginning of one of my strongest friendships in my life. We had an important meeting (that I actually had it before, because I was in the summer school), it was the presentation day among exchange students (some of them). Before the meeting, as usual, I like to be in the places early, and by “early” I mean “Japanese early” not “Spanish early”, and it means 30 minutes before the event. Quite early. The first people I met there were two Chinese guys that were quite nice and I was surprised because they could speak English very well. Just 5-10 minutes before the meeting I saw some tall guys waiting. Guess where they were from: Germany (Dominik and Tim) and The Netherlands. After some time, we all went to a computer room and surprise! I could see so many Japanese people (even a Japanese guy I saw before in my dormitory because he lost the keys! Mako). I was in the last row. In my right side some guy was sat there. He came late and guess where he comes from: Portugal! In my left side Mako was sat and the Chinese guys I saw before. I actually remember where most of them were sat (about 30 people), I don’t know why… With this amount of Japanese people I felt like in a Dorama. This day I could check many Japanese stereotypes: shyness, lack of confidence, very well organized, and the English level is quite bad (of course this depends on person but I mean generally, amoung Japanese people, not even my Japanese students).

    After some days I wrote in the FB group we had that I wanted to organize a meeting in order to make the student cards. By that day, only Japanese people came and I felt quite alone because they were speaking in Japanese the whole time and it was difficult to speak a word with them. After we went to the corresponding office to make the cards, for some reason, I started to speak with my now very good friend Keita, and we both realized that we had similar hobb-ANIME. This was a very remarkable moment I will hardly forget.

    This project is actually university homework, but it’s so interesting that I decided to upload here the information. I’ve never used such an electronic components before and I have to admit that it was a nice challenge.

    This robotic arm is composed of 5 servo motors, which must be controlled in order to use the robotic arm by a couple of joysticks. Proposed environment for this project was the following: We are in a lab dealing with toxic substances, and we need to move them using this robotic arm. Of course, end-users are not suppose to know anything about how the robotic arm is internally built, this means that they don’t have technical knowledgment about mechanics.

    My solution
    Using the joysticks, we are able to move the robotic arm (back-forward, up-down, left-right) and open-close its grip to catch test tubes.
    Additionally, we can see the angle of each servo motor in Olimex’s display and move the robotic arm using Olimex as well. Finally, it is also possible to change the “speed” of robotic arm movements. In my opinion this was completely necessary since the robotic arm is able to move around 10kg and using low weight test tubes makes robotic arm movements so fast by default.

    There is also a “security mode” which makes the robotic arm not being move incrementally. Normally when we are using joysticks, the faster we move the joystick, the faster will be moved the robotic arm. But sometimes, we require a more precise control. So, this “security mode” moves always slowly the robotic arm, independently of how fast we are moving the joysticks.

    How is it constructed
    Each servomotor is connected to each Olimex pin where it is possible to send signals and control them.
    Joysticks are connected to Olimex’s ADC, and therefore we can measure and interpret current values.
    Servomotors are plugged to 5V while Joysticks to 3.3V. Everything share the same ground.

    How to control a single servo motor
    I guess this depends on the manufacturer, but I also guess in all cases it’s similar. In order to control a single servo motor, it is necessary to send a signal whose frequency varies depending on the angle it is wanted to obtain. In case of this servo motors, they need 50Hz and sending a 1500ms signal they turn to the “neutral point”. From this point, we can increase and decrease the sent signal and move them from one to another side.

    Wrist servo motor is special. As I said, there are 5 servo motors and using joysticks we are able to control 4 of them (up-down, left-right movements). Wrist servo motor has to be always horizontal, and this is achieved by calculanting angles of the rest of them and apply some formula to obtain desired value.

    I recorded this video showing how it works:

    The idea behind this project is simple: a tool which regularly reminds me when my auction (or interested item) is going to finish and its current price. I established ranges and periods of time as following:

    Time left Remainder
    >12h Every 12h
    12h > x > 6h 1 remainder 6h before
    6h > x > 2h Every hour
    2h > x >30m Every 30 minutes
    30m > x > 0m Every 10 minutes

    For example, if I register one item whose time left is 2d 16h, the remainders will be set as:

    • 2d 12h, 2d, 1d 12h, 1d, 12h left
    • 6h left
    • 5h, 4h, 3h, 2h left
    • 1h 30min, 1h, 30min left
    • 20min, 10min left.

    The register process is very easy: take the ebay ID number of the item (located in the URL), and visit a link such as: ~register.php?
    After this, the script will generate cronjobs whose work will be “visit” a webpage such as: ~bot.php? and a tweet will be published after calculation current time left.
    When time left is less than 15min (so, the last remainder), all cronjobs regarding to that item will be erased. This means that you can add as many items as you want.

    It is also easy to change some features such as remainders period and tweet’s content.


    Last week, in the middle of my timetable gap, waiting with my German friend for the Finnish for Exchange Students class he showed me the Apple maps application, and I really liked how you are able to see projected sunlight in Earth, and as I really liked space stuff pictures, I thought it would be nice if I’d have a dynamic wallpaper that changes automatically where I can see this, thus comparing sunlight hours between my home country and Turku (Finland), where I’m living nowadays.

    At first, I saw my own skills so limited since I mostly know about PHP, C, Java, and a little bit of other programming languages. After this I made me promise to learn some day Python, but anyway, knowing about C++ would also be okey in this situation. My final decision? Powershell!

    Getting down to work
    I have never programmed using Powershell, and I was quite surprised how a lot of things can be done in a so easy way.
    I researched about this kind of planet and sunlight images, and I found a Czech webpage where I can select coordinates and zoom, so I just adjusted this to my needs and this is the result.

    As I have never programmed in PS, I researched how to change and update the wallpaper, and although it was quite easy to implement (only two lines), I decided to rely on the operating system itself (it is always suppose to have higher perfomance, rather than programming oneself the same) and the only work I did in PS is to download a couple of images which will be rotating every 5 minutes (also they are downloaded every 5 minutes).
    Note: I selected a 5 minutes interval for mainly two reasons: I am not able to send too many requests to the Czech wesite, I think it’s enough and this way I don’t spend too many resources.

    I’m also interested in making some kind of video where I can see the sunlight at the same hour every day, in order to see how the sunlight changes during the year, so I also programmed this in the script below.

    Source code

     # This function will save an image given source and destination
     # @param source of the image.
     # @param destination where the image will be saved.
    Function SaveImage
        #Get the params and cast them into strings
        $source = [string]$args[0]
        $destination = [string]$args[1]
        #Download it, and wait for 5min
        $wc.DownloadFile($source, $destination)
        Start-Sleep 300
    $source = "";
    $wc = New-Object System.Net.WebClient
    $date = Get-Date
    #Name for my picture I will store in the other folder
    $pictureName = "$($date.Day)-$($date.Month)-$($date.Year).jpeg"
    #Other folder where I will store all the pictures to make the movie
    $pictureFolder = "C:\Users\JuanMiguel\Pictures\light\"
    $pictureFullPath = "$pictureFolder$pictureName"
    #Where I will store the images I will use as wallpaper
    $destination = "C:\Users\JuanMiguel\image"
    #I will save the picture always after 19h
    while($date.Hour -lt 19)
        SaveImage $source "$($destination)1.jpeg"
        SaveImage $source "$($destination)2.jpeg"
        #I take the date again
        $date = Get-Date
    #Check if that picture exists, otherwise I will save it
    if(!(Test-Path $pictureFullPath))
        SaveImage $source $pictureFullPath
    #Endless loop
        SaveImage $source "$($destination)1.jpeg"
        SaveImage $source "$($destination)2.jpeg"

    As PowerShell is a high level programming language (very high indeed), I tried to program the script in a non-traditional way, checking the less information as possible. Of course, it would have been cleaner if I’d only used one infinite loop asking all the time about the hour and checking if the image I want to save exists, but that way I have to ask many times to the computer, therefore, more work, more wasted resources, less battery, etc. Sometimes it’s better to think more about the performance and less about how easy to read the code is, mainly when we have so simple code like this.

    17h and almost dark.. but winter will be fun!