Skip to content
International Shipping
Wish Lists Cart
0 items

#3 Autonomous Lighting Project With PicoBricks

27 Nov 2023
#3 Autonomous Lighting Project With PicoBricks

It is called the state of being autonomous when electronic systems make a decision based on the data they collect and perform the given task automatically. The components that enable electronic systems to collect data from their environment are called sensors. Many data such as the level of light in the environment, how many degrees the air temperature is, how many lt/min water flow rate, how loud the sound is, are collected by the sensors and transmitted to PicoBricks as electrical signals, that is data. There are many sensors in Picobricks. Knowing how to get data from sensors and how to interpret and use that data will improve project ideas like reading a book improves vocabulary. 

In this project, with PicoBricks, we will enable the LED to turn on when the amount of light decreases in order to understand the working systems of the systems where the lighting is turned on automatically when it gets dark.

Details and Algorithm

Sensors are electronic components that detect data in external environments and send data to microcontrollers. The LDR sensor also detects the amount of light in the environment and sends analog values. In our project, we will first check the incoming data when the environment is light and dark by reading the LDR sensor values, then we will set a limit according to these data, and if the amount of light is below this limit, we will turn off the RGB LED of Picobricks, if not, we will turn off the LED.

Components

1X PicoBricks

Wiring Diagram

You can code and run Picobricks’ modules without wiring. If you are going to use the modules by separating them from the board, you should make the module connections with grove cables.

MicroBlocks Codes of the PicoBricks

You can access the Microblocks codes of the project by dragging the image to the Microblocks Run tab.

MicroPython Codes of the PicoBricks

 


import time
from machine import Pin, ADC
from picobricks import  WS2812
#define the library
ldr = ADC(Pin(27))
ws = WS2812(6, brightness=0.4)
#define the input and output pins
#define colors
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
COLORS = (RED, GREEN, BLUE)
#RGB color Code
while True:#while loop
    print(ldr.read_u16()) #print the value of the LDR sensor to the screen.
    if(ldr.read_u16()>10000):#let's check the ldr sensor
        for color in COLORS:
            #turn on the LDR
            ws.pixels_fill(color)
            ws.pixels_show()
    else:
        ws.pixels_fill((0,0,0))  #turn off the RGB
        ws.pixels_show()

Arduino C Codes of the PicoBricks

 



GitHub Project Page
Prev Post
Next Post

Thanks for subscribing!

This email has been registered!

Shop the look
Choose Options

Edit Option

Have Questions?

Back In Stock Notification

Compare

Product SKUDescription Collection Availability Product Type Other Details

Terms & Conditions

What is Lorem Ipsum? Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Why do we use it? It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
this is just a warning
Login
Shopping Cart
0 items