Category Archives: Electronics

A High Speed High Current LED Driver; Refurbishing ACMI’s Zoetrope

One of the more popular exhibits in Screen Worlds at the ACMI is The Zoetrope. Like all exhibits inside of Screen Worlds, the Zoetrope has not aged gracefully due to over 9 years of active service! With the original design utilising xenon based strobe lights, the maintenance cost of this exhibit in man hours and replacement lamps was significant. Eventually it was decided to refurbish The Zoetrope with a new LED based lighting system to reduce these costs, which was easier said than done! At the conclusion of the refurbishment a custom high speed, high current LED driver circuit and PCB was designed. Many were assembled and custom LED bars driven by these LED drivers replaced the old xenon strobe lights resulting in significant cost savings!

The Zoetrope Throughout Time

The Zoetrope. Source: ACMI

Zoetrope type devices were originally created in the 18th Century, however the technology used to produce a zoetrope like effect in modern museums has evolved significantly. By utilising an electric motor, 3D printed models, and strobing xenon based lights, a 3D real life animation like effect is realised!

However this mix of technology proved to be problematic. Due to the 8 hour a day, 7 day a week running schedule, at least one xenon lamp blew every week or two.  On average, replacing one these lamps took a technician 30 minutes to complete due to accessibility issues. Now 10+ years ago xenon strobe lighting was all the rage, however the ability to buy replacement lamps for these lighting devices has become increasing difficult due to the rise of the LED.

The Specifications

The control signal that drove the xenon strobe lights was a simple pulse, with a high value indicating the strobe light should be on, and a low value indicating the light should be off. This control signal came from a microprocessor with a series of connected sensors and these sensors detected when a lighting pulse should occur. The voltage output of this signal was approximately 10V peak-to-peak, an odd value that was likely chosen due to the internal circuitry of the xenon strobe lights used in the exhibit.

This control signal pulse had an on time of 4ms, and an off time of 54ms. This meant that the total cycle time was around 17.2Hz, with a duty cycle of around 6.8%. Now these requirements might not sound that stringent, with many LED strobes on the market being able to fulfill this criteria. However due to the type of control signal being used, the exhibit’s necessity on absolute synchronisation of the various elements, and the fact that DMX based lighting having a refresh period of only 44Hz (compared to what would be a minimum refresh period of 250Hz due to the 4ms on time), an off-the-shelf strobe lighting solution was quickly disregarded.

Due to this, whatever LED driver circuitry that was chosen had to be able to handle a 10V control signal, be able to sink over 1 amp of current for small periods of time, and have a rise time significantly less than 4ms. A variety of off-the-shelve Luxdrive LED drivers initially looked promising such as the FlexBlock series due to their ability to handle 10V strobed control signals and sink significant current, however when tested the output rise time of <2ms proved problematic. Dim output was observed and this option was also discarded. It was then decided to design a custom LED driver and LED Bar.

The Custom LED Bars

One of 12 constructed LED Bars.

To ensure enough light was produced, each custom LED bar consisted of six Cree XP-E2 LED stars for a total of eighteen individual LEDs. Pairs of LED stars are wired in series. Due to the forward voltage of roughly 2.9V, each series pair was driven with a 24V power supply. Each Pair of LED stars required it’s own driver box. In total 72 individual Cree XP-E2 LED stars were attached to 12 separate bars with thermal glue. A frosted optic was also used to focus the light with a tight beam pattern on the exhibit.

It should be noted that the LED bars did not have sufficient heat sinking capacity to to remain illuminated for a significant period of time and get truly hot when left on without pulsing!

The Custom LED Driver

The LED Driver circuit schematic.

