Using 7" TouchScreen Cape on Beaglebone Black - node.js

So, im developing an robotics application that uses a BeagleboneBlack as a controller for 3 different servos.
I know how to access the pins and everything from Cloud9 IDE directly into the board.
However, im using a 7" cape ( 4d Systems, 4DCAPE-70T ) and when i connect them, Debian automatically starts up.
I guess my question is, how do you code an app with a UI that can be accessed from the Debian distro directly from the 7" screen?
All my research has lead me to a final decision, which is mounting a node.js server on the bbb and making an HTML interface and with the bonescript libs, access the pins.
Has anybody done anything similar to this?
If anybody has a another approach to this, that would be great

If any time traveller out there stumbles upon this question, here is how i figured it out:
1) Get rid of bonescript. It will give you a hard time assigning pins for PWM and some other uses. Instead, use octalbonescript. reference to repo
2) Install socket.io
try and start a local server with it. Follow various tutos out there. If you run into a boot-up error regarding the server, use port 8090.
3) Design a web page that connects to a local host ( beaglebone itself) using socket.io. Again, various tutos out there.
DONT TOUCH THE KERNEL, NOR THE FILE TREE. Its unnecesary.
4) Open that same web page on your beaglebone. That way, you dont need an internet connection or whatever. The javascript side of the web page will call the appropriate methods on the beaglebone through socket.io ( socket.emit() ).
Its important to understand that all the beaglebone-side instructions, such as pin access, pwm and such, are performed on the same file where the socket is made. The web page 'calls' this methods on the bbb.
5) Enjoy!
I was using it for a robotics project. We were building a delta robot controlled by the Beaglebone Black ( Rev C ). I am serious, start with what i am telling you, you will save a LOT of time.
Edit: Guess i forgot the most important part. The cape uses several of the pins, incluiding various PWM. Octalbonescript, as of this moment, does not support capes. It will, but not at the moment. So, dump the screen and use an ethernet cable to connect your beaglebone to the network. That way, you can access the interface from any device through a browser at beaglebone:8090. ( NOT beaglebone.local:8090 )

Related

What would be the recommended way to exchange data from a WebGL application running on a Raspberry Pi to write to the Pi's serial interface?

Here's the full problem:
I have a WebGL build of a Unity project running on a Pi, and I need the data from this process written to the Pi's serial interface (and vice versa). The best possible solution I can think of is hosting the WebGL server using Express, and utilizing nodejs for the backend process of somehow running some python code that works the serial interface. Problem is, I'm super inexperienced with these platforms and I don't have enough familiarity with how they all work together to intuitively feel out what to do. Hoping I can get some guidance on any recommended paths.
Pre answered questions:
Unity project on a Pi?: I have a simulation running in Unity, and I need it running on a lightweight computing platform. The only way to run this on a Pi is in a WebGL build.
What are you trying to achieve?: I'm trying to achieve a communication pipeline with this WebGL process and an Arduino, specifically over serial.
What I've tried:
I've tried running the WebGL process utilizing systems like Banyan, which would allow communication with a server, but it seems the WebGL build does not allow sockets.
I've tried hosting the server using Express through nodejs, and the app does actually work, I just need help understanding how this system works such that I can exchange data from the WebGL app and a python script that is running the serial comms. As stated above, I'm very new to the nodejs system so I may not even be using the nomenclature properly.

Web-Bluetooth error "GATT operation not authorized" occurs on Windows only

I have been working with web-bluetooth for the past several months on iOS and ChromeOS without any problems. But today, I tried to run some of my examples on Windows for the first time, and to my surprise, most of the things I had implemented didn't work with Windows. I am able to successfully connect to my peripheral, but whenever I try reading or writing anything to a custom service with a custom characteristic, I get the error "GATT operation not authorized". I have tried looking around but there is no information anywhere about this.
I am including below the simplest example I have which is just for turning the LEDs on / off on an nrf52832 board. There is only one custom service and one custom characteristic implemented, the value of which controls the states of the LEDs. This works without any problems on Chromebooks and Macs but does not work on Windows. Here is the link to this simple project including the embedded code and the web-app.
https://github.com/shtarbanov/WebBluetooth-Feather-nRF52832/tree/master/LED%20Control
I have made two implementations of the same thing, one based on promises and another based on async-await located in the folders "WebApp (Async)" and "WebApp (Promises)", respectively. Both of those implementations work fine on Mac and Cromebook, but not on Windows.
It is a known issue that secure characteristics are not accessible using Web Bluetooth on Windows. On other platforms the pairing occurs automatically, but not on Windows. There is an issue tracking this:
https://bugs.chromium.org/p/chromium/issues/detail?id=960258
Stuck with this also and as for workaround i can recommend for windows platform to pair device firstly using windows itself and than to pair it via browser(as a workaround). Not much but hope this helps, at list a little.
P.S. it should be paired via windows only once, so PC will remember device, and than you can pair via browser as long as PC remembers device.

Hardware+OS setup for an Application

