Fun problem solving for LightLogo

It has been a while since I post anything here and it feels great when I have something to share :)- Geeky content warning~

So Brian and I are both very much into playful invention and we’ve been working together on various projects. Recently I helped him ordered 30 Arduinos and some neopixel ring from mainland China. The Arduino board is a clone so it is not using the USB-Serial chip (FDTI compatible) comes with the original Arduino. It uses something called CH340 and the driver could be found here.

Brian is using LightLogo  as the platform for students to apply their logo code on some tangible hardwares. The package from the site doesn’t work with the clone, so what’s wrong?

Observations

  1. When using the assembler.jar in the lightlogo-vm directory, the TX/RX light on the clone arduino doesn’t work, which suggests that the code cannot be loaded to the board.
  2. When running the LightLogo.jar in the lightlogo directory, an error message “device not found” was shown.
  3. I tried to open the sourcecode using Eclipse (as it is java based), gave me a lot of insight on how LightLogo was written (a bunch of LContext/Function and parameters…), the file that I spent most time on was MacSerialHandler.java, which extends the SerialHandler.java with a function called “usbInit”, but it is an empty method!

Thinking…

  1. In Arduino/Processing when I tried to access the serial port I need to specify which port I’m using, in Linux/Mac this is done by referring to a file/device path.
  2. For the original Arduino UNO, according to the Arduino environment (Tools-Ports), the original board has a port name called (cu.usbserial1411), and the “clone” has a port name called “cu.wchusbserial1410”. There are few other ports that we can find in the directory /dev/cu.*
  3. Where in the LightLogo code does it specify the port???

After looking through all the .java file with no luck, I started looking at the assembler.logo file, which is the script written in the logo language, and bingo!

to find-mac-port

dolist [i files "/dev][if member? "cu.usbmodem :i [output :i]]

dolist [i files "/dev][if member? "cu.usbserial :i [output :i]]

output "

end

Obviously these few lines of code are they key! It is trying to find a port called “cu.usbserial” instead of “cu.wchusbserial”, so “naturally” I modified the code to

to find-mac-port

dolist [i files "/dev][if member? "cu.wchusberial :i [output :i]]

dolist [i files "/dev][if member? "cu.usbmodem :i [output :i]]

dolist [i files "/dev][if member? "cu.usbserial :i [output :i]]

output "

end

And it worked!

So in order for the LightLogo.jar to run, modify the same code (*Update [11/21/2016]: I should have mentioned the compiler.logo has be changed as well in order for it to work, thanks @briansmith and @tylerbeatty!) and you can download the logo script to Arduino🙂

Happy problem solving!

*Brian if you read this message can you send me some screen capture/picture of the ring so this post won’t be that dry? Thanks!

Livestreaming with BM TV Studio