The LED driver circuit was heavily influenced off the circuit found here. A 4N25M optocoupler was used to isolate the driver circuit from the control circuit, to buffer the control signal, and to provide the MOSFET with a sufficient input signal to fully turn the MOSFET on. The 1 ohm sense resistors connected in parallel were of the high wattage variety (5W+), as quite a lot of current is dissipated through them, making this not the most efficient design.  An output current of approximately 900mA was observed in series with the connected LEDs when the optocoupler was driven with a 10V input signal. Although if you decide to build this yourself, be sure to test this as small component variances may lead to an output current that destroys your LEDs!

One of the contructed LED driver boxes.

A custom PCB for the circuit was also designed and manufactured. It was found that no heat sinking of the MOSFET was required provided the duty cycle remained less than 10% with a cycle frequency of 17.2%. While this does not protect the driver from a control signal failure, it was deemed that this was unlikely to occur within the exhibit.

The Installation

The Zoetrope lighting before refurbishment. Source: here

The Zoetrope after refurbishment.

The LED bars were hung from the roof of the exhibit, and the LED driver boxes were connected to there respective LED bars. The control signal was wired in parallel to all driver boxes.

Setup diagram for LED bars and LED drivers.

Conclusion

While the challenge of refurbishing The Zoetrope was somewhat niche, the resulting design for a isolated high speed, high current LED driver is a useful one to have created. While the driver boxes are not the most efficient devices, they can never the less sink a lot of current with a very short rise time. This solution is something that is difficult to find off-the-shelf, and the relative simplicity of the circuit makes it something that is easy to construct in small runs for many applications.

 

The Parametric Digital Transducer Array Loudspeaker

For my capstone project that I completed at RMIT University I conducted a bunch of research into experimental loudspeaker designs such as Digital and Parametric Loudspeaker Arrays. As a result of this project I conceptalised a design for the Parametric Digital Transducer Array Loudspeaker, built a prototype, and validated the design by performing a variety of measurements on it that time and resources would allow.

In the spirit of Open Source, I decided to write up this casual, albeit somewhat tech heavy post explaining the basics of true digital loudspeakers, Parametric Loudspeaker Arrays, and the Parametric Digital Transducer Array Loudspeaker design in contrast to the more conventional loudspeaker designs. If you are really interested in a more comprehensive look at this topic, the final report, materials list, images, data, references, and associated code used in the project can be found here.

What is a "Conventional" Loudspeaker?

A moving-coil type loudspeaker with a cone based diaphragm. Source

A conventional loudspeaker is very much like the type of loudspeakers you find in everyday life. They usually utilise various implementations of a moving-coil type design, however also commonly use piezoelectric bimorphs. These designs all achieve the same goal with varying efficiency, frequency response, and total harmonic distortion (THD) levels through the conversion of electrical audio signals into acoustic waves by pushing a diaphragm backwards and forwards.

What is a "Digital" Loudspeaker?

Direct Acoustic Digital-to-Analog Conversion

A digital loudspeaker is a loudspeaker that is capable of performing Direct Acoustic Digital-to-Analog Conversion, or DADAC in its mildly more manageable acronym. DADAC is the process of creating an acoustically decoded sound pressure signal by driving and emitting digital streams through a loudspeaker array, with conversion taking place via acoustic summation. Quite a mouthful, that's for sure! So what does one of these loudspeakers look like, and how exactly is DADAC performed in practice?

Digital Transducer Array Loudspeaker

A few examples of DADAC capable loudspeakers. Source: Direct Acoustic Digital-to-analog Conversion with Digital Transducer Array Loudspeakers

DADAC capable digital loudspeakers come in a variety of topologies, shapes, and sizes, but for relative simplicity's sake I will only detail the One-bit Per Transducer Digital Transducer Array Loudspeaker design, or DTAL.

A visual representation of an eight bit One-bit Per Transducer DTAL performing DADAC.

The One-bit Per Transducer DTAL design works on the principle that each weighted bit in a digital signal is represented by one transducer element. Each transducer element is driven by a signal proportional to its bit weight. This loudspeaker requires an array of transducers that is defined by the bit depth of the digital signal being used. Once these digital pulses are output from the individual transducer elements within the array they recombine in air, reproducing the original digital signal and performing DADAC. This process is made possible by the usage of a bit-spilling operation that converts a digital signal in to multiple one-bit weighted digital signals.

