Showing posts with label Intel Edison. Show all posts
Showing posts with label Intel Edison. Show all posts

Tuesday, May 3, 2016

Fun with RGB LED

People often need home lighting control in their lives. These individuals can easily find relevant products which often use different methods to reach their goal. One of the method is LED lighting, which uses new principles, materials, and means of control. All signs point to a significant increase in the use of LED lighting systems, replacement lamps, and retrofits worldwide, with the greatest growth in general illumination applications.

An RGB LED is actually three LEDs, red, green, and blue inside one package, A single LED die can only emit monochromatic light which could be one of the three primary colors - red, green and blue, known as RGB. To realize more colors, three LED dies need to be used together for RGB color mixing. By controlling the brightness of each of the individual LEDs you can mix pretty much any color you want. Using an RGB LED you can cycle through all colors. Useful to make, Mood Lamp, expressive robot or cool light effects.


Credit: Pavan Kumar Jarmale
Credit: Pavan Kumar Jarmale

Idea

 

Most Android-powered devices have built-in sensors that measure motion, orientation, and various environmental conditions. These sensors are capable of providing raw data with high precision and accuracy. By using Accelerometer and Magnetometer, we can calculate the orientation (tilt) around Y-axis (Roll) and we can control the color variations of an RGB LED which is connected to Intel Edison based on these angles over Bluetooth.



How it works

 

Android device comes with few built-in sensors amongst those we have used accelerometer and magnetometer. Accelerometer data will contain noise in its output therefore will not be able to give stable values. To overcome this, we combined magnetometer data with accelerometer data to get stable orientation values / angles. The data is the rotational angle from 0 degree to 360 degrees. In Intel Edison, these values are mapped to change in the Intensity of the Red, Green and Blue colors. By changing the duty cycle of the Pulse Width Modulated signal, we can change the brightness of the LED. A particular color when varied can be kept constant by turning off the switch in the app UI or by disconnecting the Bluetooth connection.


Hardware 

 

3. Android Smartphone (Accelerometer and Magnetometer are must)
5. Wires / Connectors


Setup

 

1. Connect Red LED pin to pin 3 of Intel Edison via 220 Ohm resistor
2. Connect Blue LED pin to pin 5 of Intel Edison via 220 Ohm resistor
3. Connect Green LED pin to pin 6 of Intel Edison via 220 Ohm resistor
4. Connect Anode LED pin to 3.3 V supply of Intel Edison



Credit: Mukesh G
Credit: Mukesh G


Software

 

On Android: 

Build the BTRGBControl project using Android Studio and upload the generated apk to your smartphone.
 OR
Download the apk from this link.

On Edison:

  • Bluetooth-SPP Python wrapper
  • PyBluez
The above two application packages are Intel Edison specific. To install and run the program, please follow this link.



Outcome


The outcomes of the project are as follows:

1. Orientation from 180deg to 360deg gives luminous light. Each angle when the
2. Gave better results when the LED was powered at 5V than when it was powered at 3.3V.
3. In one of the program, the red and blue remains constant and green varies at the extreme end of orientation. The other program portrays that blue and green remains constant and red varies at the extreme end of orientation. Similarly, LED can produce many colors by varying the combinations of R, G and B.
4. The color can be kept constant by turning off the switch in the app UI or by disconnecting the Bluetooth connection.


Demo

 






Real life Connect


Using the most simple and direct method, the idea empowers people to control their personal lighting environment from their mobile device. You can easily customize your lighting colors to match your desired mood and atmosphere, transforms your living room into a dance floor and simulate calming moonlight to improve sleep and enhance rest, mimics the sunrise in the morning and synchronize your music with lighting effects. Similarly, we can apply the same concept to control other home appliances.


Credits

On Edison, program was written by Kiran Hegde (Email: kiranmadansar@gmail.com)


Wednesday, November 4, 2015

Boot Intel Edison from SD card (With Debian or Ubilinux)

