All posts by Nighthawk

DHT22 (Temperature and Humidity) Aggregators

Been running this circuit and server DHT22 aggregator since May 2022.
Basically this is a client (actually a server – ESP32 REST respond server), and a windows server (that calls the ESP32 server every interval, and aggregates the data into a sqlite3 small db).
Win Server as can be seen on the screen shot, displays compared data of temperature/humidity of the last four days – graph x-temperature y-time_of_day.

Technical details:

  • Win Server is a Delphi VCL Win32 application using TChart for the charts plot.
    In addition I’ve coded that the app taskbar icon, will light in RED when no connection can be made to the defined address.
  • ESP32 chip Server is an espressif-IDF SDK,. C code,. ESP32 is simply connected GPIO to the DHT22 sensor (as can be seen on the chip wired image).
    In addition I’ve connected a red led light, that is turned on, when no connection is done for defined interval to the ESP32 server.
    Calls to the ESP32 server are replied structured in very simple REST JSON record format.
DHT22 Windows server aggregator screenshot
DHT22 ESP32 server aggregator screenshot

Wrote a small app, that takes all my aggregated Temperature data and displays it on a scale of PI per day,. according to the temperature every period of time.
Total 148 days,. total 2.4m records (probed every 5sec – on a sqlite3 db).
It scales from the color red when the temperature was about 24.9c — to the green/black (which is kinda these days) when temperature is about 29c~30c.

Delphi iOS Client Push Notification setup

Apple APNs iOS Client with Delphi 10.3+~

Prolog: A Lot is written how to implement APNs in various languages. I didn’t find, though proper one stop to learn how to implement APNs via IDERA’s Delphi. Basically, a main task with this procedure is with dealing with Apple Certifications (which is widely documented over many guides and sites).