Bit spilled signal example. Top: Double-sided 2 bit signal. Middle: LSB spilled signal. Bottom: MSB spilled signal

Advantages of a "Digital" Loudspeaker?

Compact and thin examples of DADAC capable loudspeakers. Source: Digital sound reconstruction using arrays of CMOS-MEMS microspeakers, Development and Characterization of a Piezoelectrically Actuated MEMS Digital Loudspeaker

It might not look like it from the earlier pictures, but devices that can perform DADAC have the possibility to be smaller, thinner, and more efficient than their conventional counterparts. Due to the arrayed nature of the design, digital loudspeakers have the intrinsic ability to perform beamforming and can potentially steer the direction in which audio is output from the loudspeaker. This beamforming is possible for the entire frequency range of the loudspeaker, not just small segments of the frequency spectrum which is commonly the case when using similar methods in other applications such as cardioid subwoofers.

Disadvantages of a "Digital" Loudspeaker?

Due to the listening path differences that exist between transducer elements, it is impossible to get a perfect summation of all the emitted signals in most listening positions. This results in significant distortion at many listening positions. There are various methods that can be used to reduce this distortion, although without reducing the size of each transducer to sub-centimetre levels, the level of distortion produced struggles to reach the relatively low levels of distortion produced by high quality conventional loudspeakers. One company, Audio Pixels, is currently working on a low cost MEMS digital loudspeaker that is attempting to do just this.

What is a Parametric Loudspeaker Array?

A Parametric Loudspeaker Array, or PLA, is a highly directive loudspeaker that consists of an array of ultrasonic transducers that exploit the nonlinear properties of air to self-demodulate modulated ultrasonic signals with the aim of creating audible sound waves.

Parametric Loudspeaker Array utilising digital processing.

In practice this can be achieved by performing amplitude modulation on an audio signal, and driving transducers directly with the resulting signal. Once the emitted ultrasonic sound waves are a little bit away from the array, they will demodulate and produce a secondary sound beam. This secondary beam will predominantly contain the original audio signal.

This technology has been successfully adopted by companies such as Holosonics, HyperSound, Ultrasonic Audio, and a funded Kickstarter campaign called Sound Lazer.

Advantages of a Parametric Loudspeaker?

Ultrasonic devices such as ultrasonic piezo transducers tend to have narrow directivity patterns, effectively emitting sound waves in well-defined beams. By designing PLAs with such transducers, audio can be output in very precise manner. By using these properties even further, it is possible to produce devices that use beamforming to directly control the direction and dispersion of audio, much in the same way that a DADAC capable loudspeaker can do this.

Disadvantages of a "Parametric" Loudspeaker?

Generally speaker, PLAs produce higher amounts of THD than conventional speakers due to the same non-linear properties of air that allow demodulation in the first place. The amount of THD a PLA produces is highly dependent on the type of modulation scheme that is used. They also suffer from low sound pressure level output, poor efficiency, and poor low frequency response making music playback difficult.

What is a Parametric Digital Transducer Array Loudspeaker?

A Parametric Digital Transducer Array Loudspeaker, or PDTAL, is simply an amalgamation of DTAL and PLA type designs.

Parametric Digital Transducer Array Loudspeaker with beamforming capability diagram.

An digital audio signal is amplitude modulated before being bit-spilled in to different weighted bit streams. These bit streams are then amplified by amplifiers that are weighted according to each bit stream weight. The resulting signals then drive individual or groups of transducers. The digital pulses emitted from these transducers sum in air, reproducing the original amplitude modulated digital signal and performing DADAC. This acoustic wave then demodulates and produce a secondary sound beam which predominantly contains the original audio signal as per the previous PLA design.

