natlee77
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • 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 No publishing access yet

        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.

        Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Explore these features while you wait
        Complete general settings
        Bookmark and like published notes
        Write a few more notes
        Complete general settings
        Write a few more notes
        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 New
      • Engagement control
      • Make a copy
      • 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 Note Insights Versions and GitHub Sync Sharing URL Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Engagement control Make a copy 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 No publishing access yet

    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.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Kommunikation ESP8266, MQTT Mosqiuitto, Raspberry Pi 3 B + , Oracle VM -> Ubuntu ![](https://i.imgur.com/4FwHHrV.png) We will publish data via an MQTT broker to computer wirelessly using your ESP8266 -feather huzzah and a button. Then we should forward that message from computer to a virtual machine (VM) using the sockets. message should appear on the console and say: "Button has been pressed". I use MQTT Mosquitto as our broker platform and Arduino IDE to program our ESP8266. <h1>hardwear and softwear:</h1> - Adafruit Feather Huzzah ESP8266, - MQTT Mosqiuitto - Raspberry Pi 3 B + - Oracle VM ->Ubuntu =============================================== # Adafruit Feather Huzzah ESP8266 Datablad https://cdn-learn.adafruit.com/downloads/pdf/adafruit-feather-huzzah-esp8266.pdf Each Feather HUZZAH ESP8266 breakout comes pre-programmed with NodeMCU's Lua interpreter. The CP210x USB to UART Bridge Virtual COM Port (VCP) drivers are required for device operation as a Virtual COM Port to facilitate host communication with CP210x products. download drivers CP210(USB ; COM port) : https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers Arduino kan support other type of boards manufacturer. In our case ESP8266. In Arduino Ide add board esp8266 ,in preferences. ![](https://i.imgur.com/YdqXgPV.png) this link: > http://arduino.esp8266.com/stable/package_esp8266com_index.json ------------- Next, use the Board manager to install the ESP8266 package. ![](https://i.imgur.com/taWiHAp.jpg) you should be able to see and add Esp8266 board. Now Arduino IDE will support it. ![](https://i.imgur.com/1fDQPhc.png) - Control speed , frequency , port ![](https://i.imgur.com/clIvZc2.png) with this code you can test if it connected and see each other ## CODE --- Blinking diod on ESP8266--TEST ``` #define LED_PIN 0 void setup() { pinMode(LED_PIN, OUTPUT); } void loop() { digitalWrite(LED_PIN, HIGH); delay(500); digitalWrite(LED_PIN, LOW); delay(500); } ``` if everything right -- you should have blinking red diod on ESP98266 ---------- NEXT STEP---------- - connect botton to esp8266: - botton 1-->RST - botton 2 --> pin 16 (wake) - lamp resistor --> pin2 (yellow wire) ![](https://i.imgur.com/XoLvldW.jpg) <h2> pins: </h2> **Power pins:** - GND - this is the common ground for all power and logic - BAT - this is the positive voltage to/from the JST jack for the optional Lipoly battery - USB - this is the positive voltage to/from the micro USB jack if connected - EN - this is the 3.3V regulator's enable pin. It's pulled up, so connect to ground to disable the 3.3V regulator - 3V - this is the output from the 3.3V regulator, it can supply 500mA peak (try to keep your current draw under 250mA so you have plenty for the ESP8266's power requirements!) **Logic pins:** This is the general purpose I/O pin set for the microcontroller. All logic is 3.3V The ESP8266 runs on 3.3V power and logic, and unless otherwise specified, GPIO pins are not 5V safe! The analog pin is also 1.0V max! **Serial pins:** - RX and TX are the serial control and bootloading pins, and are how you will spend most of your time communicating with the ESP module - The TX pin is the output from the module and is 3.3V logic. - The RX pin is the input into the module and is 5V compliant (there is a level shifter on this pin) - These are connected through to the CP2104 USB-to-Serial converter so they should not be connected to or used unless you're super sure you want to because you will also be getting the USB traffic on these! **I2C & SPI pins:** - You can use the ESP8266 to control I2C and SPI devices, sensors, outputs, etc. While this is done by 'bitbanging', it works quite well and the ESP8266 is fast enough to match 'Arduino level' speeds. - In theory you can use any pins for I2C and SPI but to make it easier for people using existing Arduino code, libraries, sketches we set up the following: ---I2C SDA = GPIO #4 (default) ---I2C SCL = GPIO #5 (default) - If you want, you can connect to I2C devices using other 2 pins in the Arduino IDE, by calling Wire.pins(sda, scl) before any other Wire code is called (so, do this at the begining of setup() for example - Likewise, you can use SPI on any pins but if you end up using 'hardware SPI' you will want to use the following: ---SPI SCK = GPIO #14 (default) ---SPI MOSI = GPIO #13 (default) ---SPI MISO = GPIO #12 (default) ![](https://i.imgur.com/UjJFsWB.jpg) **GPIO pins:** - This breakout has 9 GPIO: #0, #2, #4, #5, #12, #13, #14, #15, #16 arranged at the top edge of the Feather PCB - All GPIO are 3.3V logic level in and out, and are not 5V compatible. Read the full spec sheet to learn more about the GPIO pin limits, but be aware the maximum current drawn per pin is 12mA. - These pins are general purpose and can be used for any sort of input or output. Most also have the ability to turn on an internal pullup. Many have special functionality: - GPIO #0, which does not have an internal pullup, and is also connected a red LED. This pin is used by the ESP8266 to determine when to boot into the bootloader. If the pin is held low during power-up it will start bootloading! That said, you can always use it as an output, and blink the red LED - note the LED is reverse wired so setting the pin LOW will turn the LED on. - GPIO #2, is also used to detect boot-mode. It also is connected to the blue LED that is near the WiFi antenna. It has a pullup resistor connected to it, and you can use it as any output (like #0) and blink the blue LED. - GPIO #15, is also used to detect boot-mode. It has a pulldown resistor connected to it, make sure this pin isn't pulled high on startup. You can always just use it as an output - GPIO #16 can be used to wake up out of deep-sleep mode, you'll need to connect it to the RESET pin - Also note that GPIO #12/13/14 are the same as the SCK/MOSI/MISO 'SPI' pins! **Analog Pins:** - There is also a single analog input pin called A. This pin has a ~1.0V maximum voltage, so if you have an analog voltage you want to read that is higher, it will have to be divided down to 0 - 1.0V range **Other control pins** We have a few other pins for controlling the ESP8266 - RST - this is the reset pin for the ESP8266, pulled high by default. When pulled down to ground momentarily it will reset the ESP8266 system. This pin is 3.3V logic only - EN (CH_PD) - This is the enable pin for the ESP8266, pulled high by default. When pulled down to ground momentarily it will reset the ESP8266 system. This pin is 3.3V logic only **NC Pins:** The rest of the pins are labeled NC which means Not Connected - they are not connected to anything and are there as placeholders only, to maintain physical compatibility with the other boards in the Feather line! ![](https://i.imgur.com/4lPWGN2.png) ![](https://i.imgur.com/N4JEvVv.jpg) <h2> ESP8266 genom aurdino Ide(code) publish to broker mqtt </h2> Implementing the ESP8266 MQTT client using PubsubClient library (Arduino Client for MQTT) https://github.com/knolleary/pubsubclient Once we have a big picture of the scenario where we want to use our ESP8266, we can start coding the MQTT client. To simplify the client development we will use the PubsubClient library. Therefore, you have to import it into your project. The code is shown below: (it is not 100 % sure ) ``` #include <Arduino.h> #include <ESP8266WiFi.h> #include <PubSubClient.h> #define ledPin 2 #define wakePin 16 IPAddress mqttServer(192,168,1,142); const char *SSID = "your_ssid"; const char *PWD = "your_wifi_pwd"; long lastime = 0; void callback(char* topic, byte* payload, unsigned int length) { Serial.println("Callback"); Serial.println((char) payload[0]); } WiFiClient wifiClient = WiFiClient(); PubSubClient mqttClient(mqttServer, 1883, callback, wifiClient); void connectToWiFi() { Serial.print("Connecting to "); Serial.println(SSID); WiFi.begin(SSID, PWD); while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(500); } Serial.print("Connected - "); //Serial.println(WiFi.localIP); } void reconnect() { Serial.println("Connecting to MQTT Broker..."); while (!mqttClient.connected()) { Serial.println("Reconnecting to MQTT Broker.."); String clientId = "ESP8266Client-"; clientId += String(random(0xffff), HEX); if (mqttClient.connect(clientId.c_str())) { Serial.println("Connected."); // subscribe to topic } } } //------------------------------- void setup() { Serial.begin(115200); } void loop() { if (!mqttClient.connected()) reconnect(); mqttClient.loop(); // button while(!Serial) { Serial.println("---------------- ");// print line before and after Button Press Serial.println("Button Pressed"); Serial.println("---------------- ");// print line connectToWiFi(); ESP.deepSleep(wakePin); } else { Serial.println("Connection failed "); } // Publishing data to MQTT /* long now = millis(); if(now - lastime > 10000) { Serial.println("Publishing data.."); // read temperature from sensor mqttClient.publish("/esp8266/temperature", data); // read humidity from sensor mqttClient.publish("/esp8266/humidity", data); lastime = now; }*/ } ``` Code description: - we import the definitions to use the Pubsubclient. - we define the MQTT broker IP address where the ESP8266 connects to. - we create the PubSubClient MQTT client: `PubSubClient mqttClient(mqttServer, 1883, callback, wifiClient);` 1883 is the MQTT broker port - The callback is the function to call when the ESP8266 receives a message through the MQTT. By now we can skip it, we will use this option later when the ESP8266 will subscribe the to MQTT channel. - In the reconnect() method, the code handles the connection to the MQTT and the disconnection event. ![](https://i.imgur.com/EK7wzgT.png) ====================================== # MQTT Mosquitto Connections Broker MQTT Broker: test.mosquitto.org **TCP Port:** 1883 : MQTT, unencrypted 8883 : MQTT, encrypted 8884 : MQTT, encrypted, client certificate required **Websocket Port: ** 8080 : MQTT over WebSockets, unencrypted 8081 : MQTT over WebSockets, encrypted Mosquitto MQTT protocol –https://hackmd.io/nOyVQIWoTuaSjDqPbqwpvg **Code:** ====================================== # Raspberry Pi 3 B + General schema ![](https://i.imgur.com/8gWJDZ3.png) ![](https://i.imgur.com/wVmzLIq.jpg) #operative system: -20 Best Operating Systems You Can Run on Raspberry Pi in 2020 -https://www.fossmint.com/operating-systems-for-raspberry-pi/ ======================================= # Oracle VM -> Ubuntu (Linux) <h3> Oracle virtual maskine, VM VirtualBox Manager </h3> ![](https://i.imgur.com/AiHzDQs.png) - oracle download: https://www.virtualbox.org/ - ubuntu download: https://ubuntu.com/download/desktop - Install Ubuntu on Oracle VirtualBox guid: https://brb.nci.nih.gov/seqtools/installUbuntu.html - Create Virtual maskine - it has error in my , I need adjust i BIOS ![](https://i.imgur.com/mBNsujV.png) - adjust in BIOS: How to Enable Intel Virtualization Technology VT-X in BIOS https://techsviewer.com/enable-intel-virtualization-technology-vt-x-bios/#:~:text=VT-X%20is%20one%20of%20the%20two%20versions%20of,software%20that%20allow%20you%20to%20virtualize%20your%20computer. - Power on the machine -> open the BIOS (Delete || F2). - Open the Processor submenu The processor settings menu may be hidden in the Chipset, Advanced CPU Configuration or Northbridge. - Enable Intel Virtualization Technology (also known as Intel VT) or AMD-V depending on the brand of the processor. ========================================== --------------------<!-- hitwebcounter Code START --> <a href="https://www.hitwebcounter.com" target="_blank"> <img src="https://hitwebcounter.com/counter/counter.php?page=7730635&style=0036&nbdigits=5&type=page&initCount=0" title="Total Website Hits" Alt="Web Hits" border="0" /></a>

    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
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    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