I want to make a system which would get input from USB barcode scanner, validate it on remote server and display an answer (text and images).
I would use JavaFX or in-browser JS web application to grab scanner input somehow.
I'm planning to run this application on Raspberry Pi or plain PC.
Is there a way (or a special linux distribution) to ensure that system always loads the same way and starts JavaFX app or opens particular web page in browser?
e.g. no login page, NO update or other popups are shown.
Any other ideas? Thanks
...
Found an interesting solution here, where JavaFX GUI app is started from command line, without X-Server(linux graphical interface) at all.
I have recently done something similar, and it's not too hard. Obviously working on the Pi, you will want to use something like Linux and having limited hardware will mean that you should be minimising what you are running. Due to this, I would recomend that you run a light weight distro. Something like arch (which is what I used) allows you to build only what you want from the ground up without the need to find and compile everything like you do for LFS or Gentoo.
As for booting, the following two wikis will give you the details of starting the Gui without manual login:
https://wiki.archlinux.org/index.php/Automatic_login_to_virtual_console
https://wiki.archlinux.org/index.php/Start_X_at_Login
After that, it is simply a matter of putting the command to launch your program in .xinitrc.

Auto login on BeagleBone White + Angstrom 3.2

I'd like to find a way to make my BeagleBone (white) Rev A6a autologin after being powered up. I'm using Angstrom with kernel 3.2.34, which uses systemd instead of innitab.
I've already seen some topics (like this question) with reference to modifications on some service files (like /etc/systemd/system/getty.target.wants/getty#tty1.service), but that only helped me partly: If I power/reset my BBone while keeping it connected via USB to my computer, it autologs as expected. But, if I just power the BBone with a wallwart (without any other connections), it doesn't seem to log in. At least I believe that's what is happening, as I have a program prepared to autorun after login and it only starts on the first case (with USB on).
I'd appreciate any help. Thanks.
Turned out that a RF module attached to my beaglebone was being powered via USB, and this module should be activated by my test program mentioned in the question. So, when I unplugged my BBone USB cable, I was actually separating its GND from the RF Module's ground.
In short, I just had to use the same source in the entire circuit and keep the autologin configuration explained in the topic I also mentioned in my question.
You could make your program a service and run after user instance of systemd.
Lets say you have a graphical.target in your /usr/lib/systemd/system then just put symlink to ../systemd-user#.target to /usr/lib/systemd/system/graphical.target.wants/system named like systemd-user#<your-user-name>.service.
This systemd-user#.service should containe ExecStart line like /usr/bin/systemd --user.
Then you'll have to add your application's service-file to /usr/lib/systemd/user.
More info is at http://www.freedesktop.org/software/systemd/man/systemd.html and http://www.freedesktop.org/software/systemd/man/systemd.unit.html

DIY: Project remove VGA cable by sharing screen over wifi to TV

This is one of my coding projects. I'm fairly new to linux, so I need some pointers and thoughts from you guys, before I get started. I know there exists screen sharing software already, but I want to make my own! (=
Specifically, I want to clone my laptop screen to my TV over WLAN, via a linux box that is connected to a TV through a VGA cable:
Laptop streams it's screen
Linux box reads the stream
Linux box outputs the stream into the TV (through a VGA cable)
First of all, how do I record the screen and send the stream in real time in linux?
Secondly I must write a program that reads the stream being sent. The program must listen to some port, and collect the data being streamed from the laptop. Any thoughts?
Then I must output that data in real time to the TV. Do you how any ideas on how to solve this?
Thanks!
Edit: Regarding programming languages, I'm most comfortable with python.
Sharing your screen can be done via the various flavors of VNC (ie. RealVNC, TightVNC, UltraVNC, etc.). Most of them are Open Source, you might want to:
Stick with the VNC protocol for later compatibility
Take example of how the established solutions does for screen-hooking.
In Linux, the graphics are all processed by Xorg (new version of X Server), which was developed with networking embedded. This explains why you can ssh -X into a machine, execute a graphical interface on it and see it on your remote computer. I recommend you to read about hooks on Xorg to achieve your needs.
You need a client-server topology to achieve your needs. You are not talking about any programming language you forecast to use, though. Some languages may be harder than some to start with. Furthermore, this kind of code is already really well understood under every major programming language. You should try to at least use a framework that simplifies your networking portion of the project.
Sharing a screen on the TV can be done by your video card driver in Linux. Just check on your Desktop Environment (KDE and Gnome offers video configuration panels, for example) or in your video card configuration (nVidia and ATI Linux drivers offers multiple screen support)
It seems to me like you're trying to reinvent the wheel and are not too sure about how to begin. I recommend you to begin simple with one of the already proven VNC software and see how it goes from there. If a feature is missing, you've got the source code of the server and the client, so you can continue development of these projects. Once you've got your setup working, start thinking about replacing a single piece of the puzzle by your own code, and see how it goes.
Do not expect good (full HD, for instance) video quality on your TV without some very capable CPU/GPU and a 802.11n wireless network empty of users and be ready to accept some lag for the codecs to kick in.
You should try to take as small steps as possible. If I were taking up such a project, my first step would be to try to implement a solution using standard unix tools (e.g. netcat or socat for the network part, mplayer or vlc for the playback and maybe ffmpeg for the capture)? Then, replace each component with custom-written ones if needed.

Resources