This tutorial describes a way to boot an Edison board with the Root Filesystem on an external storage (SD card or USB stick). The kernel and bootloader remain on the local eMMC. For now, we are not able to boot a kernel from an external storage.

Before following any of these steps, make sure you have booted ubilinux or debian os (from Emutexlabs) on Intel Edison.


1. Prepare External Storage (MicroSD Card)

 

  • You need to have a SD card formatted with ext4 file system to store the root file system
  • On your desktop computer with Linux installed, using GParted, format your SD card using ext4 file-system. Eject the SD Card and insert it back



  • Download and unpack Debian image from emutexlabs website. In the unpacked directory (with the "flashall.sh" script) run the following commands to prepare the SD card. These commands mount the edison-image-edison.ext4 rootfs image and copy the contents onto the SD card (be sure to be root to do that)


     
  • In the unpacked directory,
sudo su
mkdir Rootfs
mount ./edison-image-edison.ext4 Rootfs
cp -a Rootfs/* /media/saru/eb361b92-c285-44a6-9f32-da393c879487
sync

  • Now, eject the SD Card and ready to boot


2. Find out the SD card device name 

 

On a running Edison board, plug your formatted SD card and get the device name. 
  • Run the below command, 
dmesg | tail -n 10

Here, the SD card device is “/dev/mmcblk1” and the partition we’ve created is "/dev/mmcblk1p1"

 

3. Boot the board using SD card



Debian system on Edison, does not mount the microsd card automatically. To mount sdcard at boot, modify the /etc/fstab system file in edison.
  • Find the UUID for the sd card 
blkid 

  • add an entry for the partition to automount it at startup. Add file system, mount point, type, options, dump and pass information of sdcard partition to fstab file and save it. Example, the format looks like below,
           /dev/sdcX      /media/sdcard    ext4    defaults    0     0
nano /etc/fstab
#Add an entry for the partition
UUID=eb361b92-c285-44a6-9f32-da393c879487    /media/sdcard    ext4    defaults    0 0

mkdir -p /media/sdcard/
reboot
 After reboot, debian os automatically mounts the sdcard.


To boot using the external device, you need to modify the U-Boot environment variable named "mmc-bootargs" with kernel boot arguments. We cannot modify U-Boot environment variables from edison linux console in debian os. It is possible only in U-Boot command prompt.


Note:    
To modify U-Boot env variables, u-boot and u-boot-tools packages are available in debian repository. The tools fw_printenv/fw_setenv in the u-boot source tree normally work with MTD partitions but they don’t support MMC.


To modify u-boot env variables ,during the boot, on the serial console, when it prompts to press a key to stop booting, press any key and then run the following commands in the U-Boot command prompt.

> setenv mmc-bootargs 'setenv bootargs root=${myrootfs} rootdelay=3 rootfstype=ext4 ${bootargs_console} ${bootargs_debug} systemd.unit=${bootargs_target}.target hardware_id=${hardware_id} g_multi.iSerialNumber=${serial#} g_multi.dev_addr=${usb0addr}'

> setenv myrootfs '/dev/mmcblk1p1'

> setenv myrootfs_sdcard /dev/mmcblk1p1

> setenv myrootfs_emmc PARTUUID=012b3303-34ac-284d-99b4-34e03a2335f4

> setenv do_boot_emmc 'setenv myrootfs ${myrootfs_emmc}; run do_boot'

> setenv do_boot_sdcard 'setenv myrootfs ${myrootfs_sdcard}; run do_boot'

> setenv bootdelay 5

> saveenv

> run do_boot_sdcard



After boot, verify that you are using rootfs stored on your external device.


Note: 
If you want to switch to eMMC just occasionally, during the boot, on the serial console, when it prompts to press a key to stop booting, press any key and then run the below command in the U-Boot command prompt that appears:
> run do_boot_emmc

Fun with RGB LED

People often need home lighting control in their lives. These individuals can easily find relevant products which often use different meth...