Situation
We have an ATEM TV Studio Switcher (https://www.blackmagicdesign.com/hk/products/atemtelevisionstudio) in the shop, which allows us to connect up to 9 cameras at the same time with a neat IP based control interface. It sounds like perfect solution for live streaming and event (HDMIs->ATEM TV Studio->Youtube), but challenges surfaced quickly.

The ATEM TV Studio has a USB connector which sends the mixed feed as an H.264 stream, in order to stream a video feed to youtube, we can choose from Wirsecast/FlashMediaLiveEncode (FMLE). Unfortunately, none of them works with the BM ATEM TV Studio Switcher.

Luckily, livestream.com provide a free livestreaming software called Procaster (http://www.livestream.com/userguide/?title=Procaster), which supports the BM interface out of the box!

We ended up stream the feed through livestream.com and use OBS (https://obsproject.com/download#obs2_dl), an opensource broadcasting program as the ultimate solution.

Because the unverified livestream.com channel can only serve up to 50 people, we use the screen/window capturing function of OBS to capture and re-broadcast the stream to youtube to work around this. Soundflower is being used for redirecting sound from the programme to OBS.

Connection map

Primary stream
Cameras —HDMI/SDI—>BM ATEM TV Studio—USB—>iMac—->Livestream Procaster—>livestream.com channel

Mirrored stream (through another computer)
Chrome (Opening livestream.com as a popup)–>OBS–>Youtube

Sound mixing
Another challenge we had was to mix the sound from the sound panel with the SDI video feed supplied by the video company. As the sound panel only provides XLR output and we didn’t have any USB sound capturing device, we used the Sony HDV camera as a XLR->HDMI convertor to the BM ATEM interface. Which worked pretty well.

The cost to go backward…

In this article (The Four Horsemen of the Cyber Apocalypse) , it talks about the possible scenarios that will paralyse digital system. They are certainly valid but I can’t stop thinking of a this question, what is the tipping point for people start to move back to paper-based system?

Given the current database and networking technology, there’s almost no real “safe” system that can be created and left alone without being upgraded. Let alone the attach to cloud based service, for institutes that efficiency is not the top priority, paper based system could be a better solution in terms of security.

In the Silo series written by Hugh Howey, it described a post-apocalypse scenario that the whole human kind lives underground. The “history” of the earth is being modified and changed in the database so no one really know what happened, except for the managements of the silos. This top administrator of the silo has access to physical books, which document the “real history” of the past.

Let alone whether there’s a “real history/reality“, just by thinking about this digital history rewriting scenario is scary enough. There are legal requirements for some institute to keep paper-based record, but is there any company/institute that want to move back to paper-based record/database from a digital system? What is the cost of it? Is there any formula for that?

To boil it down to one question, how much does it cost to convert a database (e.g. MySQL/Postgresql) to a paper-based system?

Self learning and textbook

Just watched Good Will hunting over the weekend in memory of Robin Williams. How a teacher inspire students in an elite school in Dead Poet Society was certainly up-lifting for me as an educator. The friendship/brotherhood in Good Will Hunting was also touching. A scene in the movie made me think about what learning is/could be.

Not everyone has the incredible memory that Will has in the movie, but we have access to the books he read. The interesting thing is what he chose to read, not just any book but textbooks! It really is the quickest way of diving in any field if you know nothing about it. I may start with the recommendations on this page and keep an eye on the College Open Textbooks (http://www.collegeopentextbooks.org/) project.

How we see the world differently with mobile phone- VVS

This is probable an old video, but it is really funny. Shooting video in portrait with mobile phone, also known as “Vertical Video Syndrome”/VVS.

What we can see here is the merging of 2 different technologies (video tech and mobile phone). The vertical format of most mobile phones is definitely a sensible design, but it wouldn’t work when the orientation of the camera (landscape/portrait) correspond to the orientation of phone. What is the solution?

A simple approach maybe having a phone that shoots in landscape mode while being hold “up-right”.

Mm… why isn’t there a phone like this?

Using Google Drive to share documents

One of the problems of using GDrive in a school/company is the file ownership. If someone who owned/created the file left and the account was deleted, it will be gone forever. I order to further migrate the data to the cloud service, transfer the ownership to a “school owned” account is essential.

However, explaining all these by an email would be extremely boring… Finally I’ve created my first PowToon..

Prejudice and door lock

Which one is more powerful? A door lock or prejudice?

I encountered 2 broken door lock incidents in the past few days, luckily nothing went wrong. 

One of the door usually requires a smartcard to open, as the system was faulty that day, someone disabled the lock to make sure people have access to it. However I still swipe my card every time when I push an unlocked door…

Here’s an image of a classic InfoSec theory (Which is about “CIA”)


From http://www.papershredding.ie/waste-disposal.html

It talks about integrity, availability and confidentially. If you are living in an apartment building in Hong Kong, most of the time if you forgot to lock the door, nothing will happen. The challenge for anyone who’s trying to break in an apartment/system is that there’s a cost for testing each door. Most people will assume a door is “locked”.

How about when we try to share a new idea? Do we assume people will not take it and just drop it? To me, prejudice is much more powerful than a door lock, cause after all, we all assume a door lock can lock the door… but it isn’t always the case.


From http://www.uniquerishta.com/