Go to advanced search

by rkn704
Fri Oct 25, 2019 11:19 am
Forum: Python
Topic: [solved] Puzzled by two simple hex-dec-string mixup
Replies: 7
Views: 1046

Re: Puzzled by two a simple hex-dec-string mixup

I use the binascii module for converting serial data to Hex or Ascii representation. The following has been chopped from a program that monitors a serial port and then saves the data to two separate text files. One with the Hex data the other with the Ascii. You can easily manipulate the data once i...
by rkn704
Thu May 09, 2019 12:22 pm
Forum: Français
Topic: Controle Moteur avec une carte Sabertooth 2x12
Replies: 4
Views: 438

Re: Controle Moteur avec une carte Sabertooth 2x12

I am sorry I can't reply in French. I had a look at the Sabertooth I think your switch settings need checking if you want to use pwm. Using the selections shown on https://www.dimensionengineering.com/datasheets/SabertoothDIPWizard/start.htm Step 1 Lipo or NiCd & Lead Acid? You choose Lipo? Step 2 F...
by rkn704
Thu Apr 25, 2019 12:50 pm
Forum: Python
Topic: TwythonStreamer and CUPS printer
Replies: 3
Views: 239

Re: TwythonStreamer and CUPS printer

You can also use the lp command check out https://www.computerhope.com/unix/ulp.htm this is a simpler method.

I used the cups.Connect type method as shown in my previous post as I needed to detect when different printers of the same printer model were connected by reading the URI info .
by rkn704
Thu Apr 25, 2019 12:27 pm
Forum: Python
Topic: TwythonStreamer and CUPS printer
Replies: 3
Views: 239

Re: TwythonStreamer and CUPS printer

This is how I send txt files to a Cups printer for printing. Make sure your Cups server has been running for 10 seconds or so before attempting to use the cups.Connection method. I got caught out with printing not working after rebooting the Pi until I put in a delay to allow the Cups server to get ...
by rkn704
Sun Mar 24, 2019 12:06 pm
Forum: Advanced users
Topic: modbus rtu arduino raspberry over usb
Replies: 2
Views: 1322

Re: modbus rtu arduino raspberry over usb

I tried to use the ttyACM port and a USB cable between the PI and Arduino but was receiving an error 'object has no attribute 'registers' I eventually figured out that this problem is caused by the initial port setup causing the Arduino to reset. (My Arduino is a Elegoo Uno R3, not sure if this beha...
by rkn704
Sun Mar 24, 2019 10:29 am
Forum: Troubleshooting
Topic: send to /dev/ttyACM0
Replies: 2
Views: 4424

Re: send to /dev/ttyACM0 with Arduino

This may be an old post but I think this may help others. I had the same issues as AndreeeCZ until I realised that when the ttyACM port is initially setup it causes the Arduino to reset. This means that for the next 1 seconds or so the Arduino is ignoring data you may be sending to it. If the code i...
by rkn704
Sun Feb 17, 2019 2:02 pm
Forum: Python
Topic: Modbus RTU RasPi 3B+ and PowerMeter
Replies: 2
Views: 914

Re: Modbus RTU RasPi 3B+ and PowerMeter

Did either of you guys manage to overcome this issue with Pymodbus. I am seeing the same problem when trying to replicate the tests shown in this post https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=233458&sid=7724b72a2151954c4eb71d63ac409bc6 Like Mopsiu50 I have tried to use an Arduino as a...
by rkn704
Thu Feb 14, 2019 10:24 am
Forum: Advanced users
Topic: modbus rtu arduino raspberry over usb
Replies: 2
Views: 1322

Re: modbus rtu arduino raspberry over usb

I haven't tried this before but after looking at Modbus basics on Wiki I am wondering if the PI part value = client.read_input_registers(10000,1,unit=1) should it read ? value = client.read_input_registers(10001,2,unit=1) 10001 for the start register 2 for the function code to read inputs (or possib...
by rkn704
Sat Dec 08, 2018 10:50 am
Forum: Python
Topic: program stops at random
Replies: 8
Views: 939

Re: program stops at random

Did you resolve this issue? I left your program running on a Pi using Putty to SSH to it. It ran fine for 48+ hours. I would disconnect the LED's and any external hardware and see if the program runs OK. How are you powering the LED's? Try a different power supply. I had all sorts of problem when us...
by rkn704
Tue Dec 04, 2018 4:36 pm
Forum: Python
Topic: sensor dht11 + lcd + log csv
Replies: 7
Views: 1010

Re: sensor dht11 + lcd + log csv

I posted a logging type reply the other day see

viewtopic.php?f=32&t=227957

For your application write the data with commas separating the the values and change the file extension to CSV instead of TXT
by rkn704
Mon Dec 03, 2018 6:07 pm
Forum: Python
Topic: Outputting text to a .txt file one a micro controller 3
Replies: 3
Views: 918

Re: Outputting text to a .txt file one a micro controller 3

How about something like this to get you started #!/usr/bin/env python import time import datetime now = datetime.datetime.now() truncnow = str(now)[0:19] fileName = "My_test_"+ truncnow + ".txt" #file name with date & time f = open(fileName,'w') #creates file f.write("Here is my test file" + "\n") ...
by rkn704
Mon Nov 19, 2018 10:01 am
Forum: Python
Topic: GPIO output is sensed by another GPIO input...
Replies: 3
Views: 824

Re: GPIO output is sensed by another GPIO input...