Advantages of a Parametric Digital Transducer Array Loudspeaker?

For the same reasons you might want to was a PLA.  Narrow directivity patterns and beamforming capabilities. However there are several advantages of using a PDTAL type design over a PLA design. This includes the usage of digital amplifiers in the amplification stage allowing the elimination of digital-to-analog converters (DACs) in the circuit design, as well as simplified driver amplifier designs. This is significant as a beamforming capable PLA usually requires many DACs and more complicated driving amplifiers. Overall, this reduces system complexity and cost.

Another great benefit of the PDTAL design is the improved low frequency response of the loudspeaker, which I will explain a little further on.

With this being said, the PDTAL suffers some of the same issues as PLA and DTAL type designs. This includes higher THD when compared to conventional loudspeakers which may be considered an acceptable compromise for having a narrow beam pattern with digital steering capability and all digital loudspeaker design.

The Parametric Digital Transducer Array Loudspeaker Prototype

Prototype hardware block diagram.

The design for the constructed prototype had an 8 bit resolution, and a sampling frequency of 97.65625KHz, It utilised an Opal Kelly XEM6010-LX45 FPGA board for signal processing, 4 Texas Instruments LM293D H-bridge amplifiers for amplification, and a 28 element Murata MA40S4S ultrasonic transducer array. 7 groups of 4 transducers were wired in parallel in an attempt to increase the sound pressure level output of the prototype. The weighting of each amplifier was implemented using pulse width modulation and varying duty cycles

Signal flow diagram of prototype system.

Prototype Measurement Techniques

Measurement setup for the PDTAL prototype.

A series of acoustics measurements were conducted in a quiet, but non-anechoic room 30cm away from the loudspeaker using sinusoidal signals with frequencies of 50Hz, 100Hz, 200Hz, 400Hz, 800Hz, 1600Hz, 3200Hz, and 6400Hz. Frequency response, THD, and signal-to-noise ratio (SNR) data was calculated from these measurements when possible. Due to the excessive ambient noise conditions in the room where the measurements took place, as well as the low sound pressure level emitted from the PDTAL prototype, accurate polar pattern measurements were not possible.

Measurement Results

Measured frequency response of the measured prototype.

The above figure shows the frequency response of the prototype as taken over a number of measurements. The 6dB per octave low pass filter with a 900Hz roll off frequency can be observed.

The next figure shows THD against output frequency of the prototype. THD generally decreases as output frequency increases except for frequencies above 6KHz.

Measured THD against frequency of the PDTAL prototype.

Measurement Discussion

The prototype has a flat frequency response up until until 900Hz where a 6dB per octave slope can be observed. This slope is due to the narrow frequency response of the MA40S4S piezo transducer. To extend the high frequency performance of the PDTAL design, a transducer with an extended frequency response could be used. The design appears to be able to produce low frequency signals with frequencies as low as 50Hz with a narrow directivity pattern. This can be considered an excellent attribute seeing as the reproduction of signals bellow 500Hz in PLA type designs is usually very difficult without drastic equalisation. The ability of the PDTAL design to reproduce these low frequencies can be considered a positive design attribute over conventional PLA designs.

The PDTAL Prototype produced similar amounts of THD to that of PLA design that utilise double-sideband modulation with a high modulation indexes. With that being said, It is highly likely that switching to single-sideband modulation would reduce the THD of the PDTAL design to acceptable levels.

But What Does it Sound Like?

Conclusion

Digital and Parametric Loudspeaker Arrays have quite a way to go before they are more widely adopted in the audio world due to their high levels of THD, and poor frequency response. The PDTAL design potentially solves the issue of poor low frequency performance of parametric speakers, and also potentially reduces the excessive THD distortion produced in off-axis positions with digital loudspeakers. All the while the design reduces system complexity when used in beamforming applications.

