Archive for the 'Personal' Category

Stravomatic: an Android app to automatically start Strava rides

Sunday, December 17th, 2017

This week-end I remembered that when I got my new phone, it counted my steps on its own, and I looked up why. I discovered that there’s a Google Play Service that enables developers to get the user’s activity (walking, running, cycling etc) and I decided to try to code my first Android app: Stravomatic.

I use Strava since a few years and find it great to keep track of statistics , but sometimes I forget to start it each morning and evening when commuting.

Development went much better than I expected and I think I have a good and reliable app that starts a Strava activity if I start bicycling (or running) (for completeness, because I never run) (apart this week-end where I went around the garden numerous times for testing). It’s a simple app with a settings page and a background component that keeps track of what happens :

As it doesn’t use GPS, and takes advantage of Google Play Services, it doesn’t seem to take a noticeable toll on the battery, so I’m quite happy about that.

I published it on Google Play : Stravomatic, and I’m quite proud about it! I hope it’ll help other forgetful people :)

My own homemade BB-8

Monday, February 8th, 2016

After having seen the latest Star Wars movie, I, like numerous other geeks, fell in awe with the BB-8 droid, and, like numerous other geeks, I wanted to try and build one.

So, I started by getting a 300mm plastic ball and another of 180mm diameter (which was more of a 160mm ball according to my ruler…), a pair of motors, and got the electronic parts box out of the cupboard, guessing I’d just start and solve problems as they come instead of spending a lot of time with plans, and getting demoralised half-way.

DSC_0526

The start was rather easy: get the useless parts out of the balls, and sand them so the paint would adhere.

DSC_0534

Then I made a few calculations to create the main board at the lowest possible place, and placed the motors and wheels at each side.

DSC_0541

Going on with the battery holder, even lower, in order to help with stability:

DSC_0544

Spoiler alert, this USB smart battery didn’t provide enough current, so later it got replaced with a S2 LiPo battery I use in RC cars.

DSC_0550

The fun part began, with a bit of Arduino programming. I used a standard 2.4GHz receiver for control, added a 3-axis gyroscope in order to try and compensate wobbling with the motors.

DSC_0558

About everything, laid out. Spoiler alert: the gyro is of no use, because the motors, which are DC motors with reductors, are far from precise enough to compensate anything. Also, even if they were precise, they could compensate pitch (front-to-back wobbling) but not roll (lateral).

DSC_0563

After upgrading the battery, the first test was rather promising:

And here came the time for the difficulties: adding the mast:

DSC_0562

And the head, with magnets to hold it in place, and caster balls to have it roll freely:

12552541_10205407629492323_2296425100086899696_n

Spoiler alert: the very little caster balls did not roll freely at all, and too much approximation in the magnets’ placement made them touch the body’s ball, making very unpleasant sounds (and also the head had that tendancy to fall):

But still, it was promising. So I started painting.

DSC_0565

DSC_0569

DSC_0570

DSC_0571

And after hours of masking, painting, re-masking, re-painting, I arrived at an unperfect, but not too shameful result:

DSC_0573

Went on with the head…

DSC_0574

DSC_0576

But with just the added weight of the two “eyes”, it couldn’t sit on BB-8 more than a couple meters… So I ditched it and re-made it from a styrofoam ball (this time of the correct size), and while I was at it, re-made the magnetic mechanism with better magnets, better caster balls and better measurements.

DSC_0578

DSC_0589

And the result looks pretty good in my opinion!

DSC_0593

It also rolls much better, although there are still a few noises and it can look like BB-8 had a few beers:

It took my three weeks to get to this point. I knew I could make it a month, so I’ve upgraded a few things, mostly so I don’t have to open the body each time I want to power BB-8 on: first, a magnetic switch (don’t use a bicycle odometer’s sensor, it won’t accept so much current and will solder itself the first time), which I can use to power on BB-8 from the outside (after a bit of searching each time):

DSC_0591

It’s made out of a bendable piece of metal and a magnet.

You can also see there a pair of relays, which are used to auto-power-off the Arduino and its motor shield after two minutes of RC signal loss; this way, I don’t have to open the body to shut it down either.

DSC_0590

And I’ve stuck in a little LiPo battery tester, so that it can scream at me when the LiPo’s starting to be too discharged (LiPos don’t like that, and when LiPos are unhappy, they tend to catch fire if you look at them wrongly, so.)

I now consider my BB-8 complete although it’s far from perfect ! I think it wasn’t the easiest robot to start building robots, but then, I enjoyed making it. Maybe next time I’ll do an R2D2, and although the body work will be harder, the mechanics will be a walk in the park.

After building it I’ve watched other videos from other BB-8 makers, and it is really fun to see how many different designs there are. Some are very simple with an RC car at the bottom of the ball, some roll by direct transmission and have turning performed by a fly wheel; some are holonomous robots with multi-directional wheels, some use indirect transmission like mine, but a flywheel to turn (this guy is good, but also has access to great resources, so I do think I could do much better if I had CNC mills, 3D printers and ACTUALLY GOT PAID TO DO IT), and this 17 years old’s model works exactly like mine, but damn this kid is skilled.

How to add the ATV4 orbit data to Stellarium

Thursday, June 6th, 2013

(English version – see also French version)

ESA’s ATV-4 Albert Einstein was successfully launched yesterday and is now orbiting Earth for nine days prior to its automated rendez-vous with the International Space Station.

