{"id":1311,"date":"2018-06-25T14:58:03","date_gmt":"2018-06-25T13:58:03","guid":{"rendered":"https:\/\/ofalcao.pt\/blog\/?p=1311"},"modified":"2018-06-25T15:12:24","modified_gmt":"2018-06-25T14:12:24","slug":"rock-concert-iot","status":"publish","type":"post","link":"https:\/\/ofalcao.pt\/blog\/2018\/rock-concert-iot","title":{"rendered":"Rock Concert IoT"},"content":{"rendered":"<div class=\"seriesmeta\">This post is part 5 of 5 of \u00a0<a href=\"https:\/\/ofalcao.pt\/blog\/series\/lego-rock-concert\" class=\"series-323\" title=\"LEGO Rock Concert\">LEGO Rock Concert<\/a><\/div><p>So last days I&#8217;ve been assembling the stage surroundings, a truss-based structure to support the left and right video walls and also the self-powered speakers:<\/p>\n<figure style=\"width: 718px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large\" src=\"https:\/\/lh3.googleusercontent.com\/OFzsNa1fNSYP3SCzWM7QozjZDgZ0DRW6as6ClKmuPZP49oxJ2zU9yYoabOvREe0Ds9q8Ohl_R_ZMe3V1gDm1J_lLQGnUi7HQQ45qFqHEN0qfmo_rQEw39FFEfqdV2LpZRE398sJFAe2TewlnLjyhndP4cw9iPJqL9Ik5qy6fddX6FE7hpsibD3wN4IiI9lxYRNpqT8IgJNHJE9DzjfIm4MBtWhvoHG1WkuBoGC3BsN8P_7zLrjCnc6L2PZ8obzTsnmRrEWCHkiraFOjvETv6bm0juT2AAHqXNXbVzYhaMa_p-O2fnMnZFFnnBzafACoOv9cUvFVpf2HSc5Ado1UFD6miAYbiaK8GjwuGfQZXujTx1w11TlPmNwJSeLsu_W2djSA-e_9xjY--4SMTxsRfBDrfDSMSDUKqe8q22syBK8rAq8-QtFdInSGpImoWH3hJOreKCJAVSEc_NBCrFTyayvFe6Nb9gk7eo_ndpnAUWqYUcX7Zq_V17Xif7YUJTGFh-I8zheqjy1tL-KY6-A48_yklo9hreMLdIK3DAJPd3u0QxjVZP_eOtlNBkHqB2sVNBgerl2Y4brrF_KIzELuY8S1wGBkByJQyr3rCoN-XmisdUeunSBiCwRq7cHE_jVqhmwAQ0C1pRzGI5VGblbZUCaaRIES7Andi=w718-h403-no\" width=\"718\" height=\"403\" \/><figcaption class=\"wp-caption-text\">LEGO Rock Concert: good progress with the stage and electronics<\/figcaption><\/figure>\n<p>I gave up hiding the speakers under\/inside the stage. I know, speakers aren&#8217;t LEGO but I think they look good enough this way.<\/p>\n<p>Also I have been testing the Raspberry Pi Zero W with the PiTFT and a local USB webcam. I use &#8216;VLC&#8217; to stream the webcam video to the wireless network and can show a stream on the PiTFT with &#8216;mplayer&#8217;. And since mosquitto-clients package is also available for Raspbian I got a way to control everything with just a bash script with MQTT.<\/p>\n<p>So this is the IoT setup now:<\/p>\n<figure style=\"width: 679px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large\" src=\"https:\/\/lh3.googleusercontent.com\/8wRuz106ADpaAFBaFP6cu71Vhaaga-ctdwZcuMm5KVzDbL7MlqkwOjAAULCxcWz0GCFhK2OCqU1NesVsI2lnUIOdJIaJWVe7vy0UQQgaQiqguCy0xg-tzbJZ8QmtMed-fphUOB-47Ec6QN4XqPD72IMZ6LBBKIsqPpVHpNQH2eXzKI2hUmhe8qwhYl-39Hy7PHsF12rRzWjPiPIbVPHCZl638bmfZDg_MAIhbJEsZQe9TE3-0O4LH2TeR0OuGSZVDIxw1LAnzHF9fobcmCQZceJY-K0n7KvrtyexcrhhEUNaVr6iYHAdw8Qg2E4BkGV47sJMOx-dCGJa1e--bjF1u8GViD0rPTH72VQUwHatEVW5W9pETVpw_Ku64TWAGkHiuKlfV4PDRQJxPTT3vMWw564wM25n281DKN7VhoFbuZOs3UhBRGp0W2FMH1ddU1W1MrkyJmrL-uigUB_HlEInwNmjRFO_h_rzBuwgxD5L404TBJD_xOeJjnW7mGRbM6Wp2kACuzYI-YSz4uU7Qjrf77em2TCDOENNkbkmacaaP_5g_yfHmrpQSINhGjMkglIRZQp-tz4f3ZcbObiPHlg3ITOEFefKL6itHumyVbFnJavC4b83NrTcnJNZh45OsivHKGlouNX2xztDmloiv-teo5AKcdD2i8Jf=w680-h897-no\" width=\"679\" height=\"897\" \/><figcaption class=\"wp-caption-text\">LEGO Rock Concert: The IoT<\/figcaption><\/figure>\n<p>From any mosquitto publisher I can select which stream to show on each video wall and also start a bash script on the EV3 with the sound card and the LEGO Power Function lights so a music plays while the lights blink.<\/p>\n<p>Only problems till now:<\/p>\n<ul>\n<li>&#8216;mplayer&#8217; takes 5 seconds to start playing the stream, doesn&#8217;t seem to be a problem with the raspberry nor with the stream, just some kind of warm-up from mplayer, if I can&#8217;t fix it will have to find another video player that works with the PiTFT (it&#8217;s framebuffer, not X-based)<\/li>\n<li>a small USB endoscope camera I was considering using has some problems to show up on first boot of the Rasberry Pi so I will probably use another webcam, bigger but more reliable<\/li>\n<\/ul>\n<p>While testing the IoT I used my Ubuntu laptop (&#8216;mosquitto-pub&#8217; and &#8216;mosquitto-sub&#8217;) but found a MQTT Dashboard App that works fine both on my Android 5.0 Phone and my Android 4.0 tablet. But I also wanted to use an EV3 as a controller so I tested a few bash scripts with the local keys but found it too limited&#8230; so decided to make a better control panel:<\/p>\n<figure style=\"width: 1598px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large\" src=\"https:\/\/lh3.googleusercontent.com\/RJ9XJRvjb0yQPPVXnNrXyXGPpB7s3TRhRG1rchrhfnNZny64sCl0U339NkLxBO_VunY9aDSsPmUu0sXhorW1purfRAQOn-r1WI0ijnHrCqkx9-9Z9pZhHaju4eSNzlMDX2_Uq2v4nuh3nnh-qxdkXAVLKe5SRxx24O9xBxyftukOYNALR3IK8mQx5t1YvWHiX3bLtpiQLuvx58i2ZfXUy9IJXoW3bCgKwXUZ6sZATve8b8b7mCQSlnfWQjsnC8UoQb8OFuKBwQBtOlk9Yez2PswcRFxzFGHdNYQZfokrpZVRhqBoZaEttP-kWvZoyNA0UC86RKz-jT94HCblyu8kcEzVD8YDnWN06_Ai69ibzO-HWl2xZAHleRNlQx76F7SP7OqKXsgUT7UqKU3RChCd-5Sbg6zBn07nTHCgoxP-TWMN-cfJisk8eRW5WytvO8HZyk99wnErKyk2n_KUi0MnACGycXYSgRFOHJgLeAp767dAd0YxHYdcGKgQnB1Ykbv2QD6NxK67tZlFVIwdKrtMdDllOYzzFE7wAVKmsGnceo1SFAhGjR90GPE5UoB3swQYXmV-5Dmfv3jJO7ua9_P6PjUwsMSyszOGJcFsxulVOMacZZICM5-nvaCU1eqUw69r-9tci_iP86jiZEOMfWIdahgEywy63Ikt=w1598-h897-no\" width=\"1598\" height=\"897\" \/><figcaption class=\"wp-caption-text\">LEGO IoT Control Panel<\/figcaption><\/figure>\n<p>The four medium motors are used as selectors,\u00a0 I divided a whole rotation in 8 intervals (45\u00ba each) to have 8 options on each motor. So it works like this:<\/p>\n<p>&#8211; one selector for Video Wall #1<\/p>\n<p>&#8211; one selector for Video Wall #2<\/p>\n<p>&#8211; one selector for Sound and Lights<\/p>\n<p>&#8211; one selector for Special Effects<\/p>\n<p>I can choose what stream I want to show on each video wall and start playing a music. Later I will add more options (photo presentation, youtube video&#8230;) and use the 4 EV3 touch sensors to adjust parameters for each option (like the brightness, the frequency or the effect of the lights, the volume of the sound, forward\/backward while showing some presentation&#8230;).<\/p>\n<p>A video explaining this:<\/p>\n<div class=\"jetpack-video-wrapper\"><iframe loading=\"lazy\" title=\"[WIP] LEGO Rock Concert - IoT Demo\" width=\"840\" height=\"473\" src=\"https:\/\/www.youtube.com\/embed\/eKumk1ixL2A?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/div>\n<p>I speak in english but my voice is weak and I had an allergic caugh in the middle so I added sub-titles (also in english).<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"seriesmeta\">This post is part 5  of 5 of \u00a0<a href=\"https:\/\/ofalcao.pt\/blog\/series\/lego-rock-concert\" class=\"series-323\" title=\"LEGO Rock Concert\">LEGO Rock Concert<\/a><\/div><p>So last days I&#8217;ve been assembling the stage surroundings, a truss-based structure to support the left and right video walls and also the self-powered speakers: I gave up hiding the speakers under\/inside the stage. I know, speakers aren&#8217;t LEGO but I think they look good enough this way. Also I have been testing the Raspberry &hellip; <a href=\"https:\/\/ofalcao.pt\/blog\/2018\/rock-concert-iot\" class=\"more-link\">Continuar a ler<span class=\"screen-reader-text\"> &#8220;Rock Concert IoT&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_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","enabled":false},"version":2}},"categories":[1],"tags":[328],"series":[323],"class_list":["post-1311","post","type-post","status-publish","format-standard","hentry","category-sem-categoria","tag-iot","series-lego-rock-concert"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2Mhyv-l9","_links":{"self":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/1311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/comments?post=1311"}],"version-history":[{"count":0,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/1311\/revisions"}],"wp:attachment":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/media?parent=1311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/categories?post=1311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/tags?post=1311"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/series?post=1311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}