Elin Andersson Lundell
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Applied IoT Sangria pump **By**: Elin Andersson Lundell **Username**: ea225jp ## Project Description This project aims to create a device that can be used during a “sittning” (a dinner often hosted by a university chapter). During this dinner, sangria needs to be dispensed to the five tables with thirsty, and above the age of 18, students. This device aims to dispense sangria with the help of a collision sensor, track how much sangria has been dispensed, and notify when the sangria needs to be refilled. The time needed for this project is estimated to be around 25 hours, given that you have the same code resources that I had. The most time-consuming part of this project is connecting the hardware and configuring ADAFruit to showcase the correct data. ## Objective I chose this project because I have been given the responsibility of fixing a sangria pump for one of my chapter's dinners. This is a yearly tradition and in the past, the pump has been made from very simple materials. My ambition was, however, to make an actual pump and not just a tube in a tank. The device will also allow us to keep track of how much alcohol has been consumed by the students, which can be good when determining if they should have any more. By doing this project, you will learn how to use the Raspberry Pi Pico W to control devices with larger voltages by using a relay. This is something that can be useful in the future as it is somewhat restricting to only handle low voltage devices. After this project, you can, for example, create your own automatic fanning system for the hot summer days. ## Materials The materials used for this project are: - **Raspberry Pi Pico W**: The given microcontroller for this course. This will be used to control the device with code that we have written on the computer and uploaded to it. It has multiple pins which can, for example, be used for input or output. It also has an RP2040 microcontroller chip and can be connected using a USB to micro-USB cable. More specifications can be found here: [Raspberry Pi Pico Documentation](https://raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html) - **Water pump**: I used a DC 12V pump that I found in my garage with a flow rate of 0.3 liters per second. See the picture for the exact product. - **Collision detector IR**: Uses IR-LED and an IR-receiver to detect if an area is in the dark or in the light. It also has two dials that allow the sensitivity and detected distance to be adjusted. - **Power supply for the water pump**: This was made by cutting up a random charger and exposing its positive and negative wires. - **Power supply for the Raspberry Pi Pico W**: This was a micro-USB charger. - **Relay 5v DC**: A relay that will control the pump’s power supply. This will act as a “switch” that allows the pump to turn on or off depending on the signals from the microcontroller. - **Cables, male to male** - **Cables, male to female** - **Tank with known capacity** - **Electric tape**: Used to secure the connections between the pump and the pump’s power supply. - **Painters tape** - **Plastic bags** - **Jug** - **Hose** ## Material Cost This table shows how much each component costs. Keep in mind that I found materials in my house so the price is only an estimate. Additionally, not all materials are listed here, such as tape, as it often can be found at home. As for the pump, I used it because I had it at home and I recommend you to find one that is cheaper than the one listed here. This can be found on Amazon. | Name | Cost (SEK) | Link | |------------------------|------------|----------------------------------------------------------------------------------------| | Raspberry Pi Pico W | 89 | [Electrokit](https://www.electrokit.com/raspberry-pi-pico-w) | | Water pump | 400 | [IMNASA](https://www.imnasa.com/en/bilge-pumps/in-line-pump-280gph-12v-44250853) | | Collision detector IR | 39 | [Electrokit](https://www.electrokit.com/kollisionssensor-ir) | | Relay 5V | 99.90 | [Kjell & Company](https://www.kjell.com/se/produkter/el-verktyg/elektronik/utvecklingskit/arduino/moduler/luxorparts-relamodul-for-arduino-1x-p87032) | | Breadboard | 69 | [Electrokit](https://www.electrokit.com/kopplingsdack-840-anslutningar) | | Hose | 39 | | | **Total** | **736** | | ## Computer Setup I chose Visual Studio Code, commonly shortened to VS Code, as my IDE. To install it, please go to this link and follow the instructions for your system: [VS Code Installation](https://code.visualstudio.com/docs) I used the PyMkr extension to flash (upload) the code to the microcontroller. To install it, navigate to the extensions panel in VS Code and search and install PyMkr. To flash the code, follow the following tutorial: [PyMkr Tutorial](https://hackmd.io/@lnu-iot/rkFw7gao_) I followed this tutorial to set up the IDE. Do the same and follow the instructions for your operating system: [IDE Setup Tutorial](https://hackmd.io/@lnu-iot/rkiTJj8O9) ## Assembling / Putting It Together To assemble the pump system, look at the picture below. ![2024-07-01_13-37](https://hackmd.io/_uploads/BkDeBzlwC.jpg) A thing that is important to note is that the negative wire from the pump is connected to the Normally Open terminal while the negative wire from the power supply is connected to the Common Terminal. To better understand how relays work, I recommend this video: [Relay Tutorial](https://www.youtube.com/watch?v=mj2kMD0LCR4) This was, by far, the most irritating part of this project as the first relay module I bought was faulty. This led to me wasting several hours just trying to get the relay to switch. To get started, I recommend using the code here with just the relay to get familiar with it. If you bought a cheap relay of Amazon it's also a good way to test if it actually works before you try to do anything to advanced: [Relay Module Code](https://github.com/iot-lnu/pico-w/tree/main/sensor-examples/P28_Relay_Module) ## Platform To showcase the data, I chose ADAFruit IO as it has good integration with Discord. As there will be multiple people working during the dinner when the pump is used, a Discord server is the easiest way of notifying the staff when the sangria needs to be refilled. ADAFruit allows you to create your own dashboard in order to show the data in a way that makes sense for your specific project. To get set up with ADAFruit IO, follow this tutorial: [ADAfruit IO Tutorial](https://hackmd.io/@lnu-iot/r1yEtcs55?utm_source=preview-mode&utm_medium=rec) ## The Code The entire code for this project, except the file containing WiFi and ADAFruit credentials, can be found in this GitHub repository: [Mr.Sangriapump GitHub](https://github.com/chenniebenniebingbang/Mr.Sangriapump) The main part of the code is the logic behind controlling the pump and registering input from the sensor. The code regarding ADAFruit setup and WiFi connection was found in the course GitHub and set up using these tutorials: - [WiFi Setup](https://hackmd.io/@lnu-iot/rJVQizwUh) - [ADAfruit Setup](https://hackmd.io/@lnu-iot/r1yEtcs55?utm_source=preview-mode&utm_medium=rec) ## Transmitting the Data The data is transmitted using WiFi and MQTT. I did not need to think about power consumption as the device will be used during a short amount of time and will have access to constant power. One concern is that the WiFi at the chapter hall is somewhat unreliable. This is solved by letting the device connect to a hotspot hosted by my phone. The data is sent every 8 minutes. This interval was chosen as it should take some time to drink one jug of sangria and, therefore, the data does not need to be collected in smaller intervals. To send the message to the Discord server, Webhook was used as it allows ADAFruit and Discord to be connected. This is how a warning message in Discord looks. ![2024-07-01_13-49](https://hackmd.io/_uploads/SJWu_MevA.jpg) ## Presenting the Data This is the layout of the dashboard. ![2024-07-01_13-38](https://hackmd.io/_uploads/SkIEBfgv0.jpg) The graph shows the consumption of sangria throughout the evening while the value will show how much sangria it is estimated to be left in the tank. The pump status allows us to control if the pump is active or not to prevent people from using it freely. The start value lets us set a starting value which will update the sangria level. This can be used when refilling the tank. ## Final Design Since the dinner is in August, I can’t show the completely finished product. Instead, here's a picture that is as close as I can get. ![2024-07-01_13-40](https://hackmd.io/_uploads/H1LirMxDR.jpg) This is approximately how the device is supposed to sit on the container with the sangria. In August, however, the setup will be much prettier and safer.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully