Recent

Author Topic: Is this possible with Lazarus & Rasp Pi B or 2?  (Read 14014 times)

Wurlitzer28

  • Newbie
  • Posts: 6
Is this possible with Lazarus & Rasp Pi B or 2?
« on: May 25, 2015, 09:43:48 pm »
Current situation:
I have a Windows program I wrote in VB6 which uses a small MS Access Database to display 2 Bit-mapped images at a time [side by side].

The program can advance or go back 2 pages at a time based upon 2 physical i/o inputs.

On the displayed bitmaps, using the database for a data source I can display up to 10 text boxes which contain various Tips based upon certain criteria such that the same bitmap images could very well have different tips based upon what I am doing at the time.

I can move these text boxes and alter their contents from the screen and of course save new data and locations to the database. The text boxes auto adjust their width based upon content.

There are only a couple, but very useful, GUI screens needed for this application.
=======================================
Desired situation:

I would be willing to rewrite this application from the ground up if it could be run from a Raspberry Pi [B or 2] as I would like to offload this app from the main PC which will be doing other more intense operations.

The database is in MS Access and is small [2+ meg with 5 tables] but I would be willing to move it to something more compatible with Lazarus if the MS access file cannot be used in a Linux/Lazarus environment. MS Access is preferred [because I understand it so well] but not an absolute requirement.

The database and the bit-mapped images would reside on a USB thumb drive thus removing any concerns about file size should the db get larger (doubt it though).

A USB mouse, Keyboard would obviously be required.

Is this feasible with Lazarus/FreePASCAL and the Raspberry Pi?

Thanks for taking the time to read.

Paul Breneman

  • Sr. Member
  • ****
  • Posts: 290
    • Control Pascal
Re: Is this possible with Lazarus & Rasp Pi B or 2?
« Reply #1 on: May 25, 2015, 11:41:06 pm »
Welcome to the Lazarus forums Wurlitzer28!

What were the 2 physical i/o inputs that your Windows VB6 program used?

I think this all should be pretty easy on the RPi (I have one so maybe I could help).

It is easy to see Free Pascal work on the RPi.  Just download the small ARM Linux zips on these two pages:
http://www.turbocontrol.com/easyfpgui.htm
http://www.ctrlterm.com/
Regards,
Paul Breneman
www.ControlPascal.com

sky_khan

  • Guest
Re: Is this possible with Lazarus & Rasp Pi B or 2?
« Reply #2 on: May 25, 2015, 11:57:57 pm »
I have an RPi2 but never tried to use its i/o ports and I dont think you can use ms-access database on linux but other than that it sounds easy. btw, I would use Sqlite instead of ms-access.

Wurlitzer28

  • Newbie
  • Posts: 6
Re: Is this possible with Lazarus & Rasp Pi B or 2?
« Reply #3 on: May 26, 2015, 05:18:48 pm »
Thanks for the response Paul.

Currently I have two physical switches which connect to a Parallax Propeller 8 Core Micro running all my high speed operations in Assembly and one of the many functions of that Micro is to detect a switch closure and then send one of two messages via the serial port to my main PC. The VB program in the Main PC simple advances or goes back 2 pages/images based upon that serial message. I just used the "<" or ">" characters for this operation

I could continue that method using Lazarus & Raspberry Pi or bring those two switches directly to the Raspberry Pi. Response time is not really that critical but i would like the Raspberry Pi to respond to the inputs in under 250ms.

I have used a Raspberry Pi in a Christmas lighting display to drive 6500+ multi-color leds and have used one of the inputs to manually launch that display. Virtually all the programming/setup of that Pi was downloaded as one application so my exposure to Linux/Pi is certainly minuscule in comparison to my Assembly/VB 6 programming skills


Welcome to the Lazarus forums Wurlitzer28!

What were the 2 physical i/o inputs that your Windows VB6 program used?

I think this all should be pretty easy on the RPi (I have one so maybe I could help).

It is easy to see Free Pascal work on the RPi.  Just download the small ARM Linux zips on these two pages:
http://www.turbocontrol.com/easyfpgui.htm
http://www.ctrlterm.com/

Wurlitzer28

  • Newbie
  • Posts: 6
Re: Is this possible with Lazarus & Rasp Pi B or 2?
« Reply #4 on: May 26, 2015, 05:28:55 pm »
Thanks Sky_khan for taking the time to respond.

The only reason I would like [not need] to stay with the MS Access file is that it is super easy for me to make changes in a Windows environment then just move that db to the Raspberry Pi but Lazarus would have to have the drivers to communicate with that file format. I currently do that today as the XP PC running this application does not have a copy of MS Access on it but my VB application does not care it just uses SQL commands via a Jet driver as the tool to read/write to any record.

