{"id":689,"date":"2017-10-07T15:03:03","date_gmt":"2017-10-07T14:03:03","guid":{"rendered":"http:\/\/chewett.co.uk\/blog\/?p=689"},"modified":"2017-10-07T15:03:03","modified_gmt":"2017-10-07T14:03:03","slug":"common-cathode-rgb-led-review-code-examples","status":"publish","type":"post","link":"https:\/\/chewett.co.uk\/blog\/689\/common-cathode-rgb-led-review-code-examples\/","title":{"rendered":"Common Cathode RGB LED Review and Code examples"},"content":{"rendered":"<p>Today I am reviewing a basic RGB LED. This includes schematics for using it with an Arduino and code examples.<\/p>\n<p><!--more--><\/p>\n<h2>What can the RGB Light Emitting Diode Do<\/h2>\n<p><a href=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"704\" data-permalink=\"https:\/\/chewett.co.uk\/blog\/689\/common-cathode-rgb-led-review-code-examples\/rgb_led\/\" data-orig-file=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led.jpg?fit=800%2C800&amp;ssl=1\" data-orig-size=\"800,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"rgb_led\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led.jpg?fit=300%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led.jpg?fit=678%2C678&amp;ssl=1\" class=\"alignleft wp-image-704\" src=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led.jpg?resize=300%2C300\" alt=\"\" width=\"300\" height=\"300\" srcset=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led.jpg?w=800&amp;ssl=1 800w, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led.jpg?resize=300%2C300&amp;ssl=1 300w, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led.jpg?resize=768%2C768&amp;ssl=1 768w, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led.jpg?resize=50%2C50&amp;ssl=1 50w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>The RGB common cathode light emitting diode works just like a standard LED but there is one small difference. Instead of having a single colour there are 3 different LED&#8217;s packed into a single one. This LED has 4 pins, a common cathode and a pin for each colour (red, green and blue).<\/p>\n<p>Common cathode means that each LED shares a common GND connection. This means you will only need one GND connection for all the LED&#8217;s.<\/p>\n<table style=\"width: 359px;\">\n<tbody>\n<tr>\n<td style=\"width: 553px;\" colspan=\"3\"><strong>Datasheet Specifications<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 104px;\" rowspan=\"3\"><em>Voltage<\/em><\/td>\n<td style=\"width: 103px;\"><em>Red<\/em><\/td>\n<td style=\"width: 346px;\">1.9 V to 2.5 V<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 103px;\"><em>Green<\/em><\/td>\n<td style=\"width: 346px;\">2.9 V to 3.5 V<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 103px;\"><em>Blue<\/em><\/td>\n<td style=\"width: 346px;\">2.9 V to 3.5 V<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The important thing to remember when using the RGB LED is that the different colour LED&#8217;s\u00a0require different voltages. What makes it more tricky is that the red LED accepts voltages in a completely different range to the green and blue LED&#8217;s. This means that when powering the LED&#8217;s\u00a0you will need to ensure that the resistors are keyed so they LED&#8217;s receive the correct voltage.<\/p>\n<h2>Wiring it up to an Arduino<\/h2>\n<p>To programmatically change the colour of the LED I am wiring the three positive pins to pin 11, 12, and 13 of the Arduino.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led_common_cathode_bb.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"698\" data-permalink=\"https:\/\/chewett.co.uk\/blog\/689\/common-cathode-rgb-led-review-code-examples\/rgb_led_common_cathode_bb\/\" data-orig-file=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led_common_cathode_bb.jpg?fit=1110%2C945&amp;ssl=1\" data-orig-size=\"1110,945\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"rgb_led_common_cathode_bb\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led_common_cathode_bb.jpg?fit=300%2C255&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led_common_cathode_bb.jpg?fit=678%2C577&amp;ssl=1\" class=\"alignleft wp-image-698\" src=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led_common_cathode_bb.jpg?resize=450%2C383\" alt=\"\" width=\"450\" height=\"383\" srcset=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led_common_cathode_bb.jpg?w=1110&amp;ssl=1 1110w, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led_common_cathode_bb.jpg?resize=300%2C255&amp;ssl=1 300w, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led_common_cathode_bb.jpg?resize=1024%2C872&amp;ssl=1 1024w, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led_common_cathode_bb.jpg?resize=768%2C654&amp;ssl=1 768w, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/rgb_led_common_cathode_bb.jpg?resize=50%2C43&amp;ssl=1 50w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/a>When looking at the LED the longest PIN is the common cathode. If you turn the LED so the longest PIN is the second from left as in my diagram the leftmost pin is the red LED.<\/p>\n<p>Going left to right in this orientation the pins are the red LED, common cathode (longest pin), green LED and blue LED.<\/p>\n<p>I am going to be using the <code>digitalWrite<\/code>\u00a0Arduino function which will provide 5 volts from the pin. This means that to ensure I give the LED the correct operating voltage I will need to use a resistor.<\/p>\n<p>I have found that a 150 \u03a9 resistor\u00a0works well for the red LED and a\u00a0100 \u03a9 resistor for the blue and green LED.<\/p>\n<p>As shown in the diagram these are placed between the Arduino pins and the positive pin of the LED. These resistors keep the voltage at an acceptable working range for the\u00a0LED. These values ensure that the LED has enough power to be relatively bright and also not be in danger of damaging it.<\/p>\n<h2>Code example to use the RGB LED<\/h2>\n<p>First I am going to set up a couple <code>#define<\/code>&#8216;s to make my program easily to modify. These define what pins I am going to use for my program and the delay between changing colour.<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">#define BLUE_PIN 13\r\n#define GREEN_PIN 12\r\n#define RED_PIN 11\r\n#define DELAY_VAL 1000<\/pre>\n<p>Once this has been done I set up each LED pin as an output pin. This now lets me write to it as an output to light the LED up.<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">void setup() {\r\n  pinMode(BLUE_PIN, OUTPUT);\r\n  pinMode(GREEN_PIN, OUTPUT);\r\n  pinMode(RED_PIN, OUTPUT);\r\n}<\/pre>\n<p>The final piece of code loops through all the possible colours you can create using your 3 LED&#8217;s. Here I pause for 1 second (1000 milliseconds) after I change each colour.<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n\r\nvoid loop() {\r\n  \/\/Blue\r\n  digitalWrite(BLUE_PIN, HIGH);\r\n  delay(DELAY_VAL);\r\n  \/\/Green\r\n  digitalWrite(BLUE_PIN, LOW);\r\n  digitalWrite(GREEN_PIN, HIGH);\r\n  delay(DELAY_VAL);\r\n  \/\/Red\r\n  digitalWrite(GREEN_PIN, LOW);\r\n  digitalWrite(RED_PIN, HIGH);\r\n  delay(DELAY_VAL);\r\n  digitalWrite(RED_PIN, LOW);\r\n\r\n  \/\/Blue, Green = Cyan\r\n  digitalWrite(BLUE_PIN, HIGH);\r\n  digitalWrite(GREEN_PIN, HIGH);\r\n  delay(DELAY_VAL);\r\n\r\n  \/\/Green, Red = Yellow\r\n  digitalWrite(BLUE_PIN, LOW);\r\n  digitalWrite(RED_PIN, HIGH);\r\n  delay(DELAY_VAL);\r\n\r\n  \/\/Blue, Red = Purple\r\n  digitalWrite(GREEN_PIN, LOW);\r\n  digitalWrite(BLUE_PIN, HIGH);\r\n  delay(DELAY_VAL);\r\n\r\n  \/\/Blue, Green, Red = White\r\n  digitalWrite(BLUE_PIN, HIGH);\r\n  digitalWrite(GREEN_PIN, HIGH);\r\n  digitalWrite(RED_PIN, HIGH);\r\n  delay(DELAY_VAL);\r\n\r\n  \/\/Set all low\r\n  digitalWrite(BLUE_PIN, LOW);\r\n  digitalWrite(GREEN_PIN, LOW);\r\n  digitalWrite(RED_PIN, LOW);\r\n}<\/pre>\n<p>When uploaded this will loop through all the colours waiting a second for each colour.<\/p>\n<h2>Final Review<\/h2>\n<p>I have found these LED&#8217;s really useful to be able to change the colour of the display LED. They use standard voltages and the resistors needed to power them from a 5 volt line are easily obtainable. Being able to light multiple colours at once means you can mix them together. The only issue with mixing them is that when lighting all of them the white is slightly off-white. This off-white colour isn&#8217;t\u00a0a major problem however and is far outweighed by the usability of these.<\/p>\n<p>Since you can configure them to be multiple colours they are useful to projects where you want to display a colour changing status\u00a0light. This makes them a staple in my toolbox when designing circuits that require a status light. <strong>Would buy again!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I am reviewing a basic RGB LED. This includes schematics for using it with an Arduino and code examples.<\/p>\n","protected":false},"author":1,"featured_media":703,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[97],"tags":[132,176,177],"class_list":["post-689","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-electronics","tag-arduino","tag-led","tag-light-emitting-diode"],"wppr_data":{"cwp_meta_box_check":"No"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/post_icon_rgb.jpg?fit=800%2C800&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p2toWX-b7","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1260,"url":"https:\/\/chewett.co.uk\/blog\/1260\/individually-addressable-ws2812b-full-color-led-strip-code-examples-and-review\/","url_meta":{"origin":689,"position":0},"title":"Individually Addressable WS2812B Full Color LED strip Code Examples and Review","author":"Chewett","date":"June 16, 2018","format":false,"excerpt":"Today I review an\u00a0individually addressable WS2812B Full Color LED strip and provide some code examples. Overview of the WS2812B Full Color LED strip The WS2812B Full colour LED strip I purchased is 5 meters long and has 150 LED's on it. Each LED has its LED driver which allows each\u2026","rel":"","context":"In &quot;Electronics&quot;","block_context":{"text":"Electronics","link":"https:\/\/chewett.co.uk\/blog\/category\/electronics\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/06\/addressable_strip_post_icon.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/06\/addressable_strip_post_icon.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/06\/addressable_strip_post_icon.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/06\/addressable_strip_post_icon.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":2514,"url":"https:\/\/chewett.co.uk\/blog\/2514\/ws2812b-8x8-led-matrix-panel-review-and-code\/","url_meta":{"origin":689,"position":1},"title":"WS2812B 8&#215;8 LED Matrix Panel Review and Code","author":"Chewett","date":"May 8, 2021","format":false,"excerpt":"This post talks about how you can use the WS2812B 8x8 LED Matrix Panel with an Arduino. WS2812B 8x8 LED Matrix Panel The WS2812B 8x8 LED Matrix Panel is an square arrangement of 64 RGB LED's. Each LED has its own LED driver which allows you to individually address and\u2026","rel":"","context":"In &quot;Electronics&quot;","block_context":{"text":"Electronics","link":"https:\/\/chewett.co.uk\/blog\/category\/electronics\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2021\/04\/WS2812B-8x8-LED-Matrix-Panel_posticon_OUTPUT.png?fit=1200%2C628&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2021\/04\/WS2812B-8x8-LED-Matrix-Panel_posticon_OUTPUT.png?fit=1200%2C628&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2021\/04\/WS2812B-8x8-LED-Matrix-Panel_posticon_OUTPUT.png?fit=1200%2C628&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2021\/04\/WS2812B-8x8-LED-Matrix-Panel_posticon_OUTPUT.png?fit=1200%2C628&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2021\/04\/WS2812B-8x8-LED-Matrix-Panel_posticon_OUTPUT.png?fit=1200%2C628&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":1921,"url":"https:\/\/chewett.co.uk\/blog\/1921\/hiletgo-5v-650nm-5mw-red-dot-diode-laser-review-and-code\/","url_meta":{"origin":689,"position":2},"title":"HiLetgo 5V 650nm 5mW Red Dot Diode Laser Review and Code","author":"Chewett","date":"January 19, 2019","format":false,"excerpt":"Today I review the HiLetgo 5V 650nm 5mW Red Dot Diode Laser for Arduino and provide example code. Overview of the HiLetgo 5V 650nm 5mW Red Dot Diode Laser The HiLetgo 5V 650nm red dot diode laser is a cheap and incredibly powerful laser diode. This laser diode produces light\u2026","rel":"","context":"In &quot;Electronics&quot;","block_context":{"text":"Electronics","link":"https:\/\/chewett.co.uk\/blog\/category\/electronics\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/01\/HiLetgo_5V_650nm_5mW_Red_Dot_Diode_Laser_postimage.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/01\/HiLetgo_5V_650nm_5mW_Red_Dot_Diode_Laser_postimage.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/01\/HiLetgo_5V_650nm_5mW_Red_Dot_Diode_Laser_postimage.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/01\/HiLetgo_5V_650nm_5mW_Red_Dot_Diode_Laser_postimage.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":1928,"url":"https:\/\/chewett.co.uk\/blog\/1928\/daorier-ky-008-saver-laser-transmitter-module-650nm-for-arduino-review-and-code\/","url_meta":{"origin":689,"position":3},"title":"Daorier Ky 008 Saver Laser Transmitter Module 650nm for Arduino Review and Code","author":"Chewett","date":"February 20, 2019","format":false,"excerpt":"Today I review the Daorier Ky 008 Saver Laser Transmitter Module 650nm module for Arduino and provide example code. Overview of the Daorier Ky 008 Saver Laser Transmitter Module 650nm The Daorier Ky 008 Laser transmitter module includes a standard 650nm red laser on the PCB. This is an incredibly\u2026","rel":"","context":"In &quot;Electronics&quot;","block_context":{"text":"Electronics","link":"https:\/\/chewett.co.uk\/blog\/category\/electronics\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/01\/Daorier_Ky_008_laser_mainimage.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/01\/Daorier_Ky_008_laser_mainimage.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/01\/Daorier_Ky_008_laser_mainimage.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/01\/Daorier_Ky_008_laser_mainimage.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":714,"url":"https:\/\/chewett.co.uk\/blog\/714\/magnetic-reed-switch-sensor-module-review-and-code-examples\/","url_meta":{"origin":689,"position":4},"title":"Magnetic Reed Switch Sensor Module Review and code examples","author":"Chewett","date":"September 8, 2018","format":false,"excerpt":"This post reviews a\u00a0magnetic reed switch sensor module. There are many of these available on the internet and all\u00a0work similarly using a basic reed switch. Here I review and test the sensor and provide code to use it. Overview of the Magnetic Reed Switch sensor The magnetic reed switch Arduino\u2026","rel":"","context":"In &quot;Electronics&quot;","block_context":{"text":"Electronics","link":"https:\/\/chewett.co.uk\/blog\/category\/electronics\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/magnetic_reed_switch_sensor_post_icon.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/magnetic_reed_switch_sensor_post_icon.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/magnetic_reed_switch_sensor_post_icon.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/magnetic_reed_switch_sensor_post_icon.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":724,"url":"https:\/\/chewett.co.uk\/blog\/724\/sw-420-motion-vibration-sensor-review-code-examples\/","url_meta":{"origin":689,"position":5},"title":"SW-420 Motion Vibration Sensor Review and code examples","author":"Chewett","date":"October 25, 2017","format":false,"excerpt":"This post reviews the SW-420 motion vibration sensor. Here I review, test and provide code to use the sensor. Overview of the Vibration Sensor This motion vibration sensor detects small movements and reports this back as a digital signal. This digital signal represents whether there is motion above the configured\u2026","rel":"","context":"In &quot;Electronics&quot;","block_context":{"text":"Electronics","link":"https:\/\/chewett.co.uk\/blog\/category\/electronics\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/sw420_vibration_sensor_post_icon.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/sw420_vibration_sensor_post_icon.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/sw420_vibration_sensor_post_icon.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/sw420_vibration_sensor_post_icon.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/689","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=689"}],"version-history":[{"count":9,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/689\/revisions"}],"predecessor-version":[{"id":705,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/689\/revisions\/705"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/media\/703"}],"wp:attachment":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=689"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=689"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}