I would start by concentrating on the electronics. Any relay with a coil should have a 'flywheel' (flyback) diode fitted across it. If you have purchased a relay board there should be diodes fitted or the IC driving the coils should have an in built diodes. Without a diode there will be a huge spike...
by rkn704
Sun Aug 05, 2018 12:47 pm
Forum: Python
Topic: Serial problem
Replies: 10
Views: 829

Re: Serial problem

With the rtscts = True you have to have your receiving device returning the correct handshake signal before you can send out data. You say you are monitoring the output with a scope. As the scope will possibly not have handshaking I think you should remove all handshaking features. Remove the follow...
by rkn704
Tue Jul 03, 2018 1:44 pm
Forum: Python
Topic: [SOLVED] Python - Sainsoft USB 4 Relay Board
Replies: 14
Views: 2471

Re: Python - Sainsoft USB 4 Relay Board

Going back a couple of steps. I believe the problem when you tried using the sample code that numato posted on git hub was in the section #Send the command serPort.write("relay "+ str(relayCmd) +" "+ str(relayNum) + "\n\r") I think it should be #Send the command serPort.write("relay write "+ str(rel...
by rkn704
Mon Jun 11, 2018 12:30 pm
Forum: Python
Topic: Serial error when adding script the pi startup
Replies: 3
Views: 502

Re: Serial error when adding script the pi startup

I had an issue with serial comms following auto start up. To overcome the issue I just put a small delay in at the beginning of the program so that all services could settle down before comms became active. It only runs once at the startup so it should not be a problem. Ten seconds made all the diff...
by rkn704
Wed May 09, 2018 12:53 pm
Forum: Python
Topic: space code python
Replies: 3
Views: 442

Re: space code python

I think you will need to close the file so you can view the results. f.close() Where I have text files that I want to monitor I open the file for writing, write the data and then immediately close the file so I can then view the captured data at any time. yourdata below needs to be a string f.write(...
by rkn704
Wed Apr 11, 2018 1:35 pm
Forum: Python
Topic: Need help using serial port - RPi 3 Model B
Replies: 8
Views: 3311

Re: Need help using serial port - RPi 3 Model B +

Just tried your loopback test with a RS232 to USB converter and it worked fine (after sorting the indent for the try/except) If you use a RS232 to USB converter the port needs to be "/dev/ttyUSB0" or similar appropriate for the USB port you are using. Are you sure you do not have a hardware problem?...
by rkn704
Sun Mar 18, 2018 1:00 pm
Forum: Python
Topic: Pi serial comms problem
Replies: 5
Views: 661

Re: Pi serial comms problem

When you used Minicom was that using the a Pi? Did you use the same hardware, cable etc? If you are using a USB to RS232 converter for the comms then the port should be something like /dev/ttyUSB0 Is the problem with the command AT not reaching the GPS device or is it a problem with the reply? Does ...
by rkn704
Sun Mar 18, 2018 10:49 am
Forum: Python
Topic: Pi serial comms problem
Replies: 5
Views: 661

Re: Pi serial comms problem

When I read from the serial port I use read rather than readline. May be this has something to do with it.

Code: Select all


response=port.read(100)  #where the 100 is the number of characters to read.

by rkn704
Thu Mar 15, 2018 1:36 pm
Forum: Python
Topic: newby -using time with a python script
Replies: 9
Views: 1236

Re: newby -using time with a python script

I found the schedule function nice and easy to use. Just include the code in your script. Check out the schedule documentation for other options In the example below you can add an open and close event line for each day as required. The ShopOpen and ShopClosed functions will run once (1 time) when t...
by rkn704
Tue Nov 14, 2017 5:11 pm
Forum: Python
Topic: Phyton script stops when Google refuses mail session...
Replies: 5
Views: 616

Re: Phyton script stops when Google refuses mail session...

Have you changed the setting in Gmail to allow less secure apps & devices to access your account?
by rkn704
Sat Aug 19, 2017 12:43 pm
Forum: Python
Topic: pycups addPrinter to CUPS server command. Help Please
Replies: 1
Views: 1200

Re: pycups addPrinter to CUPS server command. Help Please

Eventually figured it out myself, this works. import cups conn = cups.Connection() p_name = "HP_LaserJet_3200" # Printer Queue Name in CUPS file_name = "/home/pi/rich.ppd" # PPD file location inf = "HP_Printer" # Description in CUPS loc = "Office" # Location uri_add = "http://192.168.1.202" # URI of...
by rkn704
Tue Aug 15, 2017 9:00 pm
Forum: General discussion
Topic: CUPS server USB printer URI / Device issue
Replies: 0
Views: 461

CUPS server USB printer URI / Device issue

I want to use Raspberry pi's as print servers with modern USB printers to replace ancient serial printers with RS232 ports that are attached to legacy systems. My simple python program monitors the RS232 port on the legacy system, creates a text file and then prints the output via a CUPS server to a...
by rkn704
Tue Aug 15, 2017 7:47 pm
Forum: Python
Topic: pycups addPrinter to CUPS server command. Help Please
Replies: 1
Views: 1200

pycups addPrinter to CUPS server command. Help Please

Please can someone provide an example of how to use the addPrinter command in pycups. I want to add a USB printer to the CUPS server. In my application it will not be possible to go directly into CUPS to set up a printer. I have checked the documentation shown on http://pythonhosted.org/pycups/ but ...
by rkn704
Thu May 11, 2017 11:48 am
Forum: General discussion
Topic: Connecting USB printer stops Pi
Replies: 11
Views: 1508

Re: Connecting USB printer stops Pi

Thank you pcmanbob and fruitoftheloom.

The usb port boosting mod in config.txt made the difference.

max_usb_current=1

I can now disconnect and reconnect the printer without issue.

Go to advanced search