aquadog90
Posts: 5
Joined: Sat Dec 12, 2015 1:14 pm

Using Raspberry Pi like an Arduino?

Sat Dec 12, 2015 3:51 pm

I would like to build a circuit board tester using Raspberry Pi. The device will be used by other staff members hence I will implement a GUI possibly with a touchscreen.

I have a lot of previous experience with Arduino however it wont handle GUI and all the GPIO at the same time very well. Also I was looking forward to do my first Raspberry Pi project for a long time.

For the requirements:
I would like to Pi too boot straight into the code/program like Arduino do nothing else. Is this possible?

Is it possible to program the Raspberry Pi on a different machine and just run the code again like arduino? I think it would be easier to program using my main machine and just see the results on the pi.

I did a research on the internet but a lot of scattered information and nothing is clear especially that this will be my first project and I'm not sure how all the boot loaders and stuff work. I am hoping for some kind of genius here to provide a little bit of support or a link?

Cheers

User avatar
joan
Posts: 14763
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Using Raspberry Pi like an Arduino?

Sat Dec 12, 2015 5:34 pm

The Pi takes 15+ seconds to boot, after which it will auto run any programs you want.

You can develop on other machines and then deploy to the Pi. That's what cross-compilers are for. How easy that is depends on what sort of program you are developing.

The tools will not hold your hands as much as the Arduino IDE.

User avatar
TimG
Posts: 297
Joined: Tue Apr 03, 2012 12:15 am
Location: Switzerland

Re: Using Raspberry Pi like an Arduino?

Sat Dec 12, 2015 5:59 pm

It's possible to run the RPi without an operating system, as the Arduino does. But it's not at all straightforward, and programming a GUI would be a lot of work. See viewforum.php?f=72

An easier solution is to run the RPi as normal, but have it automatically login and start a full-screen application. It means waiting a few seconds for the system to boot, but allows you to choose from a wide range of languages and GUI libraries.

A nice way of getting a GUI without writing a lot of code is to serve your application as a web page. Even an Arduino can run a simple web server, and it means you don't have to build the interface hardware.

Heater
Posts: 14773
Joined: Tue Jul 17, 2012 3:02 pm

Re: Using Raspberry Pi like an Arduino?

Sat Dec 12, 2015 8:14 pm

You can create your GUI in C++ using the Qt GUI tool kit.

Do the bulk of that work on your PC (Windows, Mac or Linux).

When that is designed, coded, tested move the source code to the Pi and compile it there.

Qt GUI programs can be run full screen without X Windows. The GUI coming up fast when you power up the Pi.

However, I agree with TimG. Create your user interface as a web page.

Use node.js and write the web server part in Javascript. With node and JS you have easy access to the GPIO, serial ports, file system etc, whilst serving up the web page GUI.

I have been experimenting with this approach here: https://xn--2-umb.net/login source code here:. https://bitbucket.org/zicog/propanel
Memory in C++ is a leaky abstraction .

aquadog90
Posts: 5
Joined: Sat Dec 12, 2015 1:14 pm

Re: Using Raspberry Pi like an Arduino?

Sat Dec 12, 2015 8:17 pm

Ok will research a cross compiler and see how does that work. Any recommendations for first time user?

Never thought about that idea of running a program in a web browser will research that as well. I assume it will be able to access all the GPIO ports

Heater
Posts: 14773
Joined: Tue Jul 17, 2012 3:02 pm

Re: Using Raspberry Pi like an Arduino?

Sat Dec 12, 2015 8:24 pm

I seriously advise against getting involved with cross compilers.

Yes, it can be done, and easily if a ready made cross compilation package is available.

It is also unnecessary and likely a cause of much frustration.

With a cross platform environments like Qt one can compile the same code on Windows, Mac or the Pi. Using the native compilers on each. Only the source code moves around from machine to machine.

With interpreted languages like Python, Javascript etc there is no compilation step to worry about.


One does not run all the code in the web browser. The browser cannot access GPIO, serial ports, your file system, etc. All for web security reasons.

What you do is write a simple web server that can serve up the web page to the browser and tweak with the GPIO and other hardware. When the web page is served up to the browser it will have Javascript code in it to run the GUI. The Javascript in the browser and the code in server communicate between each other.
Memory in C++ is a leaky abstraction .

pxgator
Posts: 105
Joined: Mon Feb 16, 2015 6:45 pm
Location: Southern Colorado, USA

Re: Using Raspberry Pi like an Arduino?

Sat Dec 12, 2015 8:55 pm

This is the easiest way to create GUI programs that I have ever used.
https://www.raspberrypi.org/blog/now-av ... rocessing/
It is processing 3.0.1 based on Java. I'm running it using a RPI 2 and so far
everything has worked great. If you decide to give it a try you will need
to install the G4P library and G4P GUI builder from within the processing IDE.
I can't imagine how GUI programming could be any easier. It comes with
a hardware library that works very well with the RPI's gpio.
So what's all this RPi stuff anyhow? Well folks, it's a feat of engineering from
the UK almost as remarkable as the De Havilland Mosquito and the Colossus.

Pithagoros
Posts: 580
Joined: Wed Nov 12, 2014 8:16 pm

Re: Using Raspberry Pi like an Arduino?

Sun Dec 13, 2015 1:57 pm

rasp.io do an arduino board that builds directly onto the GPIO pins of a PI and almost becomes part of it. Might give the best of both worlds.

User avatar
DougieLawson
Posts: 37742
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Using Raspberry Pi like an Arduino?

Sun Dec 13, 2015 4:01 pm

The Gertduino and Arduberry also give you an Arduino that sits on the GPIO pins. Both of those are better than the http://rasp.io version because stock standard Ardunio shields can fit straight on the add on boards.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

aquadog90
Posts: 5
Joined: Sat Dec 12, 2015 1:14 pm

Re: Using Raspberry Pi like an Arduino?

Sun Feb 21, 2016 4:51 pm

I'd like to refresh this post with fresh question.

So got my raspberry Pi official touch screen 7" and have decided to use Java to build my GUI and etc

I currently in a process of setting up the raspberry pi remote connection with Netbeans, however cant go past certain error.
So my raspberry pi has the latest java 8 jdk installed and updated. So as my PC latest java SE and Netbeans 8.1.

The problem occurs when I try to setup the remote java platform. I type my Pi IP, login, password etc.. As "remote JRE patch" I have {/usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt} and as "working dir standard Netbeans folder.

I will press finish and in Netbeans I can see the connection is made and the Netbeans project folder has been remotely created on my Ras Pi however Netbeans cant seem to find the remote java software on Ras PI..

The patch shone above is correct it also exists on the Pi (I have checked) but Netbeans reports with an error saying patch doesnt exist..

Below is a output dialog
Connecting to 192.168.1.8:22
cmd : mkdir -p '/home/pi/NetBeansProjects/'
Connecting to 192.168.1.8:22
done.
Connecting to 192.168.1.8:22
cmd : cd '/home/pi/NetBeansProjects/'; '/usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/bin/java' -jar org-netbeans-modules-java-j2seembedded-probe.jar platform.properties
bash: /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/bin/java: No such file or directory
C:\Users\HTPC\AppData\Local\Temp\antScript4618495577359612413.xml:65: Remote command failed with exit status 127
BUILD FAILED (total time: 11 seconds)

Return to “General discussion”