As mentioned earlier, this post only scratches the surface on the methods of Digital and Parametric Loudspeaker Arrays. More complete information can be found online via the shared project materials.

 

A Magnavox Odyssey Pong Clone Using Arduino

The Australian Centre for the Moving Image, or ACMI as it is more commonly called is home to the permanent exhibition Screen Worlds. The exhibition was first opened all the way back in 2009, and has a large range of exhibits that showcase different technologies and trends in film, television, and digital culture that date back more than 100 years. Now when screen worlds opened, I was only just graduating high school myself, but after joining the ACMI AV department as an AV Technician for the first time in 2013 I have had the opportunity to get well acquainted with the individual exhibits by performing maintenance and making sure they stay up and running for as long as possible despite using equipment and technology that is now almost 10 years old!

This is easier said than done. Sometimes we are talking about maintaining 40 year old gaming consoles that run 24 hours a day! A reoccurring victim of this ambitious operating schedule was the legendary Magnavox Odyssey that ran a copy of the original Pong. ACMI burnt through quite a few Magnavox Odysseys through the years which is not particularly surprising seeing as the console was released in 1972. Original functional Magnavox Odysseys have become increasingly rare, and with the exhibit closed for some time the ACMI AV department decided to commission a rebuild of Pong that would try to emulate the original as closely as possible. Seeing an opportunity to do something cool, I put my hand up to attempt building a clone.

JAMMA Boards and Emulation

So how do you attempt a clone of something like Pong? There are lots of different pre-existing solutions out there that will do the job, but what are they and how faithful are they to the original?

Unbranded and branded so called “multicade JAMMA boards” are available from a variety of online sources that usually contain one or more versions of Pong, although versions of Pong that emulate the Magnavox are rare. Perhaps the most well known branded multicade boards are the Pandora’s Box series. But don’t go rushing to find a website with information on these boards, they are mostly illegal. They use MAME emulators in conjunction with illegal game ROMs that have annoyed companies such as Nintendo for years. If you know someone who has an arcade machine with these old classics and it didn’t cost several thousands of dollars, it is almost certainly illegal! Because of this using any kind of emulation or third party board was out of the question. This includes the use of any kind of computer that uses emulation software to play illegally downloaded ROMs. While various linux distributions such as the widely popular RetroPi are not illegal, legal ROMs of Pong are not available for purchase.

Coding a Clone

In contrast to emulated ROMs, coding a clone from scratch that is devoid of any particular trademarks is perfectly legal, hence why so many Pong derivatives have existed over the years. With this being the case, I decided to give a go at coding one these. The easiest solution would have been to make a reasonably accurate clone that can run on a PC or Raspberry Pi, but after doing some quick googling I noticed quite a few people had tried to code Pong games using the Arduino Uno and the TVout library. This library makes it possible to create composite signals using a couple of resistors and a couple of GPIO pins. The graphics it produces are pretty rudimentary, but perfect for something like a pong clone. Composite type signals are often imperfect, which actually helps create a retro type effect in applications such as this! It also has a simple audio tone generator which can produce some pretty convincing 1 bit audio signals.

The Hardware

The existing controllers were custom made to resemble the old school Magnavox controllers, and had two potentiometers each, as well as one momentary push button. One potentiometer acts as the spin control for once the ball has been hit, and one acts as the paddle position control. The push button puts the ball back in to play. The potentiometers are connected to various ADC channels on the Arduino, and the pushbutton is connected to a GPIO pin.

Existing Magnavox clone controllers

A GPIO pin was also reserved for connecting to an RCA jack that acts as the audio output. Two resistors are used for the composite output as per the write up done on the TVout library reference.

Schematic of project showing where everything was connected.

The Code

The code for this project is available here and is licensed under GPL 3.0, so by all means go ahead and use this yourself! I won’t go in to the details of the code itself as it is pretty sufficiently commented, but if everything is wired up correctly this should work straight out of the box using Sketch.

