When I discovered the MMC2IEC / SD2IEC project by chance back in 2009, it made me dig up again my soldering iron and electronic components after many years of disuse. I built myself one of those devices on a prototyping board and had a lot of fun doing so. It was the first time that I got involved with micro controllers and I learned a lot in the process.
Now, many years and projects later, I was looking for an excuse to try out KiCAD and to learn how to design my own boards using it. I had already ordered a small PCB I found on the net as a proof-of-concept to see if the Gerber files I produce would result in working boards. When they turned out just as expected I was eager to create something myself. This was the perfect opportunity to revisit the subject and make myself a brand new SD2IEC.
I wanted the design to be based on Shadowolf’s latest version but also make my own additions and changes:
- The board should be able to tap into the cassette port of the C64 for power supply.
- It should be board for external use with proper connectors just like my first build.
- All components should be cheap to buy from Chinese suppliers.
So, this is the first prototype of what I came up with. I call it the “SD2IEC pluggable”:
Still trying to save my batteries
By now it is time for at least an intermediate update on this project. In the meantime I have indeed revised the sensor boards by adding a switching transistor controlled through one of the remaining digital pins on the ATmega. The firmware was modified, and it will now power down the attached sensors before entering sleep mode. Disappointingly, this resulted in a battery lifetime extended by no more than roughly 10%.
On a mostly unrelated note, the voltage graph now looks “stepped” when compared to the previous one. This seemed to be a direct result of switching from maniacbug’s original driver for the RF24 module to the one newly optimized by tmrh20. I’ve got absolutely no clue why this would affect the voltage measurement against the bandgap reference, but there it was. If you can shed some light on this, please leave me a comment.
The next thing I tried, somewhat desperately, was to reduce the number of data samples by increasing the sleep time from 1 minute to 5 minutes. This had no discernible effect on battery life-time. But at least it leads to the conclusion that I need to further investigate power consumption during sleep mode.
So, just assuming that it was the sensors that were draining the batteries in sleep mode turned out to be a bad idea. Now I really need to replace my crappy 7€ multimeter with something a little more precise that will allow me to actually measure which part of the circuit is drawing which amount of current.
With all components finally having arrived from China, I built the first couple of wireless sensors a few months ago. They are using the cheap nRF24L01 transceiver modules for data transmission based on the RF24Network network layer. I’m using a Raspberry Pi with the transceiver module directly connected to its GPIO pins as the root node. The sensor nodes are controlled by an ATmega328 microcrontroller flashed with the Arduino firmware for convenience.
Each sensor node currently features a DHT11 humidity sensor, a DS18B20 digital thermometer, a BMP180 barometric pressures sensor and it’s powered by three AA cells. The controller spends most of its time in power-saving sleep mode, waking up to send a data packet about every minute. Each packet contains the readings from the three sensors as well as the battery voltage as determined against the bandgap reference.
The setup is far from final. For one, I’m still not sure how to store the data. Currently, it is just logged into a text file with an occasional and experimental import into OpenTSDB. I haven’t really come to trust OpenTSDB since I haven’t found a suitable and convincing way to backup the HBase data, yet. Also, I might still replace the Raspberry Pi root node with an Arduino based MQTT relay.
First though, the power consumption of the sensor nodes needs improving. When I started out I was hoping for each node to run for close to a year on a single set of batteries. As you can see in the graph above, with the current design a set of three NiMH batteries with low self discharge lasts for no more than 6 weeks. What comes to mind in order to improve this, is to switch off the sensors and the transceiver in between samples. That is probably what I’ll try next. Please let me know if you’ve got any other ideas!
I have been documenting interesting software and programming related findings in my own private Wiki for a few years now. This turned out to be really useful in many cases, especially on topics that I would run into only very infrequently. Most of these notes would not be of any interest to anybody else but me, while a few of them might be worth offering to a wider audience. All it would take would be some nice presentation and a little effort to write things down in whole sentences. Or so I thought.
The finished XU1541 adapter.
When I began tinkering with electronics again, I soon decided this would be a great excuse to start my own blog, sharing my progress. After my initial enthusiasm had worn off, I soon realized that I had somewhat underestimated this project. It takes a good deal of time and effort to write things down in whole sentences and to present them nicely. As a result, there are a few projects that I finished this year that I failed to put up here so far. Most likely, I have forgotten a lot of interesting details by now. But I’ll try and summarize what I do remember.