[Bas BotBerg] wanted to use a portable Bluetooth thermal printer to run off reports on sensor data collected by an ESP32-C3 microcontroller. But as is so often the case these days, the only official way to interface with the printer was through a proprietary smartphone application provided by the manufacturer. With no documentation on how the thing works, he set out to reverse engineer the printerβs communications protocol so he could control it from the MCU β but the route he took to get there was a bit different than what we usually see, and is an excellent case study for those who might have similar projects in mind.
The standard procedure for something like this, if it can be called that, is to use Androidβs built-in debugging capability to log Bluetooth communications while running the manufacturerβs application. The resulting file can be fed into Wireshark, and with patience and some educated guesses, you can usually work out the various commands and values that get passed to the hardware.
But in this case, [Bas BotBerg] ignored the manufacturerβs software and instead used an application that can query a device and list its Bluetooth Low Energy services and characteristics. Specifically, he looks for services that are marked as writable, and starts pushing data into them to see how the printer responds. For this he uses Python with the Bleak library, as it allows him to rapidly iterate and adapt his code. After a bit of poking and experimentation, he finds the proper incantation to get the printerβs motor to kick on an advance the paper β a critical first milestone that tells him heβs on the right path.
Once [Bas BotBerg] mapped out what data needed to be sent to what endpoints to operate the printer in Python, it was a relatively straightforward process to send those same payloads using C++ code on the ESP32. For extra style points he also brought in the Adafruit GFX library so he could produce icons and more easily format the output of the printer.
A few weeks ago, my wife was out walking the dog, and she sent me four or five photos of small orange boxes planted all around our neighborhood. (OK, Iβll bite!) They had little cards on them explaining that they were geophones, and a QR code on them that lead to a website with all the details. Munich was getting a large-scale seismic survey to map out our underground water, with the aim of using it for geothermal heat and power in the near future.
How do you map up to five kilometers under the earth? You pound the ground, sending shockwaves downward, and then listen for their reflections. At the boundaries between different layers, the change in the speed of sound in the different media cause reflections. Calculating the time it took for a given reflection to reach you lets you figure out how deep the layer boundary is.
The seismic survey procedure goes like this: geophones are set out at roughly 20 m intervals in lines spaced around 300 m apart that run roughly north-south, while βvibrotrucksβ drive a roughly east-west course, creating mini-earthquakes every 20 meters along the way. Covering a surface of 1,000 km^2 with over 120,000 sample locations and exciting them 86,000 times is going to take a while. Lucky for me, they started in my part of town.
Hot Water
Because the earth is essentially a ball of hot molten metal with a thin and crispy outer crust, and because there is radioactive decay going on even within the crusty bit, temperatures rise as you dig down: roughly 30 Β°C per kilometer. And Munich has this fantastic source of water thatβs folded under the earth in a layer that dates back to the Jurassic, which makes it both low in dissolved minerals and sitting just around 3 km down: at 100 Β°C. This turns out to be the sweet spot in terms of difficulty of drilling and heat gained from doing so.
Blessed with hot water underground, the question is how to best use it. The plan at the moment is to situate a number of geothermal plants around the city, drill relatively large bore holes at each site that reach down 1 km to 2 km, and then drill diagonally down after that to spider out into a larger source of water. This βextended reach drillingβ pulls from a larger heat source, prevents cool spots, and has only recently become technologically feasible.
Which brings us to the GIGA-M study. A 3D map of the underground will help plan out where to put the geothermal plants, in which directions the runners will need to be drilled, and generally how to best coordinate the resource. There were a number of individual smaller surveys done over the last 20 years, and Munich and the surroundings already have a number of geothermal plants, but this survey aims to fill in all of the gaps.
The Hunter and His Prey
It was a Thursday morning when my wife thought she heard some pounding and humming outside. She was wrong, but it got us to look at the online map, and while they werenβt in our neighborhood just yet, they were probably within easy driving distance. I threw my camera and tripod in the car and headed out.
The Big Vibrotrucks
Out in the country, just outside of Grossdingharting (you canβt make these names up!) I spotted a plume of dust rising up from a field. Was it just a farmer tilling? Or was it a vibrotruck? I drove through the woods on a logging road, and when I came out, I was nearly face-to-face with the beasts.
They were loud, and I felt the rumble when I stepped out of the car, so I ran up and asked if I could film it. They said βsureβ, and I set up the tripod. The first video I shot, apparently I hadnβt screwed the camera down hard enough in the tripod, and it vibrated loose. So I ran another 20 m further and tightened everything down.
Iβm not going to lie: it was exceedingly loud and very exciting. I drove back home and couldnβt wait to review the footage.
The next morning, I heard the same sound outside my own house. They were driving vibrotrucks around in the field about a block up the street. I grabbed the camera and ran out barefoot to get footage. And then Saturday morning, while cooking blueberry pancakes for the family, they drove up my street. Am I stalking the vibrotrucks, or are they stalking me?
An engineer asked if they could stand in our front yard, so I took my chance to bombard him with questions. He seemed stoked to talk about it.
Geophones and Vibrotrucks
When you stand next to one of these things, first it shakes, and then you can hear a bassy tone, and then it rises and stops. Theyβre obviously doing a frequency sweep, much like you would use a sonar chirp to help disentangle the multiple reflections from one another.
The sweep means that even if they receive two reflections at once, they will hear two different pitches because one signal traveled further than the other, and comes from the earlier, lower-pitch part of the impulse. It also makes for a very easy to find signature. Correlating these times of flight across the entire array of geophones gives a 3D map of the underground layer discontinuities.
You can see from a cleaned up version of the audio that theyβre sweeping from something like 6 Hz up to maybe 96 Hz.Β The lower end sounds like distinct hammering, and the top end a humming. Here is another video, with filtered audio. Because you feel the vibrations through your feet and in your chest, the live experience is a little bit like this with more noise. Play on good headphones or with a subwoofer for maximum effect.
Of course, the time of flight matters. I asked if each geohpone had a GPS timebase, and the friendly engineer told me that they individual geophones donβt β too expensive β but that when they install one, they connect it to a laptop with GPS that records the location and sets the geophoneβs clock. When they harvest them, they record the location again, dump the time to verify that the clocks havenβt drifted too much, and then pull down all of the recorded timestamped data.
Why do they drive around in pairs? Itβs simply because they make twice the vibration. The two trucks are actually synced together in phase, so they emit as one. The trucks have a GPS-disciplined clock inside, so they know exactly when they start each cycle and can derive the time-of-flight to all of the receiving geophones. The rest is math.
He also mentioned that it was too bad that I only got to experience the smaller βurbanβ vibrotrucks like the one outside my house. I kept my mouth shut β nobody needs to know that Iβm a vibrotruck stalker.