Eventually you’d have to forge these files:

  • CertificateSigningRequest.certSigningRequest – to request a certification from Apple Services
  • Go to in Apple Developer Certification Web Console – to the AppID Identifier, and the Push Notification Capability – use the .csr to request a – And download .cer file.

    • Development SSL Certificate or
    • Production SSL Certificate
  • Use the aps_production_cert.cer – The Certification which needs to be installed in your Mac OS
    • clicking the ‘.cer’ file will add it to ‘My Certifications’ under the ‘Keys Chain’ – (Important this should appear on the ‘My Certifications’ if it isn’t there file won’t be able to get exported as a .p12)
  • Certificates.p12 – exporting the Push Certification as ‘.p12’
  • Certificates.pem – convert the ‘.p12’ file to ‘.pem’ file using openssl command:
    • openssl pkcs12 -in Certificates.p12 -out Certificates.pem -nodes
  • entrust_root_certification_authority.pem – The Apple CA (it can be downloaded from
  • To test that I used the .php object (basically you can code a server using Delphi as well… but I tested that with this .php server object) from

We are using in Delphi the TMessageManager.DefaultManager class to register for various messages from the iOS APN service. Such as when registration and receiving from the system the Device TokenID. Or when this procedure fails.. http://docwiki.embarcadero.com/Libraries/Sydney/en/System.Messaging.TMessageManager.SubscribeToMessage

And using the TiosHelper.SharedApplication to obtain the UIApplication and register the client iOS device for notifications using registerUserNotificationSettings(..); and registerForRemoteNotifications(); These procedures respond with a MessageData containing the unique device token.

uses
  // :
  FMX.Platform.iOS, System.Messaging, FMX.Platform,
  iosapi.Helpers, iOSapi.Foundation, FMX.Helpers.iOS, iOSapi.UIKit;

procedure TForm2.LogMsg(Value: String);
begin
  edtLog.Lines.Add(Value);
end;

procedure TForm2.RegisterNotificationClick(Sender: TObject);
var
  types: UIUserNotificationSettings;
begin
  // The token obtained from the TPushDeviceTokenMessage event should be used to identify the iOS client and send notifications to it
  TMessageManager.DefaultManager.SubscribeToMessage(
    TPushDeviceTokenMessage,  procedure(const Sender: TObject; const M: TMessage)
      begin LogMsg('TPushDeviceTokenMessage: ' + (M as TMessage<tpushdevicetokendata>).Value.Token); end);

  TMessageManager.DefaultManager.SubscribeToMessage(
    TPushFailToRegisterMessage, procedure(const Sender: TObject; const M: TMessage)
      begin LogMsg('TPushFailToRegisterMessage: ' + (M as TMessage<tpushfailtoregisterdata>).Value.ErrorMessage); end);

  TMessageManager.DefaultManager.SubscribeToMessage(
    TPushRemoteNotificationMessage, procedure(const Sender: TObject; const M: TMessage)
      begin LogMsg('TPushRemoteNotificationMessage: ' + (M as TMessage<tpushnotificationdata>).Value.Notification); end);

  TMessageManager.DefaultManager.SubscribeToMessage(
    TPushStartupNotificationMessage, procedure(const Sender: TObject; const M: TMessage)
      begin LogMsg('TPushStartupNotificationMessage: ' + (M as TMessage<tpushnotificationdata>).Value.Notification); end);

  types := TUIUserNotificationSettings.Wrap(TUIUserNotificationSettings.OCClass.settingsForTypes(
    UIUserNotificationTypeBadge or UIUserNotificationTypeSound or UIUserNotificationTypeAlert, nil));

  TiosHelper.SharedApplication.registerUserNotificationSettings(types);

  TiosHelper.SharedApplication.registerForRemoteNotifications();

  LogMsg('TiOSHelper.SharedApplication.registerForRemoteNotifications;');
end;

Objects Indexing – Image Processing

I wrote a short draft of an idea for a mobile multiplayer game. Writing that raised an idea of algorithm which would be required in different applications when processing an image and deconstructing it  into separated objects:

Scenario description:

Imaging you got a picture which you would like to know where each object is indexed in this big image. (For example, a picture where a collection of people holds their mobile device,. and an application should ‘know’ who is behind each one of the mobiles — and index it accordingly in the big picture).

Each person holds his device, and in front of this group of people, stands the ‘server’ device, which is required to picture this group, and index (or moreover, communicate to each index accordingly)..

Of course solving that could be done easily if you got the big picture. Yet, for some reason I thought of another complex (or easy way). If each person is holding his device,. and all devices are connected to the server — the server can communicate to each index by identifying it — initially — index it, and then send each participant the required data.

  • I thought of an art work, where this group of people and mobile devices, could function as a live ‘Music Scope’…
  • or, think of a stadium where each person holds his device,. and then the server, runs a live mosaic picture, where each mobile screen takes part of this image.

Code archaeologist

As a obsessive code collector,. form an early age. Today as I didn’t sleep all night. I decided to  sort the old floppies I still had, and arrange my old basic programs.

I can not tell from what year it is, cause on those days programs were brand new, and even the GWBASIC we had those days didn’t save the datetime of the creation of the file (or was it the old DOS, can not remember exactly). It was from the late 80ies — something like 1987~1989…

Anyhow, had to create an Oracle VirtualBox of DOS6.22 — and create an .iso disk associated with it containing my old basic code. Due to the fact, as I said, that I am a collector of software, GWBASIC was at hand.

Had to ‘LOAD”…”‘ and ‘SAVE”….”,A’ all about 60 code programs. This command loads the GWBASIC code (which was then, stored in a binary form on the file structor). And ReSave it using the ‘,A’ flag, which mean save as ASCII.

I went back then from learning basic, then c, and then pascal and cpp. So I had some C and Old Pascal code stored as well.

This is what I call ‘Code archaeologist digging…’

BOINC back

The last time I ran the BOINC engine was in 2007. Now I’ve started running it again. BOINC is a Berkeley application manager for distributed computing. To describe the process very shortly you take a big task, cut it to small chunks, send each client at the end this chunk to be processed by him.

Usually many science related or research in a given topic, produce huge amount of digital data. Yet, in order to process that in a reasonable time, you can use this type of computing.

When BOINC initially running boinc, you can choose from a variety of projects to run from health related application, to cosmological projects.

Now-a-days when the mobile was introduced, there have been some applications for mobile (that does the same process) released for the public (i.e., BBC article on the subject)

Thing is that since the last time I ran it,. they have now added a procedure where a Virtual Machine is attached to a given project you run on the system (in our case they used the open sourced Oracle Virtual Box) — enabling the tasks to be ran on a given light version of Linux machine…

Here is a fast summary of the path it takes (after all initialization of the software has been done):

BOINC download a chunk of data –>
a VM is being ran by BOINC –>
procedures are being processed under that VM –>
Results are sent to the server back

Which is really cool seeing and understanding that,.

You can configure the system to be ran while in idle mode, on a screen saver (which shows a related data plot of the given project).. for example, if you run a ‘Quake Identification Project’ it shows you the globes with the different variable which are processed on your machine.

If you got a machine and would like to contribute to this processing power.. check the links I’ve gave in this article. That way you would know you are truly assisting to science  and our globe space ship…

Perspective of life – the fifth decade – by Nighthawk

It suddenly came to my brain, a reasonable explanation of this Human race acts, that we all participate in. I came up with these insights, whether they apply just to me, or you might find it useful as just another view point of life – that would impact in some way your way of thinking and view.

On past decades, I participated in this hectic race to the way up… I had a proper job, which I liked… and had a very tight social life (not as wild as other people got, but something reasonable).

Then on the forth decade of my being, I suddenly had a ‘life bump’ which halted all that I was doing before. And stopped the routine I had – almost making me reach a stop still place, it wasn’t a physical stop still – it was mental stop still.

 Subjective feeling of talk time:

Today, as I was listening to several different radio shows… It knowledge has impacted me. While each show was about an hour, one show seems to be shorter than the other one… it made me think, then I finally got that; people that do not have time to their selves, and are in a complete battle with life, would extended talks would somewhat sound shorter, than people who are at peace with life – and would like to share their moments with others.

It wasn’t the first time, I felt that.. Sometimes people who I talked with although talking to different people the same absolute time, would feel to some longer, and to other shorter.

Of course, all people like to share… yet, some people got their personal goals, which doesn’t match yours. And would like to benefit from these talks. And manipulate you into thinking this way or the other.

Another important thing is that when one have common shared knowledge, for example if you are an expert in this or that area,. And the other side, would like, know, or interested in the subject at hands subjective time passes slower… enabling one to celebrate the sharing and talk.

To sum this view, people who do not have time for themselves, or to other – why would someone have time to even hear what they want to say. People who are at peace with themselves, and with others would impact ones soul much more.

Jobs and the social disruption:

On prior decades, I was in a race, I didn’t have time! I was always ran after things to accomplish… And although from now and then, I stopped to hear I didn’t listen much.

Any job which require both sides to stop and think, and accomplish a creation – or a solution to a given problem – doesn’t just disrupt — it creates. It slows the whole system a little… because it requires attention from the people who accomplish it.

One shouldn’t take that as ‘Hay you are slowing me down..’ but as ‘ok, that requires a creation…’ – which is a task to make which benefit the larger society – to enjoy later – in whatever area it concerns.

Learn:

It doesn’t matter what you learn, as long as it benefit the bigger picture. It doesn’t matter either how you learn… You can watch a movie or listen to music, and learn while enjoying yourself.. come up with different conclusions – and make you think in the process.

Enlarging your common knowledge is always a good thing. It is better to hear and understand things, that just run in circles. Same basic ground would benefit the bigger picture…

Do not come up to hasty conclusions:

Somethings, things look wrong, crazy or without any meaning… only after a given time – things would fit into the bigger picture. And would look synergetic with their environment.

Enjoy life:

Whatever subjective way you like to enjoy and celebrate life, is good. As long as it doesn’t hurt anyone. One can find even very simple routine procedure enjoyable at times. When you invest in your joy, and expertise, to tend to share the solutions or knowledge in a much more tender way… and not being uptight with time, and life.

Time expansion and contraction;

I got this notion, that time is a continuing present. I’ll try to explain the picture I got in my mind. Imaging a painting – where like a fractal as deeper as you get in some placing in the fractal the more complex, and the more you can zoom in…

I see this in every sense we have as humans.

Visual: You are being found in a certain place, yet you can take a telescope or microscope and view inwards or outwards.

Audio: A sound wave is being transmitted in air… yet, you can always (again) zoom inwards (hear faster) then the sound expands or zoom outwards (hear slower) then things seems to sound shorter.

Sense of time: when talking about time, it is only speculations cause no human, has become a supper-human (as far as I know) and expand his consciousness out of the four dimensions we live in… When being in the present it is a part of a future picture we got in our minds, and a past (personal and cultural) history that we remember… and given moment from the present is a creation of the mind… Yet, if we somehow take our mind backwards – we can experience a rebirth of childhood, thus making the next moment a brand new one. This image is somewhat what I am trying to show (taken from the Minkowski space definition);

What made me wonder, about what happens in the mind, as I said before (I think in this past blog) any plot creates links in our mind, saying that, and following the sense of time paragraph above… When something become from past to future – when is our mind grasp the notion read or viewed (and become a part of the mind), or moreover, when is the moment we believe something… Of course believing is very subjective, there are people who believe their eyes, ears, and body – and on the other end — there are those who casts doubt on all their senses.

MIDI audio software

I managed to install my old MIDI connector to my Win8.1 machine. Unfortunately the old drivers do not support very well this legacy hardware, so there are problems such as disconnection from the MIDI device… it enables some sort of use for a short while.

Anyhow, wanted to note, this wiki Comparison of MIDI editors and sequencers. The vast amount of software that is available any given time to solve or use is great.

Found there this Linux MultiMedia Studio which got a cross platform (windows/linux) support. It is a very easy to use, and multifunctional application. Composing audio, and using that with an attached MIDI device, have never been easier.

I am not an expert in audio composing, yet the ease of creating, for example, a sample audio file — and then pitch it and create a full lengthy composting from it is tempting to give that a try.

Playing Stories

I believe that any scene (story) is a reality..
Whether it is played on reality itself,
whether it is in a show or a movie,
whether it is playing in a computer game,
whether it is virtually preformed as text or movie,
whether it is written as text in a book.

Thing is what do the actors think?, do they got an audience? (or in case there is none, do they know they haven’t got an audience?) [If a tree…], what are the feelings they endorse in the scene itself…? How does the scene effects them after they finish playing them? how does a scene effects its viewers/reader/players?

Can a person entail within him in the same time/space, multiple feelings (or multiple personalities, where the same time/space can be interpretate in totally different ways — by one act at a time — and later can be viewed only in these ways (one by one) that were meant to produce that scene).

On one of the podcasts I am listening to, they presented people that have extraordinary memory (in a condition called – Hyperthymesia – highly superior autobiographical memory) and can tell any little detail that have occurred in their lifetime. The focus of the podcast was a person that could tell any detail about a fiction basketball team that he has invented (imagined), where he preformed (imaginary) that team history… (Due to the fact that he got hyperthymesia) He could explain each player full history of childhood, and tales… Yet, all these were played only in his memory. But they were real as any other team… The details he gave were consistence, and he would tell the same exact details even after a couple of years, when being asked..

The latter paragraph example is real as any other performance… Although it is just an invention, and is only in his memory. who can say what is real or not?

If I were to say that a future being could project his future back to the past…? Is that real? What is the difference between these realities and any other….?

I recently thought about an idea that would rate each person and news clip… By a collection of people… Yet, even if a huge collection of people would rate something, does it make the rate valid? It would only create a certain index. The attitude toward this index is in the eye of the beholder… Like any other science or story told.

Another idea comes to mind, do a certain attitude towards something, hold any mass? Except being virtual and a feeling toward an event.