Jump to content
Electronics-Lab.com Community

Search the Community

Showing results for tags 'sensor'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Electronics Forums
    • Projects Q/A
    • Datasheet/Parts requests
    • Electronic Projects Design/Ideas
    • Power Electronics
    • Service Manuals
    • Theory articles
    • Electronics chit chat
    • Microelectronics
    • Electronic Resources
  • Related to Electronics
    • Spice Simulation - PCB design
    • Inventive/New Ideas
    • Mechanical constructions/Hardware
    • Sell/Buy electronics - Job offer/requests
    • Components trade
    • High Voltage Stuff
    • Electronic Gadgets
  • General
    • Announcements
    • Feedback/Comments
    • General
  • Salvage Area

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Yahoo


Skype


Location


Interests

Found 4 results

  1. In this blog, we'll explore how to create a web-based temperature monitor using the Thingy:52 sensor and the Web Bluetooth API. This project will guide you through setting up the hardware, connecting it to your web application via Bluetooth, and displaying the real-time temperature data on a web chart. Let's get started! Components Required Thingy:52 Computer or mobile device with Bluetooth support A web server to host your web application (optional) Setting Up Thingy:52 Thingy:52 is a compact, versatile sensor platform designed for IoT applications. It features various sensors, including temperature, humidity, air quality, and more. Before diving into the code, ensure your Thingy:52 is powered on and ready for Bluetooth connections. Get PCBs for Your Projects Manufactured You must check out PCBWAY for ordering PCBs online for cheap! You get 10 good-quality PCBs manufactured and shipped to your doorstep for cheap. You will also get a discount on shipping on your first order. Upload your Gerber files onto PCBWAY to get them manufactured with good quality and quick turnaround time. PCBWay now could provide a complete product solution, from design to enclosure production. Check out their online Gerber viewer function. With reward points, you can get free stuff from their gift shop. Also, check out this useful blog on PCBWay Plugin for KiCad from here. Using this plugin, you can directly order PCBs in just one click after completing your design in KiCad. Creating the Web Application 1. Setting Up the HTML Structure Create an HTML file to serve as the structure of your web application. This file will include the necessary elements for connecting to Thingy:52 and displaying the temperature data. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Thingy:52 Temperature Monitor</title> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> </head> <body> <h1>Thingy:52 Temperature Monitor</h1> <button id="connectButton">Connect</button> <canvas id="temperatureChart" width="400" height="200"></canvas> <p id="temperatureData">Temperature: --°C</p> <script src="main.js"></script> </body> </html> 2. Adding the JavaScript Logic Next, create a JavaScript file (main.js) to handle the Bluetooth connection, read the temperature data, and update the chart. Initialize Chart.js First, let's initialize a line chart using Chart.js to display the temperature data. const ctx = document.getElementById('temperatureChart').getContext('2d'); const temperatureChart = new Chart(ctx, { type: 'line', data: { labels: [], datasets: [{ label: 'Temperature (°C)', data: [], borderColor: 'rgba(75, 192, 192, 1)', borderWidth: 1 }] }, options: { scales: { x: { type: 'time', time: { unit: 'second' } }, y: { beginAtZero: true } } } }); Connect to Thingy:52 via Web Bluetooth Add the following code to handle the Bluetooth connection and read the temperature data from Thingy:52. const connectButton = document.getElementById('connectButton'); const temperatureData = document.getElementById('temperatureData'); let thingyDevice; let temperatureCharacteristic; connectButton.addEventListener('click', async () => { try { thingyDevice = await navigator.bluetooth.requestDevice({ filters: [{ services: ['ef680200-9b35-4933-9b10-52ffa9740042'] }] }); const server = await thingyDevice.gatt.connect(); const service = await server.getPrimaryService('ef680200-9b35-4933-9b10-52ffa9740042'); temperatureCharacteristic = await service.getCharacteristic('ef680201-9b35-4933-9b10-52ffa9740042'); temperatureCharacteristic.addEventListener('characteristicvaluechanged', handleTemperatureData); await temperatureCharacteristic.startNotifications(); console.log('Connected to Thingy:52'); } catch (error) { console.error('Error connecting to Thingy:52', error); } }); function handleTemperatureData(event) { const value = event.target.value.getUint8(0); const temperature = value / 10; temperatureData.textContent = `Temperature: ${temperature}°C`; const currentTime = new Date(); temperatureChart.data.labels.push(currentTime); temperatureChart.data.datasets[0].data.push(temperature); temperatureChart.update(); } This code handles the following tasks: Connects to the Thingy:52 device via Bluetooth. Subscribes to the temperature characteristic to receive updates. Reads and processes the temperature data. Updates the Chart.js chart with the new temperature data. Running the Web Application To run the web application, you can simply open the index.html file in a web browser that supports the Web Bluetooth API (e.g., Chrome, Edge). If you're hosting the application on a web server, ensure the server supports HTTPS, as Web Bluetooth requires a secure context. Complete Code: Here is the complete HTML file. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Thingy:52 Temperature Monitor</title> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <style> :root { --bg-primary: #1a1a1a; --bg-secondary: #2d2d2d; --text-primary: #ffffff; --accent-color: #00ff9d; --accent-hover: #00cc7d; --error-color: #ff4444; --gradient-start: #2d2d2d; --gradient-end: #1a1a1a; } * { margin: 0; padding: 0; box-sizing: border-box; transition: all 0.3s ease; } body { font-family: 'Segoe UI', sans-serif; background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end)); color: var(--text-primary); padding: 2rem; min-height: 100vh; } .container { max-width: 900px; margin: 2rem auto; background: rgba(45, 45, 45, 0.8); padding: 3rem; border-radius: 1.5rem; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4); backdrop-filter: blur(20px); } h1 { text-align: center; margin-bottom: 3rem; font-size: 3rem; letter-spacing: 2px; background: linear-gradient(45deg, var(--accent-color), #00ffff, var(--accent-color)); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: gradient 3s ease infinite; } .chart-container { height: 450px; margin: 3rem 0; padding: 1.5rem; background: rgba(0, 0, 0, 0.3); border-radius: 1.5rem; border: 2px solid rgba(255, 255, 255, 0.1); transition: all 0.4s ease; } .chart-container:hover { transform: translateY(-5px); } button { padding: 0.8rem 1.5rem; background: linear-gradient(45deg, var(--accent-color), #00ffff); color: var(--bg-primary); border: none; border-radius: 0.5rem; cursor: pointer; font-size: 1rem; font-weight: bold; display: block; margin: 0 auto; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(0, 255, 157, 0.2); } button:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 255, 157, 0.3); } button:active { transform: translateY(0); } .status { font-size: 1.2rem; padding: 1.2rem; margin: 2rem 0; border-radius: 0.5rem; text-align: center; background: rgba(0, 0, 0, 0.3); border: none; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); } .error { background: rgba(255, 68, 68, 0.2); border-color: var(--error-color); animation: shake 0.5s ease-in-out; } @keyframes gradient { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } } @keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } } </style> </head> <body> <div class="container"> <h1>Thingy:52 Temperature Monitor</h1> <button id="connectButton">Connect to Thingy:52</button> <div id="statusText" class="status">Ready to connect</div> <div class="chart-container"> <canvas id="tempChart"></canvas> </div> </div> <script> const THINGY_SERVICE_UUID = 'ef680200-9b35-4933-9b10-52ffa9740042'; const TEMP_CHARACTERISTIC_UUID = 'ef680201-9b35-4933-9b10-52ffa9740042'; let device = null; let tempChart = null; const MAX_DATA_POINTS = 10; const UPDATE_INTERVAL = 2000; // 5 seconds let lastUpdateTime = 0; function initChart() { const ctx = document.getElementById('tempChart').getContext('2d'); const style = getComputedStyle(document.documentElement); const accentColor = style.getPropertyValue('--accent-color').trim(); const textColor = style.getPropertyValue('--text-primary').trim(); tempChart = new Chart(ctx, { type: 'line', data: { labels: [], datasets: [{ label: 'Temperature °C', data: [], borderColor: accentColor, backgroundColor: 'rgba(0, 255, 157, 0.1)', tension: 0.4, borderWidth: 3, pointRadius: 6, pointBackgroundColor: accentColor, pointHoverRadius: 8, pointHoverBorderWidth: 3, fill: true }] }, options: { responsive: true, maintainAspectRatio: false, animations: { tension: { duration: 1000, easing: 'ease-in-out' } }, plugins: { legend: { labels: { color: textColor, font: { size: 16, weight: 'bold' }, padding: 20 } }, tooltip: { backgroundColor: 'rgba(0, 0, 0, 0.8)', titleFont: { size: 16 }, bodyFont: { size: 14 }, padding: 12 } }, scales: { y: { beginAtZero: false, ticks: { color: textColor, font: { size: 14 }, padding: 10 }, grid: { color: 'rgba(255, 255, 255, 0.1)' } }, x: { ticks: { color: textColor, font: { size: 14 }, padding: 10 }, grid: { color: 'rgba(255, 255, 255, 0.1)' } } } } }); } function updateChart(temperature) { const timeString = new Date().toLocaleTimeString(); tempChart.data.labels.push(timeString); tempChart.data.datasets[0].data.push(temperature); if (tempChart.data.labels.length > MAX_DATA_POINTS) { tempChart.data.labels.shift(); tempChart.data.datasets[0].data.shift(); } tempChart.update('none'); } function parseTemperature(value) { const dataView = new DataView(value.buffer); const integer = dataView.getInt8(0); const decimal = dataView.getUint8(1); return integer + decimal/100.0; } function updateTemperatureDisplay(temperature) { const statusEl = document.getElementById('statusText'); const tempStr = temperature.toFixed(1); statusEl.innerHTML = ` <div style="font-size: 2rem; margin-bottom: 0.5rem"> ${tempStr}°C </div> <div style="font-size: 0.9rem; opacity: 0.8"> Last updated: ${new Date().toLocaleTimeString()} </div> `; } async function connectToThingy() { try { device = await navigator.bluetooth.requestDevice({ filters: [{ namePrefix: 'Thingy' }], optionalServices: [THINGY_SERVICE_UUID] }); const server = await device.gatt.connect(); const service = await server.getPrimaryService(THINGY_SERVICE_UUID); const characteristic = await service.getCharacteristic(TEMP_CHARACTERISTIC_UUID); await characteristic.startNotifications(); characteristic.addEventListener('characteristicvaluechanged', (event) => { const now = Date.now(); if (now - lastUpdateTime >= UPDATE_INTERVAL) { const temperature = parseTemperature(event.target.value); updateChart(temperature); updateTemperatureDisplay(temperature); lastUpdateTime = now; } }); document.getElementById('connectButton').textContent = 'Disconnect'; document.getElementById('statusText').textContent = 'Connected'; } catch (error) { console.error('Error:', error); document.getElementById('statusText').textContent = error.message; document.getElementById('statusText').classList.add('error'); } } window.addEventListener('load', () => { initChart(); document.getElementById('connectButton').addEventListener('click', async () => { if (device?.gatt?.connected) { await device.gatt.disconnect(); document.getElementById('connectButton').textContent = 'Connect to Thingy:52'; document.getElementById('statusText').textContent = 'Disconnected'; } else { await connectToThingy(); } }); }); </script> </body> </html> Conclusion In this blog, we've demonstrated how to create a web-based temperature monitor using the Thingy:52 sensor and the Web Bluetooth API. This project showcases the power of Web Bluetooth for building real-time, interactive IoT applications. You can further enhance this project by adding features such as data logging, and alerts, or integrating other sensors from the Thingy:52 platform. Happy coding
  2. Best Arduino sensors - for beginners electronics projects What is Sensor? A Sensor is a device used as the primary element that measures physical value and converts it into an electrical signal. Also, we can say that the sensor is a transducer. It measures temperature, distance, light, sound, etc. Sensors and actuators widely used in Arduino projects. These sensors come with a kit or can be purchased separately. Some of them are compatible with Arduino Uno boards and also Raspberry Pi and other electronics modules. There are lots of Arduino sensors kits available in the market. How many types of Arduino Sensors? There are a lot of sensors used in electronics projects, e.g. robotics cars, moving objects, flying drones, IoT(internet of things), sound and light operated, etc. Here a list of 45 in 1 electronic sensor that comes with an Arduino sensors kit, and the details of their applications. Analog temperature Sensors KY 013 temperature sensor KY-013 is an analog temperature sensor module. It includes an NTC (negative temperature coefficient) thermistor. KY-13 used a bead-type thermistor, made with platinum and alloy materials. It can measure temperature from -55°C to +155°C. Digital temperature module Digital temperature Sensor The digital temperature sensor contains DS18B20, a digital thermometer used for measuring the temperature of any substance. Digital temperature module This is a KY-028 module used with an Arduino for temperature indication purposes. NTC thermistor is the main sensor and LM393 a dual differential comparator (use two inputs, after comparison, the larger value to be sent to output). Temperature and Humidity module This is a DHT11 sensor for temperature and humidity measurement. The range for temperature measurement is 0 to 50 ℃. Operating voltage from 3.3 to 5V DC. The humidity measuring range is 20 to 95% RH(relative humidity). Arduino IR sensor IR sensor contains infrared led (transmitter) and receiver led (photodiode). It transmits infrared light, and a photodiode detects the light. We used a potentiometer for distance adjustment. Light Dependent Resistor(LDR) LDR works on the principal photoconductivity. It is a light sensor that is used in automatic light-operated circuits. As it gets light on its surface, it generates a few electrons. Joystick Module Joystick module used in robotics projects. It has an x-axis, y-axis angle, and switch option. It is very useful for robotics arms and moving objects. Metal Touch Sensor It is a KY- 036 metal touch sensor used as a detection sensor. If a person/human body touches this sensor tip, it will trigger and generate an output. We can use a Led as an indication or buzzer for a sound alarm. It has a MOSFET(touch sensor) and LM386(amplifier). Sound sensor This is a high-sensitivity, sound sensor module. It has a condenser mic and is used for sound detection. Arduino Laser sensor Arduino laser sensors are very useful for switching projects. It's based on the detection of motion. It also comes with a transmitter and receiver. Arduino optical switch Arduino optical switch used in counting projects. It also used for interrupting devices, measuring, and counting RPM purposes. Passive buzzer sensor The passive sensor is used for beep/sound alarm for many electronic circuits. It is known as the KY-012 module. It required only low DC voltage(1.5 ~ 12) to activate. Vibration sensor A vibration sensor is a very simple module used to sense minor vibration. We can use it at the main door. Arduino Shock sensor This sensor is known as a knock sensor and a shock sensor. We used it for door-opening projects. Arduino component kit We use many electronic pieces of equipment in our routine life that may include Arduino sensors or other electronic IoT sensors and actuators. If we learn how to use them, we can understand the principle behind devices.
  3. Hi guys,Lovely community here. So i got into the bandwagon of the ESP32. I am planning to build an entire data acquisition built around the ESP32. Would really appreciate it much if i were to get help from all of you. It would be a learning experience for all of us. So basically here are my project details and list of components being used.A 32 Channel Data acquisition system with 30 sensors measuring strain (momentarily using a metal gage strain sensor of 120Ohm being fed to a quarter bridge circuit) and 2 temperature sensors(PT100). I would like an acquisition speed of atleast 1000Samples/Sec per channel. So here is my idea as of now.32 Sensors connected to its each wheatstones bridge. The amplifier is done using the XR18910/XR10910, which is a 16:1 bridge Mux interface with selectable gain. I have attached link https://www.exar.com/content/document.a ... rt=XR10910The XR18911 can be controlled via I2C link. it does all the amplification necessary. I will need to use 2 XR10910 or 4 XR18911(8:1 sensor interface). And then finally controlled by our LEGENDARY ESP32 which converts the analog data to digital. and with the help of wifi to transmit it to a computer where it can be collected in an excel file along with time of capture.Could you guys kindly help me out on how i am to proceed with programming of the ESP32. I would really prefer to use Arduino IDE guys, as that seems to simplify things. Also if there is any improvements that could be added to the circuit. Kindly let me know. Please let me know if you need more details(Picture attached). Thank you
  4. Hello. I made this circuit below: http://www.diy-electronic-projects.com/p270-Everything-that-moves-ALARM The circuit does not appear to be working properly, and I would like to get it working. To be honest with you, I never heard of a human body detector using eddy currents. The first image shows the pulses on the gate of the mosfet. They appear to be low duty cycle(around 15-20%). The other images show the pulses received by the smaller coil(5"/100T/26ga enamel wire) placed in the center of the 24ga speaker wire/5 foot diameter (5T) TX loop. The circuit can be set, but you cannot get it to trigger unless you actually touch/move the RX coil.The RX signal on the scope is more or less sinusoidal. Operating voltage is around 13.5vdc. Hopefully you can assist me. There is a 1000uF electrolytic capacitor across the power rail. Pins 4/8 on the cmos 555 and pin #14 of the 4093 are connected together to the + rail. Thanks,Doug
×
  • Create New...