Category Archives: Uncategorized

The Hacky Super Loop Arduino Nano 33 BLE Sense Example You Have Been Waiting For

Update: For even better examples of the non-hacky variety, check out the Nano33BLESensor Library in The Arduino Nano 33 BLE Sense Sensor Library You Have Been Waiting For.

Quick Links

The Arduino Nano 33 BLE Sense was released in July 2019 and was a real step up for Arduino! Using the Arm Cortex-M4F based nRF52840, the Nano 33 BLE’s arrival made the days of Atmel based 8-bit microcontrollers seem numbered. With the proliferation of dirt cheap Arduino clones this was probably the result of Arduino seeing the writing on the wall that keeping it simple was probably not going to bring in the dough anymore. In the end the sheer amounts of fairly useless Arduino projects seem a bit dull these days, and with more complex offerings such as the Nano 33 series, a new era of seriously cool projects may be on the horizon.

A common complaint about the Nano 33 BLE Sense is the lack of working examples available for the board. Only a simple PDM Serial Plotter example exists when you install the board package, and this seems to have caused some confusion among users who were expecting an example to exist that uses all of the available on board sensors. In fact examples do exist for all the on board sensors, however they are available only on the individual sensor library repositories.

Below is a table including each sensor, it’s component name, a brief description, and a link to the example code.

SensorNameDescriptionExample Code Link
IMU LSM9DS1 3 acceleration channels, 3 angular rate channels, 3 magnetic field channels Arduino_LSM9DS1
Microphone MP34DT05PDM omnidirectional digital microphonePDM
IR APDS9960  Gesture, light, proximityArduino_APDS9960
Barometric Pressure LPS22HB  Barometric pressureArduino_LPS22HB
Temperature/Humidity HTS221  Temperature/Humidity Arduino_HTS221

Let’s Be Honest About What We Really Wanted

We wanted a super loop that would read all the values from the sensors and print them on the serial monitor/plotter. We wanted to be able to buy this board, fire it up, and to be able to look cool to all our friends immediately. We didn’t want to have to think. In fact we didn’t want to have to do anything. It did not matter that the actual values would probably be useless, we just wanted it to be there.

Perhaps the reason this super loop example we want is so terrible is because of the fact that the Nano 33 BLE Sense can utilise Mbed OS. Finally, a reasonably performant and relatively deterministic way of arranging our more complex Arduino projects! We can finally bid farewell to the almighty super loop!

Alas, I understand the RTOS can be a new and scary venture for some. And having just got my Nano 33 BLE sense, I decided to create a simple example program that can display all the available sensor data on serial plotter to check with the sensors are at least powered on and outputting semi-meaningful data without any of the BLE functionality.

The Example Project

The repository for nano-33-sense-serial-example can be found here. The data itself might be fairly useless for most applications, as it is mostly raw digital values pulled straight from the sensors which need to be converted to useful metrics before being meaningful. It plots the following raw data:

  • x/y/z acceleration data
  • x/y/z gyroscope data
  • x/y/z magnetic data
  • RMS microphone data
  • left/right/up/down gesture data
  • r/g/b light data
  • proximity data
  • Barometric pressure data
  • Temperature/Humidity data

Some of the difficulty in displaying this data in a coherent way is the different sampling frequencies in which sensor data is obtained. The table below shows these sampling frequencies.

Data TypeSampling Frequency
x/y/z acceleration data 109Hz
x/y/z gyroscope data 109Hz
x/y/z magnetic data 20Hz
16mS RMS microphone data 62.5Hz
left/right/up/down gesture data
Undefined
r/g/b light data
Undefined
proximity data
Undefined
Barometric pressure data
On request (1Hz in example)
Temperature/Humidity data On request (1Hz in example)

Because of this, all data is plotted with a frequency of 20Hz in an attempt to display the data in a way where the values will somewhat correlate to each other. There are some simple macro based configuration options available to allow some control over what data is actually outputted.

What the Output Looks Like

All Sensors

IMU Sensor

Gesture/Light/Proximity Sensor

Barometric Pressure Sensor

RMS Microphone Output

Temperature/Humidity Sensor

Conclusion

The nano-33-sense-serial-example is a great way to visualise all of the onboard sensors on the Nano 33 BLE sense. Since writing this example, I have largely replicated this project using Mbed OS in an effort to create a simple, low power alternative that can be used as the base for many projects that use the Nano 33 BLE sense. You can read about it in The Arduino Nano 33 BLE Sense Sensor Library You Have Been Waiting For.

Moving DaleGi in a Slightly New Direction

How time flies!

It has been almost two years now since dalegi.com said “hello world” to the world, and I have had a nice time writing what I have managed to write on the blog! In this time there have almost been 3000 visitors to the site, and that has been just about enough for me to have the motivation to occasionally post about different things. Without a doubt the most popular posts have been about Bosnian Bureaucratic Wonders, however there is also a lot of interest in my post about the PMSA003 pollution sensor, as well as the Parametric Digital Transducer Loudspeaker. It has been a good creative outlet for me as someone who likes to write, but does not get much of a chance to write anything but code these days!

