Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Scripting Language to output data from Database to PC serial port

Status
Not open for further replies.

romel_emperado

Advanced Member level 2
Joined
Jul 23, 2009
Messages
606
Helped
45
Reputation
132
Reaction score
65
Trophy points
1,318
Location
philippines
Activity points
6,061
Hi guys

I'm planning to use Python to get data from the remote database and send this data to serial port of the PC.. Is python best for this or there is another language that would make this thing lot easier?

I'm not a python programmer but I can read and build another programming language by the help of google ;)

Thanks so much..
 

I think you have seen this Rapid prototyping with microcontrollers ? « Jean, aka Sig(gg)

---------- Post added at 23:50 ---------- Previous post was at 23:50 ----------

And this : **broken link removed**



this python script will not run in microcontrollers. My plan is I have a PC running in linux/windows and this script will run in the background to continuously polling data from the database..

---------- Post added at 00:35 ---------- Previous post was at 00:30 ----------




I'll try to understand this.. thanks so much
 

I think I have seen you in microcontroller forum.
For this type of application(multi tier architecture) JAVA EE or Microsoft's .NET (VB .net & ASP. net) platform will be easier. You also need a RDBMS installed in a remote server.

For multi tier architecture you need to know more than one single language or scripting language. Thanks to .Net platform or JAVA to bring all those things under one umbrella, sorry two , Microsoft umbrella and Java umbrella.

In 3 tier applications, the client side is usually written in HTML meanwhile the application servers are usually written in C++ or Java. By using a scripting language embedded in HTML, web servers act as translation layers that allow for communication between the client and server layers. This layer receives requests from clients and generates HTML responses after requesting it from database servers. Popular scripting languages include JavaScript, ASP (Active Server Page), JSP (JavaScript Pages), PHP (Hypertext Preprocessor), Perl (Practical Extraction and Reporting Language), and Python.



Three tier client server architecture is also known as multi-tier architecture and signals the introduction of a middle tier to mediate between clients and servers. The middle tier exists between the user interface on the client side and database management system (DBMS) on the server side. This third layer executes process management, which includes implementation of business logic and rules. The three tier models can accommodate hundreds of users. It hides the complexity of process distribution from the user, while being able to complete complex tasks through message queuing, application implementation, and data staging or the storage of data before being uploaded to the data warehouse.

As in two tiered architectures, the top level is the user system interface (client) and the bottom level is performs database management. The database management level ensures data consistency by using features like data locking and replication. Data locking is also referred to as file or record locking. This is a first-come, first-serve DBMS feature used to manage data and updates in a multi-user environment. The first user to access a file or record denies any other user access or “locks it”. It opens up again and becomes accessible to other users once the update is complete.

The middle tier is also called the application server. It contains a centralized processing logic, which facilitates management and administration. Localizing system functionality in the middle tier makes it possible for processing changes and updates to be made once and be distributed throughout the network available to both clients and servers. Sometimes the middle tier is divided into two or more units with different functions. This makes it a multi-layer model.

For example, in web applications, the client side is usually written in HTML meanwhile the application servers are usually written in C++ or Java. By using a scripting language embedded in HTML, web servers act as translation layers that allow for communication between the client and server layers.

This layer receives requests from clients and generates HTML responses after requesting it from database servers. Popular scripting languages include JavaScript, ASP (Active Server Page), JSP (JavaScript Pages), PHP (Hypertext Preprocessor), Perl (Practical Extraction and Reporting Language), and Python. One of the major benefits of three tier architecture is the ability to partition software and “drag and drop” modules onto different computers in a network.

---------- Post added at 13:39 ---------- Previous post was at 13:31 ----------

Python is often used as a scripting language, but is also used in a wide range of non-scripting contexts.
 
Hi papunblg,

thanks for your reply.. I decided to use Python and I successfully tested the pyserial that can communicate directly and easily to serial port of the PC.

And yesterday i tried booting a Linux instance from amazon. LAMP on it and use this example(Python Programming/Databases - Wikibooks, open books for an open world) to connect to my remote database.

Next update I will try putting some content in my database and retrieve that content and then output in my serial port..

Thanks so much
 

Very Good! After experiment if you kindly publish the result in edaboard , it will be of great help of many.
I personally never used Python for this type of project. I am very eager to know the ultimate result.
 
yes.. I will publish it here if done..My only goal is to get data from my database to my serial port and then I will think of another application of this.

if you would be asked what language will you use?
 

To get data from database and to send it to serial port :- VB .net would be my first choice. The inbuilt SerialPort class is very rich. SerialPort Class

Here is a good tutorial on serial communication programming using VB .net : Serial Communication with Visual Basic .NET

But since you are using LAMP as development environment, Python is good for that

---------- Post added at 23:42 ---------- Previous post was at 23:23 ----------

Since you can connect to database(mysql) and fetch data using Python. You may love to see this page now (if not seen already) **broken link removed**
 
Last edited:
To get data from database and to send it to serial port :- VB .net would be my first choice. The inbuilt SerialPort class is very rich. SerialPort Class

The reason why I cannot use .NET because I'm using Linux machines..I think .NET is only for windows right?

I checked the .NET serial port class from your link and it's good but I don't know how to use it in Linux machine.. .NET is only for windows right? Im not sure... hihihi ;)
 

I know that you are using LAMP . So you can use Python
In my last post there is a link where you will find some coded examples on serial port programming using Python

Since you can connect to database(mysql) and fetch data using Python. You may love to see this page now (if not seen already) **broken link removed**


---------- Post added at 10:30 ---------- Previous post was at 10:24 ----------

Also see Serial class in PySerial API : **broken link removed**
 
yes.. thanks.. that's my reference too.... It's quite difficult to me adapting new language because I'm not a programmer. I just learned C language 2months ago. ;)

But I'm working hard..

The next thing I will do is combine my pySerial and PyMSQL scripts... and will study about MySQL..

Thanks so much
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top