This Pong clone is closer to the version released for the Magnavox Odyssey 300 rather than the original Magnavox Odyssey. Hopefully the kids in Screen Worlds don’t notice! Some bugs appeared after installing this at ACMI which I didn’t have the chance to fix. If the ball is going fast enough sometimes it will go straight through a paddle and win a point for the opponent. The spin control was a little difficult implement, and harder still seeing as I never got a chance to play Pong on an actual Magnavox. One of the tougher things to get right with the TVout library is to make sure the game and graphics have been sufficiently updated before TVout tries to bit bang the output. This can actually add a visual retro effect to the game, but is not ideal and highlights how even a simple Pong game can push an AVR Atmega microcontroller to it’s limit.

See it for yourself at ACMI in Screen Worlds!

openSerial: A Graphical Serial Interface Suited for Microcontroller Applications

For a university group project involving IoT sensors I had the requirement of creating a graphical interface that helps send various commands via a serial port, and receive data on the same serial port from the same IoT sensors as a reply. Obviously this can be done fairly easily with command line programs such as screen and miniterm and there are almost certainly suitable programs out there, but as it was a requirement for the group project I decided to give my own a go.  Thus, openSerial was born.

Command line serial programs can at times be a pain, and take more time then they should to get up and running. So I tried to make openSerial as useful as possible for a wide range of situations, although the application is more targeted towards talking to microcontrollers. It was coded using Qt, and utilises Qt’s QtSerialPort library. It scans the available serial ports once a second and updates the port name combo box list. The user can define different serial settings such as baud rate, data bits setting, parity bit setting, stop bit settings, and flow control settings. It also automatically updates the connection status label based on what serial port is connected.

A quick tutorial of openSerial.

The user can read the full serial output in the console window, and send single line commands using the command lineEdit window. A history of sent commands is displayed in the Send Commands Window.

I have tested it out and it seems to work well! Sometimes if you disconnect from a serial connection, you have to unplug and plug the device in again before reconnecting. But this is more likely due to the behavior of the end device I used to test the software with. When in doubt, turn it off and on again!

You can find the source code, and a .zip file containing a binary and required Qt libraries on my github page at https://github.com/DaleGia/openSerial. The program has been tested on a machine running Ubuntu 18.04. It’s a little messy in the naming department, but should be quite easy for anyone to get their head around. I highly recommend using Qt Creator when working with Qt projects!

 

Controlling Ultrasonic Piezo Transducer Output with PWM Duty Cycle

For my capstone project at university I am working with a bunch of ultrasonic piezo transducers that require a variable sound pressure level (SPL) output. One way of achieving this is by driving the transducer with a pulse width modulated (PWM) signal and varying the duty cycle. My application actually requires a way of changing the output SPL in a linear manner, so I decided to conduct an experiment to see what the SPL output is with different duty cycles of the piezo transducer I have on hand, the Murata MA40S4S.

The Experiment

To do this, I taped together two Murata MA40S4S transducers together directly. As both of these transducers are specified as transmitting transducers, this was not ideal, but for the purpose of this experiment it will do the job for both transmitting the pulses with varying duty cycle, and measuring the resulting output.

The two MA40S4S piezo transducers taped together.

I connected a Picoscope 2204A’s arbitrary wave generator (AWG) directly to one of the transducers, and the channel A input of the Picoscope 2204A to the remaining transducer. This formed the transmitter/receiver setup.

The transmitter/receiver setup

From there, I found the resonant frequency that resulted in the greatest voltage output from the receiving piezo transducer. To do this, I setup a 2Vpp square wave with a duty cycle of 50% with picoscope’s software, and then slowly sweeped different frequencies around 40kHz. I found that the highest receiver voltage peaked with a driving frequency of 43.9kHz.

The picoscope software setup for creating square waves with different duty cycles and measuring the response

Then everything was simple. I just changed the duty cycle of the square wave and recorded the peak to peak voltage of the receiving transducer.