I have noticed lately I have struggled to find the time and motivation to write which might be due to the style I have tried to keep on the blog. This was one of a resource of information, and a portfolio for myself. I have also noticed a lack of motivation to start new personal projects outside of my day job, which really is a shame!

So with this in mind, I have decided to change things up a bit. From here on out I will try to write more in the style of articles belonging to a series. The series might be for a specific project, or maybe a topic in general. I find that this helps to motivate me not only finish projects, but also write more. I am also going to loosen up a bit with the article content and provide content more in the vein of a thought process, discussion, with the occasional bad joke.

So with this being said, here is to moving in slightly different directions!

University Portfolio

Throughout my degree I conducted a variety of assignments as assessments for various courses at RMIT. As a kind of portfolio, I decided to share some of the work here. Do keep in mind a lot of the work shown here was done through group assignments, so not all the work is mine alone. Code and documents are attributed as such when appropriate.

Introduction to Embedded Systems:

  • Sun Tracking unit. A dual axis servo sun tracking unit controlled by an Atmel Atmega32 with code written in assembler,

Wireless Sensor Networks:

Real Time Systems:

Capstone Project:

 

Attempting to Influence the Bosnian Election

Update 10/06/2020: bakiriprijatelji.com has been down for sometime due to me not wanting to pay the domain name fees while the elections are not on. But fret not, it will return!


I am not going to lie, Bosnian elections make me excited. To all the Bosnians reading this, go ahead and roll your eyes, I am well used to a good eye rolling from a Bosnian. But please, let me get others up to speed before I continue to explain what the hell I got up to.

The Background

The Bosnian political system is one of the most complex in the world. With three presidents elected along ethnic lines, four tiers of governance all of which hardly function, the country barely functions in the normal sense that people in Western Europe or even Australia have become accustomed to. With that being said my jokes about Bosnia’s political system functioning better than Australia’s due to the latter having six prime minsters in ten years with the former having only three have never gone down well amongst the local populace to my extreme disappointment.

But enough of my nonsense. There are plenty of articles about the Bosnian elections that include all the details on corruption, blatant vote buying, and rhetoric that includes threats of secession and on a good day, war. So what is this election influencing all about?

Around April of this year, a local released El-Bake and Flappy Fahro. Not only did the games prove popular and go viral quickly, the act of releasing them was a pretty interesting way to get a point across about what the young people of Bosnia think of their political leaders. These games featured none other than current member of the Bosnian tri-presidency Bakir Izetbegović and the Bosnian businessman, party leader, and presidential hopeful Fahrudin Radončić. The word on the street was that Bakir himself was not too pleased about the game, and the fact the creator decided to remain anonymous is probably a little telling as to the risk that activism like this incurs in Bosnia.

Bakir i Prijatelji

Over the course of a few weeks with the help of some other talented individuals and mentors, I conjured up my own version of Bosnian political activism. Bakir i Prijatelji, or Bakir and Friends for you English speaking type folk, was born.

The aim of Bakir i Prijatelji is simple. Shoot your political enemies with your laser eyes, all the while making sure you do not hit political allies. It’s something that is universal among countries. Politics suck. Metaphors reign. And what better metaphor for Bosnian politics than the main players chasing each other down with their laser eyes.

Now obviously I am not Bosnian. I cannot vote in the Bosnian elections and have no right to tell any Bosnian who they should vote for in their election even if they would listen. I know how much Bosnian’s love it when western types come to their country for a few months and get to hear from them how they can make their country a better place. This was not my intention. I thought long and hard about developing a concept that worked along these principles.

The aim of creating Bakir i Prijatelji was to tap in to that brilliant political satire of El-Bake and Flappy Fahro. Political satire is universal and Bosnia is particularly ripe for it. It crosses borders and is shared among cultures. I hope that some people can get some respite from the elections by playing the game, or even just some laughs.

At the time of the elections Bakir i Prijatelji could be found at bakiriprijatelji.com. However it is currently down. But fret not, it will return!

PollutionPi: Project Proposal for an Indicative Air Quality Index Compatible Raspberry Pi Powered Air Quality Station

As a part of my volunteer position working on air pollution issues at CPI Fondacija located in Sarajevo, Bosnia and Herzegovina, I put together a project proposal for the design and prototyping of an inexpensive air quality station. This prototype would have provided the basis for building a network of air quality sensors that can provide indicative air pollution sensing in Sarajevo and other areas of Bosnia and Herzegovina. The aim was two fold. To advocate for action that curbs the severe air quality issues Bosnia and Herzegovina faces, and to provide awareness on how acute the air quality issue is in the region.

Unfortunately the project never went ahead, but I have decided to publish the project proposal here as I believe the project had merit and I did extensive research that I included in the proposal. I also think it is good to use in the sense portfolio as it shows some of my research and project design capabilities.

PollutionPi: An Indicative Air Quality Index Compatible Raspberry Pi Powered Air Quality Station

Hello world!

I have had the idea milling around for a while to write up about some of the various projects I do at university and in my own time, as well find a home for some of the travel related stuff I have written in the past. I suppose the time has come to actually do it. So consider it done.