<div style="text-align: center;"> # Connected Bird Feeder *By Robin Cailum (rc222gk)* </div> --- <div style="text-align: center;"> <img src="https://hackmd.io/_uploads/rkxb6qot0.png" style="width: 500px;"> </div> --- ### Overview During this tutorial we will create a bird feeder that can both count the number of birds landing on the feeder and snap a photo of the culprit bird, as well as give a warning when the food is starting to run out. We will create a suitably complex bird feeder to host all the electronic devices needed to make it all a true contribution to the field of IoT and as well as a local server and our own webpage to visualise the collected data, in the true DIY spirit! Approximate time for the project: **8 hours** (excluding time for 3D-printing). Let´s get going! <div style="width: 40px"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 512" style="width: 100%; height: 100%;"> <path d="M313.2 47.5c1.2-13 21.3-14 36.6-8.7 .9 .3 26.2 9.7 19 15.2-27.9-7.4-56.4 18.2-55.6-6.5zm-201 6.9c30.7-8.1 62 20 61.1-7.1-1.3-14.2-23.4-15.3-40.2-9.6-1 .3-28.7 10.5-20.9 16.7zM319.4 160c-8.8 0-16 7.2-16 16s7.2 16 16 16 16-7.2 16-16-7.2-16-16-16zm-159.7 0c-8.8 0-16 7.2-16 16s7.2 16 16 16 16-7.2 16-16-7.2-16-16-16zm318.5 163.2c-9.9 24-40.7 11-63.9-1.2-13.5 69.1-58.1 111.4-126.3 124.2 .3 .9-2-.1 24 1 33.6 1.4 63.8-3.1 97.4-8-19.8-13.8-11.4-37.1-9.8-38.1 1.4-.9 14.7 1.7 21.6 11.5 8.6-12.5 28.4-14.8 30.2-13.6 1.6 1.1 6.6 20.9-6.9 34.6 4.7-.9 8.2-1.6 9.8-2.1 2.6-.8 17.7 11.3 3.1 13.3-14.3 2.3-22.6 5.1-47.1 10.8-45.9 10.7-85.9 11.8-117.7 12.8l1 11.6c3.8 18.1-23.4 24.3-27.6 6.2 .8 17.9-27.1 21.8-28.4-1l-.5 5.3c-.7 18.4-28.4 17.9-28.3-.6-7.5 13.5-28.1 6.8-26.4-8.5l1.2-12.4c-36.7 .9-59.7 3.1-61.8 3.1-20.9 0-20.9-31.6 0-31.6 2.4 0 27.7 1.3 63.2 2.8-61.1-15.5-103.7-55-114.9-118.2-25 12.8-57.5 26.8-68.2 .8-10.5-25.4 21.5-42.6 66.8-73.4 .7-6.6 1.6-13.3 2.7-19.8-14.4-19.6-11.6-36.3-16.1-60.4-16.8 2.4-23.2-9.1-23.6-23.1 .3-7.3 2.1-14.9 2.4-15.4 1.1-1.8 10.1-2 12.7-2.6 6-31.7 50.6-33.2 90.9-34.5 19.7-21.8 45.2-41.5 80.9-48.3C203.3 29 215.2 8.5 216.2 8c1.7-.8 21.2 4.3 26.3 23.2 5.2-8.8 18.3-11.4 19.6-10.7 1.1 .6 6.4 15-4.9 25.9 40.3 3.5 72.2 24.7 96 50.7 36.1 1.5 71.8 5.9 77.1 34 2.7 .6 11.6 .8 12.7 2.6 .3 .5 2.1 8.1 2.4 15.4-.5 13.9-6.8 25.4-23.6 23.1-3.2 17.3-2.7 32.9-8.7 47.7 2.4 11.7 4 23.8 4.8 36.4 37 25.4 70.3 42.5 60.3 66.9zM207.4 159.9c.9-44-37.9-42.2-78.6-40.3-21.7 1-38.9 1.9-45.5 13.9-11.4 20.9 5.9 92.9 23.2 101.2 9.8 4.7 73.4 7.9 86.3-7.1 8.2-9.4 15-49.4 14.6-67.7zm52 58.3c-4.3-12.4-6-30.1-15.3-32.7-2-.5-9-.5-11 0-10 2.8-10.8 22.1-17 37.2 15.4 0 19.3 9.7 23.7 9.7 4.3 0 6.3-11.3 19.6-14.2zm135.7-84.7c-6.6-12.1-24.8-12.9-46.5-13.9-40.2-1.9-78.2-3.8-77.3 40.3-.5 18.3 5 58.3 13.2 67.8 13 14.9 76.6 11.8 86.3 7.1 15.8-7.6 36.5-78.9 24.3-101.3z"/> </svg> </div> --- ### Objective I choosed this particular project because I wanted to immediately challenge myself as soon as I started my IoT journey. It contains multiple sensor that need to work together to deliver the expected data, while also expecting CAD, 3d printing and HTML coding experience from the user - not the most common combined skillset, to be fair. After having gone through this whole text, you will have dipped your toes into all of them, and, who knows, maybe you find your new passion or, at the very least, find a way to complement your next IoT projects in new ways. While this is meant as a tutorial, I hope this text will prove as fun a challenge to you as it was for me, and will leave you with lots of inspiration and experience for future projects! The more tangible goal of this project is to monitor the feeding habits of small birds. Through measuring the number of birds that lands on the feeder, and the consumption of bird-feed, we could find out how much a bird of that size eats on average. The number of birds and the consumption of feed can then be measured over different seasons and conditions to find correlations and anomalies. A sharp-eyed user could even potentially follow individual birds throught the build in camera feature. I think the results could be very interesting! 🐦 --- ### Material Here on follows a list of all the required hardware to complete the project. | Bill of Materials | Link | Picture | Price | |:-------------------------------------------------:|:----------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------:|:-----------:| | Raspberry Pi Pico W | [Elecrokit.com](https://www.electrokit.com/en/raspberry-pi-pico-wh) | <img src="https://www.electrokit.com/cache/ba/999x999-product_41019_41019114_PICO-WH-HERO.jpg" style="width:100px;height:100px;"> | 109kr | | OpenMV Cam M7 | [Openmv.io](https://openmv.io/products/openmv-cam-m7?_pos=5&_sid=adf5f3de2&_ss=r?variant=28680564737) | <img src="https://openmv.io/cdn/shop/products/web-new-cam-v3-angle_1000x_crop_center.jpg?v=1480645085" style="width:100px;height:100px;"> | 690kr | | Photo interrupter | [Elecrokit.com](https://www.electrokit.com/en/optisk-lasgaffel) | <img src="https://www.electrokit.com/upload/product/41015/41015736/41015736.jpg" style="width:100px;height:100px;"> | 39kr | | Light sensor module | [Elecrokit.com](https://www.electrokit.com/en/ljussensor) | <img src="https://www.electrokit.com/upload/product/41015/41015727/41015727.jpg" style="width:100px;height:100px;"> | 39kr | | Breadboard 170 hole | [Elecrokit.com](https://www.electrokit.com/en/kopplingsdack-170-anslutningar) | <img src="https://www.electrokit.com/upload/product/10160/10160170/10160170.jpg" style="width: 100%; height: 100%; object-fit: cover;"> | 35kr | | Battery holder 3x AAA box switch JST-PH connector | [Elecrokit.com](https://www.electrokit.com/en/batterihallare-3xaaa-med-strombrytare-och-jst-kontakt) | <img src="https://www.electrokit.com/upload/product/41012/41012683/41012683.jpg" style="width:100px;height:100px;"> | 39kr | | Jumper wires 20-pin 30cm female/male | [Elecrokit.com](https://www.electrokit.com/en/labbsladd-20-pin-15cm-hona/hane) | <img src="https://www.electrokit.com/upload/product/41012/41012911/41012911.jpg" style="width:100px;height:100px;"> | 29kr | | Prusament PLA 1 kg | [Prusa3d.com](https://www.prusa3d.com/product/prusament-pla-lipstick-red-1kg/) | <img src="https://www.prusa3d.com/content/images/product/default/734.jpg" style="width:100px;height:100px;"> | 340kr | | 10x Screws M3 | [Elecrokit.com](https://www.electrokit.com/button-head-screws-m3-25-packlength-8mm) | <img src="https://www.electrokit.com/upload/product/41019/41019704/41019704.jpg" style="width:100px;height:100px;"> | 24kr | | 2x Screw M2 | [Elecrokit.com](https://www.electrokit.com/skruv-ph-m2x10) | <img src="https://www.electrokit.com/cache/80/999x999-product_41013_41013904_41013904.jpg" style="width:100px;height:100px;"> | 4kr | | | | **Total price** | 1348kr | As seen in the list, this project uses a couple of microcontrollers and sensors, along with everything needed to put it all together into something coherent and purpose built. Below, I´ll give a quick run down of the main components and why I choose them. For complete specifications, please use the links in the list above. #### Raspberry Pi Pico WH The heart of this project will be this little microcontroller. It will mainly handle the WIFI connectivity between all the other components and the local server. It features several ways to interact with the sensors and actuators around it, such as GPIO (General purpose input/output) pins, which is the most common way to control and monitor simpler connected devices, or I2C (Inter-Integrated Circuit) pins, which is better suited for communication with things like displays or clocks using minimal wiring. SPI (Serial Peripheral Interface), which is used for high-speed data transfer to thing like SD-cards and high resolution displays, and UART (Universal Asynchronous Receiver-Transmitter), which sends data without timed synchronisation with the connected device and is suitable for things like GPS-modules or, like in our case, a camera, are two other ways to connect devices to the Pico. We will be using GPIO and UART in this project. When I chose the microcontroller I did compare the Pico to the Arduino Uno and Nano I had laying around. The Pico proved to be much stronger, with tests found online (e.g. [Tomshardware](https://www.tomshardware.com/features/raspberry-pi-pico-vs-arduino)) only showing the Arduinos beating the Pico in a power consumtion contest. I also compared the Pico and the OpenMV Cam M7 microcontroller and while the M7 surely could have handled the other sensors by itself, it did also have a higher base power consumption than the Pico. Ultimately, and frankly, the Pico was choosen for it´s unique (amongst my available choices) ability to use Wifi, but also because it shared the same language with the M7 camera, which facilitates easier programming and interoperability. I choose to run the other sensors via the Pico to lower the total power consumtion as much as possible and to ease the data logistics. #### OpenMV Cam M7 This beauty is a microcontroller all on its own and with its built in camera it can use features such as motion detection, face detection and object tracking, amongst other things. While the M7 has all the connections of the Pico (notably except WiFi) and is overall more powerful, this microcontroller is clearly purpose built for development and industrial environments. It has dedicated pins like TIM (Timer) and Servo to accurately measure timing and send PWM (Pulse Width Modulation) for precise control of motors. Note that the Pico also has there capabilities - they are just not marked on the M7 microcontroller board. We will simply be using the M7 to capture images of landing birds, while the Pico handles the other sensors and the WIFI communications. #### Light Sensor Module The light sensor module, or photoresistor, will be used to monitor if the level of remaining feed is getting low. The basic idea is that as the feed disappears, the level of light that is let into the feeder itself will rise. At a certain level of light, the sensor will declare a warning about low feed levels. Lots of levels in that paragraph... The sensor works by giving a lower electric current in dark environments and a higher current in lighter conditions, something that can then be read by a microcontroller. The sensor itself is mounted on a small circuitboard that contains a 10kΩ in-line resistor and 3 pins (power, ground and signal). A resistor is needed to stabalize the voltage so the data from the sensor can be readable in a meaningful way and to prevent damage to the microcontroller due to a short-circuit. Having said that, you could potentially change the strength of the resistor to customize your sensor for you needs - a 100kΩ resistor, for example, would make the sensor more light sensitive and lower the power consumption, at the risk of sending unstable readings and unwanted noice, while a 1kΩ resistor would lower the sensitivity for change in light levels and ensure stable reading, but at the cost of higher power consumption. The already build in 10kΩ is a balanced design choice between the two extremes. #### Photo interrupter Module This module works by sending an IR light beam between two point and changing its voltage signature based on if the beam is blocked or not. Think red invisible laser beam-alarms from [insert preferred heist film and spy thriller here]. The sensor shows a low voltage when the beam is unobstructed and a high voltage when the beam is much less unobstructed. This sensor is also mounted on a small circuit-board, very similar to the previously talked about sensor, but contains two resistors - one 1kΩ for the IR emitter and one 33Ω for the receiver. The functions of there resistors is much the same as in the photoresistor module. This sensor will be used to monitor a balancing board, or in our case, a balancing perch, which will tip over slightly as the bird lands and so release the beam that the perch had been blocking - changing the signal. I choosed to have the perch block the beam as a starting point because a broken beam conducts less electric current and so lowers the sensor´s base state power consumption. #### Mini Breadboard At the start of the project I aimed to not use a breadboard in the final version, as, I reasoned, it would take up lots of space and add lots of extra wiring. After some fiddling with the wiring without a breadboard, I quickly realized that, if the Pico was to be powered by the battery pack and then share the power around, there wouldn´t be enough 3.3V output pins to go around. I had a conversation with my teacher´s assistant (this project is a part of an IoT course i did) at the time and it was suggested that jumper wires could be soldered together to minimize wiring while still distributing power and ground to all the electronics in the project. It was even talked about disecting an old LAN-cable, as splitting the ends of the main cable would yield enough wiring for all my needs. After I had soldered a couple of jumper wires together to create a 4 ways-wire, I so happened to find a mini breadboard laying around and it was quickly concluded what using that instead would save a lot of time and effort (and jumper wires). The mini breadboard retroactivly fitted my already finished bird feeder design, and so was adopted for use going forward. #### Battery Holder, 3x AAA This particular holder was chosen for its low price and compact design, used with readily available everyday alkaline AAA batteries. Choosing this over a smaller sized LiPo battery did loose me some space inside the bird feeder but did save me a few buck, while still supplying a reasonable [average](https://batteryspecialists.com.au/blogs/news/4-differences-between-an-alkaline-battery-aaa-and-a-lithium-battery-aaa) of 1000mAh and 4.5V. Due to a misunderstanding with the supplier, I ended up with a battery holder with a JST-PH connector. This one did not fit any of the electronics currently in the project, but a couple of jumper wires between the battery and the breadboard quickly solved that problem 🧷 I did not choose to use rechargeable batteries from this project due to trying to keep the budget down, but you could easily replace the choosen batteries for rechargeable ones in you own version of the project. An alternative way to go, if you want a rechargeable battery of small size, is to buy a LiPo [battery](https://www.electrokit.com/en/batteri-lipo-3.7v-750mah) and a small charging [module](https://www.electrokit.com/lipo-laddare-2a-usb-c) with which you can recharge you power source without disassemble your bird feeder or cut power to you microcontroller. This goes beyond the scope of this tutorial, though. #### Jumper Wire Quite self explanatory - you need the wire to connect everything together. *Funny story* - Since my microcontrollers and sensors only had male headers, and I was aiming for a breadboardless configuration, I had to cut and resolder a bunch of F2M (female to male) jumper wire to create a bunch of F2F ones. This was not very useful once i realised that i was going to have to use a mini breadboard after all. The sigh was very load and very long, lets say.. I ended up buying a new set of F2M wires, rather than going throught the grind of cutting and soldering my old wires back to their original form again. (╯°_°)╯︵ ┻━┻ #### Prusament PLA You can use any filament brand, really. I personally like Prusas machines and filament for their great results at a good reasonable price. While I didn´t actually measure the amount of filament needed for this project, 1 roll of 1 kg filament was enough. I would guess at a usage of 800-900g for my particular design. #### Screws Also self-explanatory. The 2x M2 screws are for fastening the Pico to a bracket and 2x M3 are for doing the same with the M7. The rest is for fastening the mentioned brackets to the main body of the bird feeder. --- ### Computer Setup For this project, I used the Visual Studio Code IDE (integrated Development Environment).I personally like this one from my previous experiences using it to build a web application in HTML and JavaScript. It proved no less useful for coding in MicroPython. Once you have installed Visual Studio Code (VS Code) you will have to install an extention, Pymakr, so that you can work with the microcontrollers inside VS Code. Further down you will find link to a tutorial on how to do this. In said tutorial they also ask you to install Node(.sj). This is used for setting up a server which will then be used to continuously update our backend with the information fed my the sensors and the camera. An alternative to VS Code is Thonny IDE. For while VS Code is developed by Microsoft, with all the extra resourses that entails, like being able to handle multiple programing languages and an extensive extension library, all of that is not needed for our project. With easy setup and a simple user interface, Thonny is more catered towards beginners - but is still well within our requirements to complete this project. *Funny story* - I am in no way a pro user of VS Code. As part of my process, I tried saving a picture on the Pico, just to see if the transfer between the Pico and M7 worked as intended. Thing is, you can´t access to folders in the Pico like any old USB mass storage device.. After some frustration, I learned that checking the folders is very straight forward in Thonny. I ended up installing Thonny for this single purpose ^ _ ^ I also used the OpenMV IDE in this project. This is the camera microcontroller´s own IDE and it was very useful as it showed a stream of what the camera was seeing and doing. It also had some cool example code for showing of the real potential of the M7. With some better skills in coding, you could probably forgo the use of a photo interrupter and balancing perch all together in favour of the OpenMV M7´s motion detection och object tracking. Even unique bird registrations would probably not be out of the question, with the right know-how. <div style="text-align: center;"> <img src="https://cdn.shopify.com/s/files/1/0803/9211/files/openmv-ide.gif?v=1480470511" style="width:400px;"> </div> <br> Follow these links to download and install your chosen IDE. OpenMV don´t have a dedicated get-started video tutorial, but it´s a faily basic IDE, so if you learn any of the other two IDE, you will know how to handle the OpenMV IDE. <div style="text-align: center;"> | IDE | Installation | Tutorial examples | | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | -------------------------------------------------------------------------------------------- | | <img src="https://carleton.ca/scs/wp-content/uploads/vscode-1-200x200.png" style="width:100px;height:100px;"> | [VS Code](https://hackmd.io/@lnu-iot/rkiTJj8O9) | [Youtube playlist](https://www.youtube.com/playlist?list=PLj6YeMhvp2S4oEV_bT1Uk3oXfpvGW6Xqy) | | <img src="https://upload.wikimedia.org/wikipedia/commons/e/e2/Thonny_logo.png" style="width:100px;height:100px;"> | [Thonny](https://hackmd.io/@lnu-iot/SyTPrHwh_) | [Youtube](https://www.youtube.com/watch?v=GssM7hkwJrc&t=18s) | | <img src="https://avatars.githubusercontent.com/u/12023962?s=200&v=4" style="width:100px;height:100px;"> |[OpenMV](https://openmv.io/pages/download)|[IDE overview](https://docs.openmv.io/openmvcam/tutorial/openmvide_overview.html)| </div> Once you have installed all the programs and extensions you need, it´s time to flash the Pico, AKA get the thing to work. When you flash you update the microcontroller and so make it into a funtioning device. Your microcontroller does not come pre-flashede for several reasons, with the biggest one probably being extra versatility. Another developer might want to use the controller for other applications than yours, and so not pre-flashing the device gives the user that extra flexibility. To flash the Pico, first download the latest firmware from [here](https://micropython.org/download/RPI_PICO_W/), then connect the Pico to the computer while simultaneously holding down the BOOTSEL button (the only button on the Pico). Once you have don this you can now access the Pico´s storage. PLace the firmware file in here. You know that the firmware has taken hold when the Pico disconnects from you computer. The Pico is now ready for use! For a more detailed tutorial, or if you are running Linux, check out this [link](https://hackmd.io/@lnu-iot/rkFw7gao_). On top of the development environment, you will need to download XAMPP to be able to host your own webserver. This program handles the communication between the webpage och your local server, simply put. While XAMPP can also be used for building databases, we do not dive deeper into the program here. Just know that you need it to visualize your local data on a self made webpage and follow the linked tutorial to know learn how. <div style="text-align: center;"> | XAMPP | Installation | Tutorial | | -------- | -------- | -------- | | <img src="https://upload.wikimedia.org/wikipedia/commons/d/dc/XAMPP_Logo.png" style="width:100px;height:100px;"> | [XAMPP](https://www.apachefriends.org/) | [Youtube](https://www.youtube.com/watch?v=r0lDDeVkaks) | </div> --- ### Preparations There are actually quite a few steps to go through before we move on to putting everything together. We need the bird feeder itself, which will be designed using CAD (in my case, Fusion 360) and we need to make sure that the microcontroller have headers, or pins, to attach the wire too, and also make sure we have compatible jumper wire for the connections (Which i happened to not have and so had to solve through soldering). 3D-printing will also play a crucial role, as you might imagine. While a deepdive into these arts will not be part of this tutorial, I will explain how i did things while also linking to recommended tutorials to get you started. #### CAD - Fusion 360 For CADing (Computer-Aided Design) i used Fusion 360, a versatile and cloud based tool which uses parametric modeling, AKA modeling by measurement, to create 3D objects. This allow me to have full control over my project and also the ability to easily come back and change any metrics I happen to need to change. While powerful and free for personal use, this in not a very intuitive or beginner friendly program, unfortunately. <div style="text-align: center;"> ![CAD GIF](https://hackmd.io/_uploads/BJ-PzoHwA.gif) </div> If you are really into IoT, but consider yourself a newbie at 3D-modelling, I can highly recommend TinkerCAD. This progam is free, web-based (no downloads or installations) and easy to quickly grasp. It has dedicated sections for 3d-modeling and circuit creation/simulation and even a section for creating 3D-objects using codeblocks. Cool! TinkerCAD themselves supply an endless stream of tutorials for their program and the community as large and active. ![codeblocks_nametag](https://hackmd.io/_uploads/SyHDQjBPR.gif) When creating this bird feeder, there are a few things that is extra important to keep in mind. - Allow light into the feeder without letting in the elements. - Mind the distance and angle between the camera and the perch for a good focused image capture. - Consider the tipping perch/photo interrupter interaction. - Thing through how you will attach the perch to the rest of the bird feeder after 3D-printing it all. - Wire and mini breadboard takes up space too! - Dont forget a good way to hang or place the bird feeder. While I did end up with a functioning bird feeder, and all the goals set out for it, I did fail at all of the above points in my own project, so that is why I can give you this heads up in advance of your own creation ಥ_ಥ <br> You can find my design of a Bird feeder as a Fusion 360 [here](https://github.com/Dualarrow88/Connected-Bird-Feeder). I´ve also included a STEP file for those of you who uses another CAD program. You can tweek the feeder in Fusion 360 to account for the lessons-learned mentioned above or, even better, create your own design. The possibilies are endless! Links to both programs below. <div style="text-align: center;"> | Company | Installation | Tutorial examples | | - | - | - | | <img src="https://seeklogo.com/images/A/autodesk-fusion-360-logo-7F72A76397-seeklogo.com.png" style="width:100px;height:100px;"> | [Fusion360](https://www.autodesk.com/products/fusion-360/personal) | [Youtube playlist](https://www.youtube.com/playlist?list=PLrZ2zKOtC_-C4rWfapgngoe9o2-ng8ZBr) | | <img src="https://i0.wp.com/tinderboxcollective.org/wp-content/uploads/2023/08/tinkercad-logo.png?w=920&ssl=1" style="width:100px;height:100px;"> | [TinkerCAD](https://www.tinkercad.com/) <br> (cloud based) | [TinkerCAD](https://www.tinkercad.com/learn) | </div> #### 3D-Printing Like i mentioned, a deepdive into this supjcet is beyond the scope of this project. I can recommend a certain brand of 3D-printing manufacturer and some tutorial to get you going, though! I highly recommend [Prusa](https://www.prusa3d.com/). Their machines are of high quality and with automatic calibration, and the interface of their machines holds your hand through the whole process of printing, making it a very helpful option for newcomers. Prusa also comes with their own slicer (the software use to prepare any files for printing) and their own filament, closing everything into it´s own ecosystem. This assures both quality products and quality costumer service. I personally used their XL multicolor printer for this project. This machine adds a lot of color without having to print parts separately to achive the same effect. More color and less assembling? I take it! <div style="text-align: center;"> <img src="https://hackmd.io/_uploads/BkKmUoHDC.jpg" alt="448920249_478082148037259_4830902222410119281_n" style="width: 300px;"> </div> <br> Here are some links to get you going. <div style="text-align: center;"> | Prusa | Hardware | Software | Tutorials | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------ | --- | | <img src="https://media.printables.com/media/prints/184589/images/1721337_902de2e0-21d9-42e9-a715-ee315f81436f/thumbs/inside/1600x1200/webp/prusaslicer-1.webp" style="width:100px;height:100px;"> | [Machines](https://www.prusa3d.com/category/3d-printers/) | [PrusaSlicer](https://www.prusa3d.com/page/prusaslicer_424/) | [Slicer](https://www.youtube.com/playlist?list=PLs1JXSLQ6-i6wekQWuthupCmNmsKa8nWg), <br> [Machine](https://www.youtube.com/watch?v=GE-lrRbU124) | </div> #### Soldering When I have dug up the OpenMV M7 camera from storage, I quickly realized that it didn´t have any headers (connection points). I also realized that once I soldered the male headers on the board, which was the only one available to me, I´d be sorely lacking in F2F (female to female) jumper wire. This was the time to bring forth my unused soldering machine! I quickly learned the basics, and since both the M7 and the soldered wires worked by the end, I´d say it was a success. <div style="display: flex; flex-wrap: wrap; gap: 20px;"> <div style="flex: 1 1 30%; text-align: center;"> <img src="https://hackmd.io/_uploads/Hycv_jrvR.jpg" alt="Image 1" style="width: 100%;"> <p>.</p> </div> <div style="flex: 1 1 30%; text-align: center;"> <img src="https://hackmd.io/_uploads/HyCTGVptR.jpg" alt="Image 1" style="width: 100%;"> <p>.</p> </div> </div> If you are new to soldering and want to learn, for this project or your next one, I can recommend the equipment below. Also, since i´m quite new to this myself, I could never explain the process of solering better than a pro - I link to one of those tutorials below , too. <div style="text-align: center;"> | Soldering station | Wire | Tutorial | | -------- | -------- | -------- | | <img src="https://www.electrokit.com/upload/product/41000/41000870/41000870.jpg" style="width:100px;height:100px;"> <br> [Station](https://www.electrokit.com/en/lodstation-48w-vtss4/ap-2?gad_source=1&gclid=Cj0KCQjws560BhCuARIsAHMqE0H52wzZkpk1pU5OU9zoVoI028eM4NrNrembG7ZLj4hxb6UIDUW6cv4aAi8lEALw_wcB) | [Wire ](https://www.electrokit.com/en/lodtenn-0.6mm-blyfritt-100g) | [Youtube](https://www.youtube.com/watch?v=AqvHogekDI4) | </div> #### File Directory As part of the preparations, you will need to prepare the file directory for use as your local server and database. Doing this early, and correctly, will save you much headace further down the line. Use your choosen IDE software to create all the diferent types of files in their respective location. Prepare the files according to the diagram below. Place the ‘Visualisation’ main folder inside the ‘htdocs’ folder of XAMPP. | Main Folder | Sub Folder | Files | | ------------- | ---------- | -------------------------- | | Visualisation | BirdCount | BirdCount.txt | | | FoodStatus | FoodStatus.txt | | | Images | | | | | bird_data.php | | | | connected_bird_feeder.html| | | | scripts.js | | | | server. py | | | | styles.css | Once done, you directory should look something like this ⬇ <div style="text-align: center;"> <img src="https://hackmd.io/_uploads/rJucZizK0.png" style="width: 400px; border: 2px solid #999; border-radius: px;"> </div> <br> I will walk you throught all this in the code section but, very briefly, these filed will be used to create a webpage and update the status of the birdfeeder so that it can be fed to, and displayed by, said webpage. --- ### Assembling the Electronics Once all the parts needed for the project are ready and available, it´s time to assemble it all. This is the stage where you discover all the faults you have made so far, be it bad soldering, too tight a housing for the electronics or delaminated 3D-filament. Exciting times! But before trying to make everything fit, it´s time to connect all the wire so you can see just how big your misscalculation of the size of the electronics housing was. Below is a circuit diagram, showing where everything is supposed to go and why. ![Circuit diagram](https://hackmd.io/_uploads/HJNxRqrPR.png) #### <span style="color: yellow;">Yellow wires</span> The yellow wires are the signals going from the two sensors to the Pico. Worth noting here is that the resistor uses an analoque signal, while the interrupter uses a digital one. The short explanation of these two signals is that the digital signal sends a HIGH or LOW signal, while the analogue signal sends data on a scale. In our case, the interruptor sends a digital signal telling us if there is something blocking the sensor or not, while the the resistor sends a analogue signal telling us the exact amount of light hitting the sensor. I mention this distinction because the Pico only have three ADC (Analog-to-Digital Converter) pins capable of reading the resistor data. Make sure to choose GPIO 26,27 or 28 for the photo resistor. The photo interrupter, with its digital signal, can be put in any GPIO pin. #### <span style="color: purple;">Purple wires</span> The purple wires are used for UART (Universal Asynchronous Receiver/Transmitter), which is one of the easiest and most common ways to have two microcontrollers communicate with each other. UART is a way of serial communication, meaning that one bit is sent at a time and that the communication is initiated and terminated by a start and an end signal. This way of communicating is simple and robust compared to alternatives like parallel communication, which sends data faster thanks to sending multiple bits simultaneously, but which also might be susceptible to signal integrity issues and a larger bundle of wiring. Our project need non of those issues. #### <span style="color: Black;">Black wires</span> This is the ground. Make sure everything is grounded before operations. If ungrounded, the microcontrollers don´t have a point of referense to make proper readings of the electrical signal sent to it. Without a proper ground, your setup may also be more susceptible to noise, leading to erratic signals and unreliable data. In the worst case scenario, the different components might die due to an voltage overdose. #### <span style="color: red;">Red wires</span> These are the power wires. There is actually not much to say about those. The sensors could potentially be supplied with power from the two microcontrollers, but since we do have a breadboard readily available, we give all the components their power from there. If we are talking about power itself, that deserves a section of its own. --- ### Power If you are interested maximizing the power efficency of this project, you can read about some suggestions and observations below. #### Battery Starting of by saying that my batterycase, holding 3 AAA Alkaline 1,5V batteries should have been enough to power my whole setup, seeing at the batteries would add up to 4,5V and the setup could opperate in between 3,6-5V. In theory. In practice, measurements done with a multimeter shows that the real voltage output was only 3,6V. I found this strange. I double checked with a AA 1,5 Alkaline battery of the same brand and it too showed 1,2V - same as the individual AAA batteries. I found this discrepancy when I was investigating irregular behaviour from the M7 camera. My conclusion was that operating the camera at its absolut minimum voltage requirement of 3,6V (The rest of the setup had a operating range of 3,3-5V) was far from optimal. I think the irregular behaviour was due to power fluctuation, which could have been caused to any of the reasons of glitchy wiring due to using a breadboard, irregular power demands (like then the Pico sends data via WIFI) or depleting charge in the battery. A solution could be to include a power regulator in your setup. Or. You know, make sure the batteries are giving you the voltage that they promise you. **TLDR - Check that your power supply is sufficient for your setup!** <div style="text-align: center;"> <img src="https://hackmd.io/_uploads/Sy4qBFcw0.jpg" alt="449465902_314064305118014_6301015284362843718_n" style="width: 400px;"> </div> #### Photo interrupter I created my bird counter to count the birds once the perch was sat on and flipped so that it no longer broke the connection between the photo interrupter´s LED and receiver. In hindsight, and after some measuring, I should probably have made it in reverse - that the flipping perch blocked the sensor when sat on, instead of unblocking it. According to measurments given throught the terminal over some time, I can see that the voltage is higher when the sensor is blocked, meaning that the **default state of the sensor during operation should be unblocked**, to save power. Example measurments below -> <div style="display: flex; justify-content: space-between;"> <img src="https://hackmd.io/_uploads/ry_9TYqvA.png" alt="First Image" style="width: 48%;"/> <img src="https://hackmd.io/_uploads/Byd96F9DR.png" alt="Second Image" style="width: 48%;"/> </div> <br> After my experience with the fluctuations affecting with the M7 camera, an idea came to me - Wouldn´t a **pulsing LED save power** compared one that is constantly active? It can indeed, as [this](https://forum.digikey.com/t/how-to-minimize-power-consumption-for-the-circuit-using-photomicrosensors-photointerrupters/34988) article confirmed to me. I will definitely incorporate this in my next project. #### Photo resistor The role of the photo resistor in this setup is to check if enough bird feed has gone to allow enough light into the feed container to trigger the resistor, which then sends a warning of low feed levels. In my project, the resistor is constantly turned on and even if i only ask for a reading every 12h, it still consumes power. For you project, I recommend that you make it so the **sensor will be turned off between between readings** and **only waking up when a reading is needed.** Further measurments show that the sensor has a higher voltage when it is dark (due to the increased resistance), which show that, if we are being nitpicking, whis might now be the most efficient use of a photo resistor. Then again, it is only powered on for a few seconds per day.. Example measurments below -> <div style="display: flex; justify-content: space-between;"> <img src="https://hackmd.io/_uploads/HkSzmi5PA.png" alt="First Image" style="width: 48%;"/> <img src="https://hackmd.io/_uploads/BJ43XiqwC.png" alt="Second Image" style="width: 48%;"/> </div> <br> #### OpenMV M7 The M7 camera is much in the same boat as the photo resistor, as in we only need it occationally. Power it down completely might not be as practical here, though, as we need it to be up and running to snap a picture within moments. Enter **deep sleep mode**. Using this mode will **significantly reduce the energy consumption** of the M7 board, while still allowing it to **wake up in a moment´s notice to take a picture**, before going back in to deep sleep once the excitment is over. While I don´t have any readings on my own, this time, we can make some calculations to compare the energy consumption between an active and sleeping M7. **Active Mode** Current Consumption: "Less than 150 mA" (as specified in the datasheet) Operating Voltage: 3.6V Power Calculation: P (Power) = V (voltage) × I (current) ---> P = 3,6V × 0,150A ---> P = 0,54W **Power consumption = 0,54 W** --- **Deep sleep mode** Current Consumption: STM32F7 microcontroller (Which the M7 is based on) has a deep sleep consumption of around 2-10 µA. We´ll use 5µA as an average Operating Voltage: 3.6V Power Calculation: P = 3,6V × 5×10^−6A ---> P = 18μW **Power consumption = 0.000018 W (18μW)** --- **Battery life** To understand these results even better, let´s calculate the battery life time for the two - 3 Alkaline AAA 1,5V batteries = ~1000 mAh Battery capacity = mAh × Voltage / 1000 Battery capacity = 1000 × 3,6 / 1000 = 3,6 watt-hours (Wh) Battery capacity = 3,6 Wh **Battery life in active mode** Time = 3,6Wh / 0,54W = **6,67 hours** **Battery life in deep sleep mode** Time = 3,6Wh / 0.000018W = 200 000 hours 200 000h / 24h = **8 333 days** As you can see, quite the difference. When i did thir project I did not leave the camera *active* more than when needed to take a picture, but I also didn´t put the M7 into *deep sleep mode*. Knowing and implementing this from the start of the project could have saved me some extra battery life. Now i hope it can save you some battery, instead. #### Raspberry Pi Pico WH Compared to my current setup and code, thing could be run more efficiently in general. In my code, the Pico is constantly polling for input from both the interrupter sensor and the UART connection from the M7 camera. Seeing as the Pico is the heart of the birdfeeder it needs to be alert, but it still doesn´t mean that it has to nag the other peripherals for information. A more efficient way to code this setup would have been to **use so called interrupts instead of polling**, meaning that the Pico could **go into a light sleep mode** and then get poked by the peripherals when something happens, such as when a bird lands. Once awake, it could immediately start working on waking the M7 camera and transmit the taken picture to the server, before going back into a light sleep mode (as opposed to a deep sleep mode). Compared to deep sleep mode, microcontrollers waking up from a **light sleep mode doesn´t have to reinitialize or reconfigure its peripherals**, or loose the timer it has for checking on the photo resistor, for example. Perfect compromise for the microcontroller of a setup. Without going through all the calculations above once again, I´m sure you can see the benefits of this way of doing things. --- ### The Code The IoT code we will be using consists of three files - the boot. py, main. py (Pico), main. py (OpenMV M7). Each of these serves an important purpose in the project. - The boot will handle the start-up connection to the wifi network. - The main (Pico) handles the sensor, the camera and the wifi connection. This is where the bulk of the code is. - Main (OpenMV M7) instructs the camera on what quality the image taken should be and also to send the image in chunks to the Pico for wifi transfer to the computer. ⬇ Here is an example code from the boot. py. A standard way to connect the setup to the wifi, which also allows for several attempts to connect to the network. ``` import network import time #WIFI CONNECTION ---------------> # Replace with your network credentials SSID = "Your_WiFi_Name" PASSWORD = "Your_Password" wlan = network.WLAN(network.STA_IF) wlan.active(True) wlan.connect(SSID, PASSWORD) # Wait for the connection max_attempts = 10 attempts = 0 while not wlan.isconnected() and attempts < max_attempts: attempts += 1 print(f"Attempting to connect... ({attempts})") time.sleep(1) if wlan.isconnected(): print("Connected to WiFi") print("Network config:", wlan.ifconfig()) else: print("Failed to connect to WiFi") ``` ⬇ Extracted code for the main. py for the OpenMV CAM M7. It listens for a CAMERA command from the Pico. Once the command comes, the M7 will take a snapshot before sending it to the Pico in chunks over the UART connection. It is sent i chunks to ensure the Pico can handle the flow of data. An exta safety feature was added to ensure the image data was uncorrupted upon arrival to the Pico - A checksum control. Simply explained, checksum calculates the number of byte a chunk of sent image contains, and if the receiver doesn´t get the exact number of byte, the image is most likely corrupted and the receiver asks for the image chunk to be sent again. ``` while True: if uart.any(): cmd = uart.read().strip() if cmd == b"CAMERA": img = sensor.snapshot() # Take a picture img_bytes = img.compress(quality=90).bytearray() total_chunks = len(img_bytes) // chunk_size + (1 if len(img_bytes) % chunk_size else 0) uart.write("START\n") # Indicate the start of an image time.sleep_ms(100) for i in range(total_chunks): start = i * chunk_size end = start + chunk_size chunk = img_bytes[start:end] checksum = calculate_checksum(chunk) uart.write(chunk + bytes([checksum])) while uart.any() == 0: time.sleep_ms(10) # Wait for acknowledgment ack = uart.read().strip() if ack != b'ACK': print("Failed to receive acknowledgment, retrying...") uart.write(chunk + bytes([checksum])) # Retry sending the chunk uart.write("END\n") # Indicate the end of an image ``` ⬇ This is a code snippit example from the Pico. It send an update on the number or birds that has landed on the feeder to the server. It specifies that the data type is plain text. The server will then use this fact to update an ordinary text document with the current number of bird landings, which can then be read by the webpage through the php file. ``` # Function to send bird count to the server def send_bird_count(count): url = "http://192.168.1.115:8080" # Your server's IP address headers = {'Content-Type': 'text/plain'} try: response = urequests.post(url, data=f"Bird count: {count}", headers=headers) response.close() print("Bird count sent successfully.") except Exception as e: print("Failed to send bird count:", e) ``` I can explain code all day, but i don´t think you are here for that, right? Check out the complete code files over at [Github](https://github.com/Dualarrow88/Connected-Bird-Feeder). Make sure to copy the code from Github the their respective files and then upload those files to their respective devices, and your should have a bird counting, image capturing, wifi connected setup ready to go! PS. Make sure that you change the wifi information in the boot. py file to match your local network! ### Connectivity and Data Transmission Here I will dedicate a few sentenses to my choice of connectivity and data transmission. If the minutiae of this subject doesn´t interest you, like if your only going to use the birdfeeder in the garden outside the window, feel free to skip this section. When making any kind IoT device, the choice of connection will be amongst the first decisions you will have make. There are a reange of different options, each with its strenghts and weaknesses. By comparing range, bandwidth, battery drain and cost, you can find the perfect way of communication for your specific needs. As seen in the image below regular ol' cellular communication can handle both bandwidth and range very sell, but at tha cost of high power consumption. LoRa, or LoRaWAN (Long Range Wide Area Network), excel in range, power and cost, but at the cost of the amount of data it can handle. And wifi and BLE (Bluetooth Low Energy) can handle large amounts of data, but at the cost of range. <div style="text-align: center;"> <img src="https://hackmd.io/_uploads/rkLkYhsYR.png" style="width: 600px;"> </div> <br> Now its all up to you to decide on which on is best for you. If I´m are going it be frank, I did buy the LoRaWAN module for my setup, but it turned out that I did not live in an area covered by the LoRa network, meaning this purchase way useless to me. Had I known about its limitations before I started the course in which I created the birdfeeder, I could have saved myself a few bucks and a couple of Kg of frustration. Use my blunder as a warning to always check the availability and specifications of whichever wireless protocol you are interested in. I personally choose wifi for my setup. This ensured, since images was also sent, that the data was handled in a timely and stable manner. The trade off of lower range was no problem for me as I was to place he bird feeder just outside where the wifi router was placed. Given the short range, I was playing with the thought of using bluetooth communication to feed all the data to a small station which could present the data through a LED-screen. This idea was ulimately classified as scope-creep and scrapped. Given time, I would probably go for the bluetooth and presentation-station to save on power, as I wouldn´t have to have my computer running to keep the local servers up. Below I have tried to visualize how the communication from the bird feeder to the webpage really looks like. It is somewhat simplified as I haven't included how the individual files, like the webpage´s JavaScript, interact inside the system, but it should give you a better overview, nonetheless. <div style="text-align: center;"> <img src="https://hackmd.io/_uploads/H1sB7CiF0.png" style="width: 400px;"> </div> <br> The system uses two local server which handles the communication between bird feeder-computer and computer-webpage. The servers use the simple HTTP transport protocol to handle requests/responses and transfering data. HTTP, or Hypertext Transfer Protocol, is the standard transport protocol of the world wide web, and so it is well developed and ubiquitous. If sensitive information is to be handeled, an alternative it to use HTTPS, the security focused extention to HTTP. --- Let´s take a ride through the system - The bird feeder will send a POST request to the local python server, which reads what kind of data it is receiving and then saves the information to the appropriate document or, in the case of an image, folder. Someone updates the webpage, which prompt the JavaScript to fetch data using a GET request to the Apache server, enabled by XAMPP. The server runs the PHP script, which reads the data from the database and returns a response in JSON format, a format that allows the Javascript to read the information and update the webpage accordingly. --- As soon as a bird activates the camera and an image is taken, the Pico will transmit the data to the server. This is done both so that the server is updated in real time, and the image receives a correct timestamp by the python server, and so that the memory of the camera doesn´t run out, in case of high activity around the feeder. The database will be updated on the bird feed level every 12 hours and the webpage will updated when you.. update the webpage. I did not add an automatic page update function since I felt that would be superfluous for such a small and non-time sensitive application. This approach will also save on both data traffic and power consumption, however small that amount might be. ### Visualisation To present the data that the bird feeder captures, we will build ourselves a webpage. While it is true that I got tired of trying to make fancy visualizations when my attempts with TIG-stack and Docker failed, I also prefer the sense of full control that a self-built webpage offers. Creating this basic webpage is actually quite easy and straight forward, while enabling those interested in coding and webdevelopment endless costumization options. Feel free to costumize to your hearts content! But let´s first get it all up and running. Having already [prepared all the necessary files](https://hackmd.io/Jxcmal-5Su-0EbNFLh6dFA?view#File-Directory), its just a matter of copy and pasting the prepared codes from [Github]() into their respective files on your computer. Once you have done all this, go to the terminal of the server. py file inside your IDE and type `python server.py`. This starts up you server so it can handle all the necessary communications between machine and computer. Next up, start the Xampp control panel and press start on the Apache module. This is all you need to do in here. This enable communication between the computer and the webpage. Next up you go to the web browser of your choice and typ `http://localhost/Visualisation/connected_bird_feeder.html`. This should take you to the webpage that you have copy and pasted so much to get going. Congratulations, you have a way to visualize your data! 🎉✨🏆 You can test the webpage by manually changing the values in the .txt documents or add a jpg file to the "images" folder. After updating the webpage, the new information should be mirrored in the browser. If the webpage update without showing the new information, try using ctrl+F5 (windows) to reload the web page and clear the local cache-memory. The final product should look something like this ⬇ <div style="text-align: center;"> <img src="https://hackmd.io/_uploads/SkW69qjKR.png" style="width: 600px;"> </div> <br> As we have come this far, and finally have a picture of the webpage, we have a natural transition to out next segment. ### Presenting Data, Choices and also Databases This section will probably be a bit messy, as I fell that it doesn´t fit neatly inside this tutorial, but is also needed to check some boxes for the teacher. Stay with me. Or just jump ahead. This dashboard was built using HTML, CSS, and Javascript. As mentioned before, I choose this particuals way of doing things because I like the customizability of this approach. Unmentioned so far is also that I in the previous months read a course where we were to create a webpage with a booking system. This saw my first serious contact with coding and I liked it. As th IoT course rolled around, which this tutorial is a part of, I wanted to expand my knowledge working with webdevelopment. I did try to get [TIG-stack](https://hackmd.io/@lnu-iot/BkwDAimvn) to work, but didn´t manage to. I was going to circle back to [Adafruit IO](https://hackmd.io/@lnu-iot/r1yEtcs55), just to have that box checked, but as development with the webpage progressed and installation and bugfixes consumed precious study hours, I felt that time was running out and I doubled down on my own webpage. As for choice of database, I used the absolute simplest and straight forward way of doing it - using only simple text documents to hold the current status of the bird feeder. When making my own webpage, and considering the small scale and complexity of the project, I did not think it worth including third party suppliers to store my data. The big con of doing this, and having coded the system in this way, is that the two text files, holding bird feed level and bird count data, does not store any history - once the status of the feeder is updated, which is each time a bird activated the camera or when the 12 h feed level check is done, that is the new, and only, data in the text file. This con is some what offset by the fact that every image taken has a timestamp, which allow for good old fashioned manual record keeping. The images that is sent to the server is low resolution representations for at quick overview and a quicker dose of dopamine. The idea was to utilize the built in SD card holder on the camera to store the original, high resolution, image for later extraction. Ultimately, this feature was not implemented in time. I know there are many opportunities for improvements, but this is the end result, given the time we had. I did not have any automation or triggers that would respont do the data. If I had unlimited time and energy, I would have made so that the before mentioned presentation-station would trigger an alarm if the bird feed was running out or if the SD card was filling up. I would also had included calculations to display things like how much feed x amount of birds have eaten and/or how long the feed have lasted, depending on season. ### The End #### Result Below is a video showing the setup in action, from starting the server to seeing the webpage update with new content. I did not get a chance to capture an actual bird, so I made a very realistic simulation, instead. <div style="text-align: center;"> <iframe width="560" height="315" src="https://www.youtube.com/embed/kVETxs4Eufg" frameborder="0" allowfullscreen></iframe> </div> <br> Assortment of images of the setup ⬇ <div style="display: flex; flex-wrap: wrap; gap: 20px;"> <div style="flex: 1 1 30%; text-align: center;"> <img src="https://hackmd.io/_uploads/rytqJE6FR.jpg" alt="Image 1" style="width: 100%;"> <p>The birdfeeder with all of its wiring.</p> </div> <div style="flex: 1 1 30%; text-align: center;"> <img src="https://hackmd.io/_uploads/HJt91VaKR.jpg" alt="Image 3" style="width: 100%;"> <p>A test image to adjust the focus of the lens.</p> </div> <div style="flex: 1 1 30%; text-align: center;"> <img src="https://hackmd.io/_uploads/ryYcyNpKA.jpg" alt="Image 2" style="width: 100%;"> <p>Feeder filled with improvised bird feed.</p> </div> <div style="flex: 1 1 30%; text-align: center;"> <img src="https://hackmd.io/_uploads/H1FSK46FC.png" alt="Image 4" style="width: 100%;"> <p>The bracket for holding the big things in place.</p> </div> <div style="flex: 1 1 30%; text-align: center;"> <img src="https://hackmd.io/_uploads/BJDhuN6tR.png" alt="Image 4" style="width: 100%;"> <p>The center-aligned peg/swing and photo resistor is visible in this image. </div> </div> <br> <div style="text-align: center;"> <img src="https://hackmd.io/_uploads/S1FcyE6Y0.jpg" alt="449465902_314064305118014_6301015284362843718_n" style="width: 400px;"> <p>The bird feeder deployed for its first life test. Something went wrong and the system stopped transmitting data after one hour. Most probably the battery and its lack of voltage. </p> </div> <br> <div style="text-align: center;"> <img src="https://hackmd.io/_uploads/SkW69qjKR.png" alt="449465902_314064305118014_6301015284362843718_n" style="width: 600px;"> <p>Already shown image of the webpage.</p> </div> <br> #### Lessons learned - Do not forgo the use of a breadboard! - The need to plan ahead during the design stage! - Check the specifications! - All batteries are not created equal! - Make sure you have the right jumper wires available before you start! - ChatGPT is an invaluable tool for a beginner coder! - Typos in the code can be infuriating! - Birds does not magically appear just because a bird feeder is installed! <br> #### Bloopers <div style="display: flex; flex-wrap: wrap; gap: 20px;"> <div style="flex: 1 1 30%; text-align: center;"> <img src="https://hackmd.io/_uploads/r1ycw76FA.jpg" alt="Image 1" style="width: 100%;"> <p>The printed peg/swing was actually too long to be placed inside the dispenser. Version 2.0 had a separated hinge, allowing it to be placed correctly in the feeder.</p> </div> <div style="flex: 1 1 30%; text-align: center;"> <img src="https://hackmd.io/_uploads/rJLdY7TYA.jpg" alt="Image 2" style="width: 100%;"> <p>I soldered a couple of these Frankenstein´s monsters, before realizing that I would have needed more of those than I had wire for. I ended up buying a new set of correct wires.</p> </div> <div style="flex: 1 1 30%; text-align: center;"> <img src="https://hackmd.io/_uploads/rkej5mTFR.jpg" alt="Image 3" style="width: 100%;"> <p>I did not think through how the feeded where to be placed. It can not hang straight and it can not stand upright without support under the camera house..</p> </div> <div style="flex: 1 1 30%; text-align: center;"> <img src="https://hackmd.io/_uploads/Hk1H3m6KC.jpg" alt="Image 4" style="width: 100%;"> <p>The bird feeder was not designed with a breadboard in mind. Luckily, when I did decide to use one, I had a mini-breadboard laying around and space for it under the roof of the camera housing. </p> </div> <div style="flex: 1 1 30%; text-align: center;"> <img src="https://hackmd.io/_uploads/SkHrpQTtA.jpg" alt="Image 4" style="width: 100%;"> <p>There was an missunderstanding with the supplier of my battery holder. I ended up buying the wrong connection type.. Nothing like jamming some metal into a socket to solve ones problems, right?</p> </div> </div> <br> <div style="text-align: center;"> <iframe width="560" height="315" src="https://www.youtube.com/embed/ywD7WcpZ1uQ" frameborder="0" allowfullscreen></iframe> <p> Me trying to create a presentation video. The connection was lost somewhere along the way, probably when I was trying to jam all the wiring into place.. </p> </div> <br> #### Reflections I do want to believe that I have been reflective throughout this whole tutorial, but i will try to add a few new toughts here. First off, I couldn´t have done a project of this complexity without using chatGPT as a tool to help me along. No meaning of pretending otherwise. I´d like to take it so far as to coin my way of going about this project as "conversational coding". I did most of my coding via conversations with the AI - everything from code writing, trouble shooting, and modifying the code as need for it arised. All through conversation. One might argue that I have not learned what was supposed to be learned in this course. While this might even be true, I want to argue that without the tool that is AI, I would not have been able to complete my ambition of using a connected camera in this kind of setup. By simply handling this kind of more complex code, and ironing out any kinks through getting every aspect of the code explained to me, I have learned a lot more than I would going through any tutorial out there. Conversational coding kept me focused and engaged throught the whole process, helping me avoid any walls that might otherwise have presented itself, like when I don´t understand something or can´t easily ask someone for clarification. While I agree that I have not learned all the minutiae of coding by repeating the basics and slowly build from there, I have instead learned to effectivly use a tool that can help me achive my IoT goals, regardless - just like the new interactive terminals, as a tool, helped the punch card programmer achive their goals. A new way of doing things - same result, but faster and easier for the user. I have also learned, or re-learned, other important things. Like how you can´t get stuck on details, at the risk of stalling the whole project, or try to get the final product perfect the first time around, and so risk never finishing the project at all. Iterative and trail-and-error development is important for learning and for delivering a superior final product. That is a lesson I´ll bring with me from this course. I hope this has been an interesting read. If not, an AI might be able to compress this whole tutorial into bullet points for you ;) Have a great time! // Robin