The Results

The following charts show the measured receiver output when the transmitting transducer was driven with a 43.9kHz square wave signal with differing duty cycles.

Output measured from receiving transducer at different transmitting duty cycles

From these measurements we can see that the greatest output occurs with a duty cycle of 50%. We can also see that as duty cycle is decreased, the voltage output does not decrease in a linear manner. In order to get an idea of how non-linear the transducer is at different driving duty cycles, I made the following chart which displays the ideal and measured response in decibels relative to a duty cycle of 50%.

Transducer response relative a 50% duty cycle

We can see from this chart that the error is significant. If linearity is required in the reduction of SPL output from these transducers when using PWM with a varying duty cycle, some kind of calibration would have to take place. This is especially the case as piezo transducers of this kind often have large tolerances.

The Conclusion

Driving piezo transducers with PWM signals that vary in duty cycle is a great way to reduce SPL output in an easy manner. However changes in duty cycle do not result in a proportional change in SPL output. If linearity is required in this sense, some form of calibration should be performed.

It should be noted that the poor linearity of the results could be influenced by the receiving transducers own non-linearities. Frustratingly this kind of thing is not defined in the Murata MA40S4S or MA40S4R datasheet, but I have no way to know for sure other than by purchasing a decent ultrasonic microphone and performing the same measurements.

 

How Cold Can a Raspberry Pi Get?

The other day I was discussing with a colleague how cold the CPU of a Raspberry Pi would get if it were left out in the harsh Sarajevian winter. With Sarajevo being the capital of Bosnia and Herzegovina, and my current whereabouts.

He assured me the thing would not get very cold and me being my stubborn self I had to test this out. “If only we had a temperature chamber”, I mused. “A temperature chamber? We are in Bosnia! Our temperature chamber is our kitchen freezer and oven! Let’s just put the damn thing in the freezer”, he retorted. So that is what we did.

The Experiment

This Raspberry Pi had a Tiny Core distribution installed, which is a very cool minimalist distribution particularly well suited for embedded applications that I would recommend to anyone who has the time to learn its quirks. Being only a Raspberry Pi version 2, we had to add WiFi connectivity via a USB dongle, and we powered the Pi with a mobile charger battery. In the end this shenanigan looked a bit like this:

Setup of the great Raspberry Pi in freezer experiment.

After setting up the WiFi dongle driver and getting the Pi to automatically connect to the offices WiFi network at boot up (no easy feat using Tiny Core as a beginner), I SSH’d in to the Pi and used the following very simple Bash command to print out the temperature in Terminal every 3 seconds, and also save it to a CSV file.


while true
do 
{
    echo "$(date),$(cat/sys/class/thermal/thermal_zone0/temp)"
    echo "$(date),$(cat/sys/class/thermal/thermal_zone0/temp)" >>temp_freezer.csv
    sleep 3

}
done 

 

The Results

Keeping in mind that there is not much that is scientific about this test, The Raspberry Pi was kept at around 22 degrees before the test started (measured by a DHT22 sensor from a different project and the room air conditioner read out. After putting the Pi in the freezer, we got the following results.

Results from the experiment.

The Conclusion

After getting these results, we used a mercury thermometer to measure the temperature inside the freezer, which returned around -14 degrees. So, what can we gather from this experiment? A Raspberry Pi will cool in a linear fashion when placed in the cold. The Raspberry Pi CPU resting temperature is not linear when it comes to different ambient temperatures (42c-22c = 20c, 14c-(-14c) = 28c. The Raspberry Pi CPU thermometer has a pretty low resolution, which can be seen by the quantising like spikes in the results.

I am hoping that one day I can repeat this experiment in a controlled environment with a temperature chamber, as well as with the inclusion of other variables such as CPU load. But in the near future I will try and do similar experiments with Raspberry Pi CPU temperature vs CPU frequency. Hope this helps someone who needs to put their Pi in the freezer!