Fall, apples are getting ripe. Time make some juice.
We have several apple trees, and we know that if we just freeze slices we probably wont use them. But we do drink juice. We have tried juicers, but they tend to be meant for smaller scale, few liters maybe. Then I came across Matthias Wandel's homepage and his apple cider making page https://woodgears.ca/cider/. I copied the design somewhat and came up with this.
It's current in prototype stage, I want to make a bigger place to put the apples, preferably so large that I can just pour a whole moving box of apples there and let it crunch away. Also a better stand would be nice. The vfd in the back is just to test different speeds, I intend to replace that motor with something a bit smaller and one phase. Video of the crusher can be found here https://youtu.be/YjaJNmqus-Y
I haven't had time to build a press so I'm forced to use this store bought. It does it's job but could be better.
Today i harvested two trees, about four moving boxes full of apples, 30 liters of juice.
update: Second time, about 75 kg of apples gives about 25 litres of juice.
Wednesday, 24 August 2016
Tuesday, 9 August 2016
You have mail, power usage 2
Still no luck, batteries died over the weekend.
One of my thoughts was that if something goes wrong, for example we don't get wifi connection, then the device just sits there sucking power. So i added a timer just after we wake up that waits for 10 seconds and then goes to sleep, 10 seconds should be plenty time to get a connection and send data.
Also added was error handling to wifi and mqtt connections, if we don't get a connection we go to sleep and try again.
I also added a feature that we only send messages when state changes, and we only wake up the modem when we need to send something. For this I needed a new firmware that has rtcmem module. But the master had changed SDK version and I couldn't get the new firmware to work. I tried erasing (http://nodemcu.readthedocs.io/en/latest/en/flash/#upgrading-firmware) flash but still couldn't get it to work. I had to get the excellent Nodemcu-build docker image and use it to build a previous version. Which worked fine. I tried using the lowest power option in deep sleep, but there seems to be some problem with it, and I couldn't get it to work https://github.com/nodemcu/nodemcu-firmware/issues/1225.
On thing that also was on my mind was the really small antenna that came with the Esp-201 modules. Most likely a better antenna would give less trouble. I had some old adsl-modems laying around that had built in wifi with external antennas. I salvaged an antenna from one of them, and now I get better reception.
One of my thoughts was that if something goes wrong, for example we don't get wifi connection, then the device just sits there sucking power. So i added a timer just after we wake up that waits for 10 seconds and then goes to sleep, 10 seconds should be plenty time to get a connection and send data.
Also added was error handling to wifi and mqtt connections, if we don't get a connection we go to sleep and try again.
I also added a feature that we only send messages when state changes, and we only wake up the modem when we need to send something. For this I needed a new firmware that has rtcmem module. But the master had changed SDK version and I couldn't get the new firmware to work. I tried erasing (http://nodemcu.readthedocs.io/en/latest/en/flash/#upgrading-firmware) flash but still couldn't get it to work. I had to get the excellent Nodemcu-build docker image and use it to build a previous version. Which worked fine. I tried using the lowest power option in deep sleep, but there seems to be some problem with it, and I couldn't get it to work https://github.com/nodemcu/nodemcu-firmware/issues/1225.
On thing that also was on my mind was the really small antenna that came with the Esp-201 modules. Most likely a better antenna would give less trouble. I had some old adsl-modems laying around that had built in wifi with external antennas. I salvaged an antenna from one of them, and now I get better reception.
Thursday, 4 August 2016
You have mail, power usage.
After a less than 24 hours my mail sensors died. Batteries where around 1 volt, so it had drained them pretty quickly, something had to be done.
First I started to measure how many mA my circuit uses. But I was faced with a continually resetting Esp8266. At first I thought it had somehow messed the program in it's flash because of low voltage situation, but after a while of debugging I got the idea to measure the voltage, and it turns out that when measuring mA my multimeter drops the voltage from 3.3 to 3.1, and that makes the Esp8266 go crazy. Then I moved amperage measuring before the dc-dc converter. After that the circuit worked fine. There is a nice article about this issue here http://www.eevblog.com/files/uCurrentArticle.pdf
The following amperage readings are before the dc to dc converter when I powered the circuit from usb at 5 volts. When Esp8266 was active the circuit drawed around 40 - 100 mA of current. In deep sleep it took about 8 mA, which was quite high. After a bit of googling I found that the power led was using significant amount of power, so I took it out. Power went down to 3.4 mA, which is still quite high. After some thinking I started looking at how much TSL257 draws current, and it was typical 1.9 mA and max 3.5 mA according to datasheet. After moving TSL257 power to gpio, so it's only on during mail check, deep sleep current is 0.5mA, which is pretty much all taken by the dc-dc converter. Which I can't do anything about, without buying a new converter, so I'll settle for this now. If aaa batteries are about 1000 mAh then they should last about 1000/0.5/24=83 days, so over two months. Which at least gives me some time to think what I will do.
First I started to measure how many mA my circuit uses. But I was faced with a continually resetting Esp8266. At first I thought it had somehow messed the program in it's flash because of low voltage situation, but after a while of debugging I got the idea to measure the voltage, and it turns out that when measuring mA my multimeter drops the voltage from 3.3 to 3.1, and that makes the Esp8266 go crazy. Then I moved amperage measuring before the dc-dc converter. After that the circuit worked fine. There is a nice article about this issue here http://www.eevblog.com/files/uCurrentArticle.pdf
The following amperage readings are before the dc to dc converter when I powered the circuit from usb at 5 volts. When Esp8266 was active the circuit drawed around 40 - 100 mA of current. In deep sleep it took about 8 mA, which was quite high. After a bit of googling I found that the power led was using significant amount of power, so I took it out. Power went down to 3.4 mA, which is still quite high. After some thinking I started looking at how much TSL257 draws current, and it was typical 1.9 mA and max 3.5 mA according to datasheet. After moving TSL257 power to gpio, so it's only on during mail check, deep sleep current is 0.5mA, which is pretty much all taken by the dc-dc converter. Which I can't do anything about, without buying a new converter, so I'll settle for this now. If aaa batteries are about 1000 mAh then they should last about 1000/0.5/24=83 days, so over two months. Which at least gives me some time to think what I will do.
Tuesday, 2 August 2016
You have mail
Have you ever wondered has the mail arrived yet? I got my ESP8266 some while ago and was wondering what to do with it. After a while I thought it would be perfect for checking if mail had arrived, and I mean the traditional physical kind with envelopes.
On the hardware side everything is simple, TSL257 connected to input pin, and a led with a transistor connected on a output pin. Because Esp8266 can only output a maximum of 12mA on it's pins I put a transistor to drive the led, so I could drive it at a higher amperage. Fritzing ESP-201 module from https://github.com/ydonnelly/ESP8266_fritzing.
Since I use deep sleep between checks XPD has to be connected to reset pin(black wire). Resistors on top of the Esp-201 and the yellow wire are for normal boot mode, as the module doesn't have these ready.
If pin2 (gpio4) is pulled low then the normal check and sleep is not done, this is so you can update lua scripts without reflashing the whole thing.
For a power supply I use three aaa batteries in series and a step down converted to get the 3.3 volts that is needed.
Since the circuit was so tiny I didn't use a pcb but just soldered the components together. Wires going to top right are for led and wires going bottom left are for TSL257.
I used a ESP-201 module, because it has an external antenna, and it's small and cheap. Because it doesn't have a usb connector it also has slightly smaller power usage, but I have to use a separate usb to serial module for programming. At first I used cheap clone ordered from aliexpress, but kept getting errors when flashing. So I bought a different module from a local shop and it worker like a charm. Others have also had trouble with cheap usb to serial modules when flashing ESP8266 modules.
Here is the device installed. Installation is not permanent, so I can better debug or change something if need be. Also we will probably get a new mailbox soon. Which would be good because our current mailbox is made from plastic and it lets light in just enough that when sun is shining it interferes. I had to tape the inside to block sun light.
And here is the inside.
Script itself is pretty simple:
Code can be found here https://github.com/mika-koivusaari/you_have_mail.
Look for mqtt broker with mDNS, NodeMCU doesn't current have a mDNS client, so this will have to wait for that.
Hardware
I figured some kind of light gate would be good for detecting if there is something in the mailbox. At first I tried with ldr and some led's, but couldn't get it to work. Either it didn't notice the led or ambient light was enough. Probably if I had a different type of ldr with different resistance it could have worked, but I didn't. So I used a TSL257 that I had lying aroung, and it seems to do the trick.On the hardware side everything is simple, TSL257 connected to input pin, and a led with a transistor connected on a output pin. Because Esp8266 can only output a maximum of 12mA on it's pins I put a transistor to drive the led, so I could drive it at a higher amperage. Fritzing ESP-201 module from https://github.com/ydonnelly/ESP8266_fritzing.
Since I use deep sleep between checks XPD has to be connected to reset pin(black wire). Resistors on top of the Esp-201 and the yellow wire are for normal boot mode, as the module doesn't have these ready.
If pin2 (gpio4) is pulled low then the normal check and sleep is not done, this is so you can update lua scripts without reflashing the whole thing.
For a power supply I use three aaa batteries in series and a step down converted to get the 3.3 volts that is needed.
Since the circuit was so tiny I didn't use a pcb but just soldered the components together. Wires going to top right are for led and wires going bottom left are for TSL257.
I used a ESP-201 module, because it has an external antenna, and it's small and cheap. Because it doesn't have a usb connector it also has slightly smaller power usage, but I have to use a separate usb to serial module for programming. At first I used cheap clone ordered from aliexpress, but kept getting errors when flashing. So I bought a different module from a local shop and it worker like a charm. Others have also had trouble with cheap usb to serial modules when flashing ESP8266 modules.
Here is the device installed. Installation is not permanent, so I can better debug or change something if need be. Also we will probably get a new mailbox soon. Which would be good because our current mailbox is made from plastic and it lets light in just enough that when sun is shining it interferes. I had to tape the inside to block sun light.
And here is the inside.
Software
For programming I wanted to use NodeMCU and lua. I wanted to see if a interpreted language would be good enough, and it also has mqtt support.Script itself is pretty simple:
- wakeup
- check if we see light, if so then there is too much light -> error
- turn on led
- check if we see light, light -> no mail, no light -> mail
- send message
- sleep
Programming with NodeMCU is pretty straightforward. But because it's event driven there is a bit of extra work with callbacks for this kind of batch job.
Code can be found here https://github.com/mika-koivusaari/you_have_mail.
Future improvements
After deep sleep check mail status first, and only if it has changed start modem and send message. Not sure how much this would improve battery life, but if it seems too short then I'll try.
Report battery status. Esp8266 only has adc range from 0 to 1 volts, so I would need to scale the voltage from three aaa batteries to that. Need to look into that sometime, it would probably be useful for other projects too.
Look for mqtt broker with mDNS, NodeMCU doesn't current have a mDNS client, so this will have to wait for that.
Next I'll have to make some kind user interface so I can actually see when the mail arrives.
Wednesday, 6 July 2016
Comparing solar radiation shields
I have three temperature sensors with calibration data that I want to test with different solar radiation shields.
From the left, normal shield made from plastic plates, tube made from twinwall sheet used in advertisement plates, same kind of tube but with fan.
Sensors (DS18B20) are read with OWFS and a small python script thatstarts the conversion for all sensors, reads them and then sends them to a Google Sheet using gspread. For some reason simultaneous conversion doesn't work for me, I get cached values. So I changed the script to just read sensors one after the other. Reading is done every minute. Also writing to Google Sheets is really slow, especially when done cell by cell. So I moved writing to Sheets to a different script that is run once a day.
Currently data is flowing in nicely, but I forgot to check which sensor is in which shield, so I have to check that the next time I travel to where those sensors are.
Writing to Google sheets is really easy with gspread, I can definitely recommend it if you need to work with Google sheets.
Raw data can be found in this Google sheet.
Python script in https://github.com/mika-koivusaari/read_ds18b20_gspread
From the left, normal shield made from plastic plates, tube made from twinwall sheet used in advertisement plates, same kind of tube but with fan.
Sensors (DS18B20) are read with OWFS and a small python script that
Currently data is flowing in nicely, but I forgot to check which sensor is in which shield, so I have to check that the next time I travel to where those sensors are.
Writing to Google sheets is really easy with gspread, I can definitely recommend it if you need to work with Google sheets.
Raw data can be found in this Google sheet.
Python script in https://github.com/mika-koivusaari/read_ds18b20_gspread
Thursday, 16 June 2016
Calibrating DS18B20 sensors to show the same
I have a weather station in our summer house. It currently has a radiation shield made from plastic plates for the thermometer. It's "common knowledge" that if you have more air flow through you sensors it reflects more accurately ambient temperature. So forced airflow with a fan would more likely be better.
I want to test how much better. For this I need thermometers that show exactly the same value in the same temperature. So I'm going to put three sensors in salt water that's heated to about 40 degrees Celsius and then let it cool down to about -20°. Reading sensor values every minute should give a reasonable calibration table.
Motor in the top is for circulating water so I get more accurate results. It's a bit ugly setup but I only plan on using this for one time so I didn't bother with anything fancy.
Or at least that was the plan. 40° -> 20° went well but after I put the whole thing in the freezer all the DS18B20 sensors stopped working. I'm guessing some moisture related problem. I took the setup out of the freezer and let it heat from about -3° that it had cooled to room temperature. I'm probably not going to leave the test running for the winter so that range should be enough.
I used screen to read the values from serial "screen -L /dev/ttyUSB1". As cat seems to stop when arduino takes it's time to boot.
Data is in a Google spreadsheet DS18B20 calibration data.
There are three sensors A, B and C. Here are their maximum differences, and average differences.
I'm thinking that the differences are not that big and I shouldn't worry about them. And some of it is most likely because I put a different amount of hotglue to the sensors to shield them.
Code used can be found in github https://github.com/mika-koivusaari/read_all_ds18b20
I want to test how much better. For this I need thermometers that show exactly the same value in the same temperature. So I'm going to put three sensors in salt water that's heated to about 40 degrees Celsius and then let it cool down to about -20°. Reading sensor values every minute should give a reasonable calibration table.
Motor in the top is for circulating water so I get more accurate results. It's a bit ugly setup but I only plan on using this for one time so I didn't bother with anything fancy.
Or at least that was the plan. 40° -> 20° went well but after I put the whole thing in the freezer all the DS18B20 sensors stopped working. I'm guessing some moisture related problem. I took the setup out of the freezer and let it heat from about -3° that it had cooled to room temperature. I'm probably not going to leave the test running for the winter so that range should be enough.
I used screen to read the values from serial "screen -L /dev/ttyUSB1". As cat seems to stop when arduino takes it's time to boot.
Data is in a Google spreadsheet DS18B20 calibration data.
There are three sensors A, B and C. Here are their maximum differences, and average differences.
| A-B | A-C | B-C | |
|---|---|---|---|
| Max difference | 0.4375 | 0.3125 | 0.2500 |
| Avg difference | 0.0537 | 0.0353 | 0.0433 |
I'm thinking that the differences are not that big and I shouldn't worry about them. And some of it is most likely because I put a different amount of hotglue to the sensors to shield them.
Code used can be found in github https://github.com/mika-koivusaari/read_all_ds18b20
Thursday, 9 June 2016
Arduino counter
I needed a way to read pulses from our house and geothermal heat pumps electricity meters. Of course there are many pulse counters all ready, but I had make my own:) Just a simple sketch that counts pulses from pins 2 and 3 reports them on the usb serial when asked.
Main meter is read optically with a TSL257 and the geothermal pump meter is directly connect to the meter.
Code in github https://github.com/mika-koivusaari/read_kwh_pulse
I use a python daemon to relay the data to MySql, code again in github https://github.com/mika-koivusaari/read_pulse_mysql
Main meter is read optically with a TSL257 and the geothermal pump meter is directly connect to the meter.
Code in github https://github.com/mika-koivusaari/read_kwh_pulse
I use a python daemon to relay the data to MySql, code again in github https://github.com/mika-koivusaari/read_pulse_mysql
Subscribe to:
Posts (Atom)









