Erwin Ried's Blog

1.5M ratings
277k ratings

See, that’s what the app is perfect for.

Sounds perfect Wahhhh, I don’t wanna

A cool calculator challenge: Triconcours Universel

The guys in tiplanet.org always create very clever contests around calculators and this year they did it again. And I feel very connected to the calculators, so I had to attempt to solve their challenges:

image

The challenge this year is composed of three stages: Wisdom, Strength and Courage. An extra challenge around all them is translating the instructions from French.

Wisdom (Sagesse)

Didn’t had a clue with this one. It required additional effort from my side to understand the garbled google translation. So I just skipped this one.

Strength (Force)

From what I can say from the description indicates that you control 30 potentiometers with weird interconnections, with the goal of lighting the maximum amount of lights. Playing the game in your calculator goes like this:

  1. Run the app
  2. Type pot(number,value)
  3. See results/score
  4. Go to step 2

Of course it goes really slow. So the optimal solution is descramble the app code to understand the function they are using… but this is a lot of work! so I just decided to use bruteforce, starting with a random seed and iterating per potentiometer in increments of 1/34:

image

The script dumps the best combinations as .txt files. It was very exciting to check the new scores every morning. Like scratching a lottery ticket.

This is also slow, but is not THAT slow if you use multiples machines with multiple instances of the script running. You can even use your cluster made of old laptops that nobody wants in your office, laptops in beautiful racks made of cardboard:

image

My score was not the best or near the first places, in fact was #6, but I had a lot of fun. Next time I will try to use less brute-force.

Courage 

The description talks about our hero in a cloud having to visit spots in a map keeping the score as maximum possible. At first, it was difficult to understand, but you basically have a polar function that you modify with parameters and you have to go between specific points while completing the route.

I started analyzing the positions of the layout with a Travelling Sales man Problem solver:

image

But, then you have to restrict your solution to what is possible. Playing the game goes like this:

  1. Open the app
  2. Press Symb and enter a list
  3. See the updated map and score
  4. Press Symb again and modify the list
  5. Go to step 3

Some of the steps are quite slow, using the Calculator editor for lists is a pain, the brackets try to be smart, you have to copy the old list and change the ending of it to try different outcomes, etc. 

So what was my solution this time?

A modified version of PrimeMon that also executed the code after you saved it in the HP Connectivity Kit. So you could have the list you were trying to edit and every time you hit Save, the HP Prime Virtual Calculator displayed the results instantly. 

PrimeMon is a little tool that I wrote years ago, after PrimeComm (a much more complete toolset for the HP Prime) stopped working, that allows you to interface with the Virtual Prime for checking if you have syntax errors easily. This just exists because the HP Connectivity Kit editor is very primitive and does not check anything.

Using this little tool I was able to have a pleasant puzzle-like experience while watching a movie. 

image

My score was again really poor, #10. But again, I had a lot of fun!

If I had to do it again, I would have coded a small routine to solve it in the calculator itself. That new modified app would wait for a screen tap and try to add elements (i.e. testing a range from -10 to 10) to the list keeping the distance as the minimum possible and stopping when is in radius of the tapped point.

Conclusions

Even when my solutions were lazy and poorly executed, I think this is the real nature behind the love for the calculators. Having doses of entertainment in a restricted environment. 

It is so special to be in 2018 and still have contest like these french ones. I am happy for that today.

calculator hp texas instruments casio

Recording and replaying Flysky’s PPM channels

I want to remotely control a drone from a PC but the cable I ordered for my cheap Flysky i6X remote was only for updating the firmware and the cable for using a simulator is 1-way only. The PC cannot send anything to the remote.

Knowing that Student/Trainer mode should require a bidirectional communication, I disassembled the PS2 style cable and rewired it to expose all the pins: https://www.thingiverse.com/thing:3187047

The remote generate and receive _PPM _signals. If you have used an Arduino, you probably know about PWM. As you see in the image, this time we need to measure the pulse length, not the percent of the pulse that the signal was kept HIGH. For this, we just use an interruption triggering this function:

// Received pulses
void ppmPulse() {
  p = micros() - lastMs;

  if (p > betweenChannelDelay)
    if (p > betweenPacket)
      currentChannelReceived = 0;
    else
    {
      channelReceived[currentChannelReceived % totalChannels] = p - 10;
      currentChannelReceived++;
    }

  lastMs = micros();
}

The full code is here: https://github.com/eried/Research/blob/master/FlySky/PPMReadWrite/PPMReadWrite.ino

Having that, you can write a simple program to record and replay: https://github.com/eried/Research/blob/master/FlySky/PyRecorder/replay.py

arduino flysky fpv drone

Wonderful Korean mini spot welder

For a long time I wanted a spot welder, but was not very excited by the bulky chinese ones. Finally I found a Korean guy selling a very cool one: https://m.blog.naver.com/aulakiria/220992039512

Aulakiria offers different packs. I ordered the full kit with soldering iron because you always need a portable iron by the way.

image

The device is awesome! If you have a hard time looking for a 3S lipo with an XT90 for it, I recommend to get one like this and just replace the connector. The package even includes one XT90 connector for that purpose. I recommend you to solder the connector while plugged to another one, because it will be easy to melt the plastic of the connector if not.

Here is a demo of the device working:

As you can see, it is awesome!

The only thing I regret is not having an alternative firmware.

arduino spotweld welder diy

How precise is the ZOZOSUIT?

The implementation of ZOZO with the ZOZOSUIT is a brilliant idea, but can it really measure your body?

ZOZOSUIT is a simple “pijama”-like piece of clothing that clothes maker’s ZOZO send you for free, with the purpose of using their app and your phone camera to get an exact measurement of your body and order clothes from their collection.

There are two types of marker in the suit, a simple round one for neck, end of the extremities and a bigger (with an unique pattern inside) one for the whole body. Your phone camera needs to see the markers to do the measurement. The whole process needs 12 photos, one photo every 30 degrees of rotation.

The app and website access to the results of the scan using the following Request URL:

image

They retrieve a json with values of your measurements in mm and your body scan. You can rebuild the mesh easily:

# Creating the stl file

vertices = np.array(j["result"]["dimensions"]["vertices"])
faces = np.array(j["result"]["dimensions"]["faces"])

# Create the mesh
cube = mesh.Mesh(np.zeros(faces.shape[0], dtype=mesh.Mesh.dtype))
for i, f in enumerate(faces):
    for m in range(3):
        cube.vectors[i][m] = vertices[f[m], :]

# Write the mesh
stl = p.with_suffix("").name+".stl"

Check https://github.com/eried/Research/tree/master/Health/Zozo for the whole code.

image

How accurate/precise is that measurement?

Short answer: Is not accurate at all, measurements differ up to +/-10 cm. The precision is something open to discussion because if they can deliver a properly fitting clothes, then you can say they are precise.

Longer answer: I took few measurements and created my watertight meshes. Calculated the volume and checked the measurements. Then ate a big meal:

I was going to calculate the volume and density of the food and interpolate everything to an standard cud… but the volume of the mesh AFTER eating was lower than before so there was no point on doing anything.

To measure the volume I used MeshLab / Filters / Quality … / Compute Geometric Measures after making the mesh watertight with the Repair mesh function in 3D Builder

Conclusion

You might be able to get perfect fitting clothes, use it for generating a cool mesh of an human, and even do motion tracking for your animations but don’t expect any proper physical/health tracking from the suit.

zozo zozosuit mesh 3dprinting

Moving to Tumblr

I think I will be using this now.

Everything has changed a lot, my personal website started in school as a crappy MS Frontpage site in geocities, using da.ru and later cjb.net free addresses, then to a custom CMS in PHP and in the later stage with Wordpress, but that got too clumsy and “old school”.

I hope this is the final morph. Tumblr looks clean.

image

Most of the old articles in Spanish (from the old blog in http://ried.cl) are available here in http://erwinried.tumblr.com.

PS: I still need to customize the themes and so.

moving tumblr blog