This is looking great @phec , am really interested to see how the data goes and the sensors survive over the coming weeks. I hope the bees are doing well too in this terrible weather!
I opened up the hive to see how the measured temperatures tie in with what the bees are doing.
The bees are incorporating the sensors into the comb. Unfortunately they are nibbling away the wax that I used to insulate the thermistors. At the moment that doesnāt matter because they are using the area for brood rather than nectar.
The Spark seems to be doing its job OK. Iāve had a couple of occasions when it could not connect to the wifi (flashing green) As soon as I power cycled it connected immediately so I donāt think it was simply the signal strength. If it happens again Iāll try to isolate the circumstances.
WOW your projects are truly amazing!
not sure if the wife would let me keep beeās in the back yardā¦
Iām still waiting for my current clamps to arrive so i can make my energy monitorā¦ Iām sure youāll know when i get them because i will have a million questions for you!
&peekay Iāve had a fiddle with the code and get the same results as you. Iāve tried changing UDP to TCP communications and get the dreaded red flashes even with 256 values so it is back to UDP and keeping the data below 490 samples. Iāve just updated my firmware to the latest version (17/5 to 10/6) and I get an extra 4 bytes of RAM!
@phec, there are some awesome RAM reductions coming down the pipe being tested right now so stay tuned. I still donāt know why more than 490 samples donāt work! I will try and ping @zachary to see if he has any ideas.
Thanks for the heads-up @peekay123.
This is an outstanding project @phec! Your bees and hives are beautiful! Someday Iāll have my own, but not now.
If you are building locally and pull the latest master (as of right now) of all 3 firmware repos (core-common-lib, core-communication-lib, core-firmware) you will see more than 2KB of RAM freed up compared to a few days ago. Then donāt forget to adjust your UDP buffer size again if you still need more. Weāll be releasing this RAM-saving firmware within a week or two.
@zachary, is there a limit on the UDP packet size you can send?
According to this page, the maximum payload for any service is 1468 bytes but it is not clear if that is for their driver or the chip. I think the Spark limit has to be lower than that.
This is looking great @phec , look forward to more data over time to see how the sensors and bees perform as the ambient temperature increases here in the UK.
@bko, we were trying to send a 1024 byte packet (+overhead) which should have worked.
In my experience, itās limited by the size of the UDP buffer, but I havenāt yet tested exhaustivelyāworking on it this sprint at moderate priority.
@zachary, I thought the buffer was only for receiving, not sending!
Sorry, yup, youāre right. Wasnāt reading carefully. Limit would then be the size of the buffer in the CC3000 Host Driver minus the headers the host driver adds for the data on the SPI line.
Also, in order to support UDP packets not being sent until endPacket()
is called, we would need a new UDP send buffer.
Iāve avoided the packet size limitation by using one UDP request to collect the data and send the first half, then a second request that sends the second half of the data. However unfortunately even with @peekay123 's trick of reducing the receive buffer size I canāt stretch to 512 samples. I donāt get a red flash but I get flashing cyan and green - presumably something important has been overwritten. The RAM improvements are eagerly awaited! In the meantime the data are building up and looking interesting.
Morning @phec, just wondering how the data is going at your end over the last couple of weeks. Bees chewed through anything yet? Do you have any good graphs for activity yet? Yours, Richard
@richardfreeman, thank you for your interest. I have a growing collection of audio samples that seem to contain some useful information.
This picture is a set of 24 hourly sonograms running from midnight to midnight (16 samples collected over a second once an hour) - I've not mastered pylab yet so it isn't labelled. The vertical axis is frequency, showing the first 45 bins of an FFT of the data at 22Hz per bin (EDIT - correction - I think it is more like 7.8Hz per bin) so hopefully the band at bin 13ish represents the bees' wing beat frequency. The very marked peak around sample 150 is a tractor mowing the next door field and the peaks around sample 300 are a neighbour's pressure washer. That is rural living for you.
The temperature profile has continued to show the steady cluster centre temperature while the outer reaches of the colony follow ambient temperature. I can also see the cluster growing and the temperature drop slightly when the young brood moves away from a region.The thermistors are now exposed but don't seem to be suffering any problems.
I've got nothing sensible out of the optical signal yet - once I'd thought to switch off the Spark's LED which gave me a very nice FFT pattern. I think I am sampling too fast and the sensor is too far from the entrance. I see the odd bee crawl over the sensor but don't pick up the hoped for small variation in light level as bees enter and leave the hive. The optical signal changes a lot during the day as you'd expect but the short term variation is just in the least significant bit or two.
I'm working on the Mk 2 version which won't be fastened to a brood frame but will be free standing. I've sunk a scaffolding pole in the ground near the hives so the antenna and PV are higher. I've also got a couple of neat DC to DC converters that will boost the PV voltage when the sky is overcast and keep trickle charging the batteries. Having two colonies monitored will help enormously with interpreting the data. (Edited: DC to DC converter gave me an extra 1/2 hr of power at each end of the day but reduced power by 50% for the rest of the time so I'm abandoning that route.)
I've ordered a Chinese copy of and Arduino GPRS shield so I can communicate with more distant hives and I've got some more microphones so I will be able to subtract a reference background noise from the bee signal.
I've looked into detecting the new queen piping to predict swarming. I'd need to keep the Spark listening most of the time which I don't have power for (and the Spark doesn't have enough RAM for). Also, by the time the queen and her daughters are communicating it is too late to stop a swarm. I hope that once I have cleaned up the audio signal I may get a rather less specific general overcrowding noise which may give me a bit of a clue. Failing that, a MOSFET artificial nose should do a good job of detecting the Queen Mandibular Pheromone level at the edge of the cluster because it has some chemically pretty simple components. These were all the rage 10-15 years ago but I've not seen anything for sale at a price I'm prepared to pay.
Thanks for the amazing detail here @phec - your knowledge of audio is far above mine, great to be able to track the sort of things we get near our hives too though, such as farm machines. Itās a shame the battery power to take a photo every now and again remotely is too high really otherwise that would be a good combination. I had never thought of trying to check for queen substance or not, but thatās a great idea. For me, itās still going to be checking hive health, trying to predict swarming and recording the environmental conditions to see if they influence the first two parts which is probably my priority! Have your hives been packed up yet for the year? Hope all goes well anyway. Thanks, Richard
Someone asked what microphone I use and how is it connected to the Spark.
I use this microphone
I bought mine in the UK from Cool Components.
GND and VCC are connected to the GND and 3v3* pins of the Spark and AUD is connected to one of the Analog in pins. The breakout board provides a reasonable signal centred on 1.65v (ie mid range of the ADC) for speech at arms length or for nearby bees. Here is a typical sample of the raw signal transmitted by the Spark to my Raspberry Pi:
The Spark sends ADC values in the range 0 - 4095 and all I have done is subtract 2048 to get approximately centre zero.
Good to see more about the microphone @phec - are you packed up for the season now? Any plans to amend the kit for next year? Yours, Richard