I would not upset me too much to also use another db if it would play better with Lazarus on the Raspberry Pi especially if that database could originally be created in a Windows environment then pushed to the Raspberry Pi. In fact this entire project is a learning experiment cloaked in a real live application so learning another database application is not a bad thing however the ease of creating and modifying in a Windows environment would be preferred.


I have an RPi2 but never tried to use its i/o ports and I dont think you can use ms-access database on linux but other than that it sounds easy. btw, I would use Sqlite instead of ms-access.

bee

  • Sr. Member
  • ****
  • Posts: 393
Re: Is this possible with Lazarus & Rasp Pi B or 2?
« Reply #5 on: May 27, 2015, 11:59:10 am »
Once you intend to move out from Windows, you should start thinking cross-platform-ly and avoid Windows-only solutions. VB and Access, perhaps including MS Offile file format, should be avoided as much as possible.

Your app scenario is very much doable using FPC/Lazarus on Raspi 1B+ or (even better) on Raspi 2B. For the database part, I suggest you to use a light-weight database server, not just local (or embedded) database (like sqLite) so you can access it from other machines. My suggestion is to use Firebird SQL. It's easy, light-weight, and high performance.

Good luck, Wurlitzer28! :)
-Bee-

A long time pascal lover.

sky_khan

  • Guest
Re: Is this possible with Lazarus & Rasp Pi B or 2?
« Reply #6 on: May 27, 2015, 01:18:02 pm »
Firebird may be more convenient but RPi memory (especially in first version) is very limited so I thought running a db server which will use several tens of megabytes may be too heavy on RPi. Thats why i recommended sqlite but if you will use a RPi1 just for this application (e.g no X-Server or other memory hog application) or you have a RPi2 Firebird may be a better choice.

Anyway, you may look "Sqlite Expert Personal" and "IBExpert Personal " (for firebird) applications . You can use these on Windows to prepare a database and transfer it to RPi. IBExpert can also be used to connect directly a Firebird server running on RPi over LAN.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1739
Re: Is this possible with Lazarus & Rasp Pi B or 2?
« Reply #7 on: May 27, 2015, 01:50:01 pm »
I am using many RPi(2) and BeagleBone with GUI for hardware access and database communications ! No problems at all.

Environment:
Win8 with FPC/Lazarus and cross-compile towards ARMV7a.
Very easy and fast.

Database:
SQLite3 through mORMot (http://synopse.info/fossil/wiki/Synopse+OpenSource)

Hardware acces done through very simple USB-HID.

Wurlitzer28

  • Newbie
  • Posts: 6
Re: Is this possible with Lazarus & Rasp Pi B or 2?
« Reply #8 on: May 27, 2015, 02:52:27 pm »
Thanks so much Don, Bee, Paul, Sky_Kahn!

Great response from so many people gives me confidence Lazarus/RPi 2 will be a good fit for this application and a good learning experience.

I have already imported to SQLite, via CSV files, my Access database and just need to create the few table relationships, nothing fancy. While MS Access allowed the relationships to be created graphically, using SQL commands to create them is not out of my wheelhouse.

I will also, again for a learning experience, see what I can do with Firebird.

Just as with VB, my own personal stumbling block seems to be establishing the connection between Lazarus and the database but once I figure that out, the rest seems very straight forward and quite powerful. So far I have exercised the error reporting capabilities of Lazarus quite well.

My Assembly programming skills are useless when it comes to the steps required to attach to a database.

Someday the computer world will make connecting to a db as easy as opening a file.

chrnobel

  • Sr. Member
  • ****
  • Posts: 283
Re: Is this possible with Lazarus & Rasp Pi B or 2?
« Reply #9 on: May 27, 2015, 03:45:29 pm »
For the database part, I suggest you to use a light-weight database server, not just local (or embedded) database (like sqLite) so you can access it from other machines. My suggestion is to use Firebird SQL. It's easy, light-weight, and high performance.
Actually, if you are connecting to SQLite via ZeosLib, you can very well access the database without any problems.

So my suggestion is to use SQLite, ZeosLib, and naturally FPC/Lazarus - eventually one can consider FPGui to make the userinterface lighter.

bee

  • Sr. Member
  • ****
  • Posts: 393
Re: Is this possible with Lazarus & Rasp Pi B or 2?
« Reply #10 on: May 27, 2015, 04:29:54 pm »
The fun part of Firebird is it can act both as an embedded AND as a server. When your database just need to be accessed solitarily, use embedded mode. When you need to access database from other machines (or apps), just switch to server mode. It's just a matter of some settings. :)

Well, it's just my suggestion. I speak from my experience using Raspi 1B+, Firebird, and FPC/Lazarus. All is well. If you don't think it is suitable to your need, feel free to ignore it. :)
« Last Edit: May 27, 2015, 04:33:28 pm by bee »
-Bee-

A long time pascal lover.

 

TinyPortal © 2005-2018