As for each satellite, it has TLE (Two-Line element) data publically available and it can be downloaded from celestrak.com for example : http://www.celestrak.com/NORAD/elements/tle-new.txt

To import it in Stellarium and be able to see when and how Albert Einstein will soar over your head, the procedure is a little bit unintuitive, so here it is:

Open Stellarium, and choose Configuration Window, Plugins.
1

Select the Satellites plugin, then click on Configure.

2

Select the Sources tab, then click on the last URL displayed, then on the Plus sign (the editable URL should be replaced with “[new source]”.

3

Paste in the http://www.celestrak.com/NORAD/elements/tle-new.txt URL, and validate with Enter.

4

Select back the Settings tab, and click the Update Now button.

5

This is the part I didn’t figure out at first: new satellites don’t get automatically displayed! You must now go the Satellites tab, and click on the Plus button on the lower right corner.

6

Search for ATV, select it and click Add.

7

Back in the list, click the Orbit checkbox so that its trajectory is easy to see.

8

You can now close all configuration windows, and enable Satellites view in the bottom toolbar.

9

Navigate to the time you want, and here it is!

10

You can find when the ATV-4 passes over you on heavens-above.com or NASA Spaceflight website.

Clear skies!

T-shirts and other things for wannabe astronauts

Monday, May 6th, 2013

I prepared, as a surprise for my space-fan child Paul, a T-shirt featuring the ISS – International Space Station.

The International Space Station on a toddler T-shirt

While I was at it, I took a bit more time and decided to make more, maybe some people will like it. So there are various ISS T-shirts, some Soyuz-based T-shirts, and some gadgets.

A Soyuz spacecraft T-shirt

I made a “My other ride is a Soyuz (I wish)” bumper sticker and will get one for my scooter :) I also made a version without the “I wish”. I would love to see it on a real astronaut’s car. Who knows!

My other ride is a Soyuz

All of these are available on this Astrothingies Cafepress shop.

Panorama, Hugin, Stellarium and three.js: Creating equirectangular panos

Sunday, December 30th, 2012

It’s been a long time since I didn’t post any geek stuff here, so here we go. At last!

I’ve recently installed Stellarium, which is a great planetarium software, helping a lot to figure out what’s above our heads at a given time, what will be, or what has been, which is great  to learn the sky, figure out what will be enjoyable on the next clear night, or what that was the other day.

Stellarium has a nice feature that allows users to use their own landscape instead of the predefined ones. The predefined ones are nice, but they don’t really reflect reality for me, because I’m usually in my little garden, surrounded by walls and trees and other view-blockers. So I decided to make a landscape of “my garden” and went out and took pictures, rotating about myself.

360° worth of garden

I then imported all these pictures into Hugin, another great free software that helps stitching panoramas. Some years ago, the process was long and painful, filled with control points settings, corrections and this kind of things.

Nowadays, you can launch Hugin, click Load images…, select them, click Align…, wait, and click Create Panorama…, and wait. This thing just rocks and does everything by itself.

Here’s the Fast Panorama Preview window that Hugin opens after you click on Align, showing the result of its calculations. Most likely, you can just close that window and proceed with Create Panorama.

panorama

Now that you have a 100MB TIF file containing your 360° equirectangular panorama, you can open it with the Gimp to fix some of the details that Stellarium wants right. First, make sure that the image ratio is 2/1, and that both dimensions are a power of 2. (4096 pixels wide by 2048 high, for example). The ratio is for the panorama to look right, and the power of 2 is an OpenGL rendering requisite.

Last but not least as you’ll want to see stars in the sky, you have to remove the sky from your panorama. The best is to take the picture with a clear sky so that the sky’s colour is homogeneous. I’ve used the Gimp’s Select by Color tool, which is much greater than the Fuzzy Select tool for that job because it will also select the isolated sky pixels inside a tree’s branches, for example. In case some of the rest of the picture is sky-coloured too, just exclude these bits from the selection (using Ctrl + any other Select tool). When your selection’s right, make sure you have an alpha channel on your image (Layer/Transparency/Add alpha channel if it’s not already grayed out), then get rid of your selected sky (using Cut or the Delete key, for example). Here’s the result :

Panorama in Gimp

(You’ll see that the ground is bad, that’s because my original pictures didn’t include enough ground. Also, I cheated with some tree tops, because my original pictures didn’t include enough sky).

There just remains to export the file, and create Stellarium’s landscape.ini file, as described on their wiki. I suggest you use their Moon landscape’s landscape.ini file as a basis. The only information you need to have is your latitude, longitude and elevation, which you’ll get out of any smartphone, GPS or Google Maps; and the angle to use to point North in your landscape, calculated this way.

Aaaand, here we are in Stellarium, showing the perfect International Space Station transit that could have been observed on the 28th here (you can know when and where to look for the ISS easily, with NASA’s Spot The Station service or loads of smartphones apps):

stellarium

(Of course, it’s after sunset but you can still see it). The end result is not downloadable because it’s too big (45MB).

Added bonus

You can also export these panoramas to be viewable in HTML-5 compatible browsers, using the nice three.js library. Here it is (with a fake sky re-added) :

[iframe src=”/panos/jardin.jpg” width=”500″ height=”250″]

Use Right-click/This Frame/Show only this frame inside the image, then View source if you want to try that at home.

news for few, stuff no-one cares about