Go to advanced search

by przemof
Wed Nov 21, 2018 1:12 pm
Forum: Off topic discussion
Topic: BLE devices with no names
Replies: 5
Views: 2521

BLE devices with no names

I'm working on embedded project that uses BLE sensors. Afters scanning some of the BLE devices give nice names, but some are replying with BLE address only. My test sensors reply with human readable names and BLE device name is mandatory [1], so I guess I could safely ignore the devices without name...
by przemof
Wed Nov 21, 2018 12:56 pm
Forum: General discussion
Topic: How to start embedded application?
Replies: 2
Views: 270

Re: How to start embedded application?

Rebooting is just a way of checking if the application behaves as expected after a cold start - I will not need it when the project is finished. I'll need halt anyway. sudo shutdown -r now gives the same result - no reboot I might need to connect a normal display to see what the system is doing. I w...
by przemof
Wed Nov 21, 2018 12:37 pm
Forum: General discussion
Topic: How to start embedded application?
Replies: 2
Views: 270

How to start embedded application?

I currently use /etc/rc.local : # disable console blanking on PiTFT sudo sh -c "TERM=linux setterm -blank 0 >/dev/tty0" #Start OpenCyclingComputer cd /home/pi/Open-Cycling-Computer/code/ ./occ.sh & exit 0 but when i try to reboot the system using python (I use similar code in the application with th...
by przemof
Sat Nov 17, 2018 11:58 am
Forum: General discussion
Topic: GPIO Sine waves
Replies: 4
Views: 395

Re: GPIO Sine waves

If you need actual sine wave you'll need DAC converter. I.e. like the old school Covox: https://en.wikipedia.org/wiki/Covox_Speech_Thing
by przemof
Wed Nov 14, 2018 11:25 am
Forum: Other projects
Topic: Project fails when run on start up
Replies: 7
Views: 2175

Re: Project fails when run on start up

Code: Select all

try:
    while True:
        print("Waiting ...")
I really don't like that part. it will take 100% of CPU possibly blocking python interpreter. Add a sleep here.
by przemof
Tue Nov 13, 2018 10:45 pm
Forum: HATs and other add-ons
Topic: Fuel gauge (battery status) based on MAX17043 - help needed
Replies: 2
Views: 1131

Re: Fuel gauge (battery status) based on MAX17043 - help needed

Someone my be more lucky than me. The code: #!/usr/bin/python3 import smbus import time address = 0x32 VCELL_REG = 0x02 SOC_REG = 0x04 MODE_REG = 0x06 VERSION_REG = 0x08 CONFIG_REG = 0x0C COMMAND_REG = 0xFE fg = smbus.SMBus(1) def reset(): fg.write_byte_data(address, COMMAND_REG, 0x54) fg.write_byte...
by przemof
Tue Nov 13, 2018 4:48 pm
Forum: HATs and other add-ons
Topic: Fuel gauge (battery status) based on MAX17043 - help needed
Replies: 2
Views: 1131

Re: Fuel gauge (battery status) based on MAX17043 - help needed

Looks like the board I have is broken. I can do anything as per datasheet, except it doesn't measure voltage, so the results are useless. Looks like the unit from China/ebay are almost all rubbish [1]. Is there any battery gauge that just works nicely with pi? [1] https://forum.arduino.cc/index.php?...
by przemof
Tue Nov 13, 2018 12:33 pm
Forum: HATs and other add-ons
Topic: Fuel gauge (battery status) based on MAX17043 - help needed
Replies: 2
Views: 1131

Fuel gauge (battery status) based on MAX17043 - help needed

I'm trying to read from a fuel gauge (battery status) based on MAX17043. I have it connected and it shows in the i2c bus. I did some searching and I found: - there was a driver submitted to the kernel main line [1], but I don't see it there, - there is overlay for that chip - datasheet [2] - connect...
by przemof
Tue Nov 13, 2018 9:54 am
Forum: HATs and other add-ons
Topic: Pimoroni LiPo SHIM aka Zero LiPo - how to switch off
Replies: 7
Views: 1185

Re: Pimoroni LiPo SHIM aka Zero LiPo - how to switch off

More findings: pin EN is good for resetting, but won't keep pi powered off. So, for hardware switch is OK or for some external relay keeping pi switched off. Connecting pin EN to pin 7 triggers reboot when the battery discharges to ~3.35V, but then pi restarted and battery status was OK again. I don...
by przemof
Mon Nov 12, 2018 7:35 pm
Forum: HATs and other add-ons
Topic: Pimoroni LiPo SHIM aka Zero LiPo - how to switch off
Replies: 7
Views: 1185

Re: Pimoroni LiPo SHIM aka Zero LiPo - how to switch off

I think I found a software solution to the hardware problem:

Code: Select all

pi@raspberrypi:~/Open-Cycling-Computer/code $ grep gpio /boot/config.txt 
gpio=4=pu
Pulling up the GPIO 4 early fixes the interference problem on EN pin cable :D
by przemof
Mon Nov 12, 2018 7:28 pm
Forum: HATs and other add-ons
Topic: Pimoroni LiPo SHIM aka Zero LiPo - how to switch off
Replies: 7
Views: 1185

Re: Pimoroni LiPo SHIM aka Zero LiPo - how to switch off

^^^ I like that :D My findings so far, some of them confirmed at the source: - pin 7/ GPIO 4 is low when the battery is discharged, high when is OK - EN pin is not connected on PCB the pin 7 - grounding EN triggers immediate shutdown - connecting EN to pin 7 does not trigger boot loop as the pin 7 i...
by przemof
Mon Nov 12, 2018 3:16 pm
Forum: HATs and other add-ons
Topic: Pimoroni LiPo SHIM aka Zero LiPo - how to switch off
Replies: 7
Views: 1185

Re: Pimoroni LiPo SHIM aka Zero LiPo - how to switch off

Grounding EN does trigger reset. I'm trying to confirm with Pimoroni that connecting EN to any not used GPIO pin is the right thing. Then I could use that pin as power off.
by przemof
Sun Nov 11, 2018 9:44 pm
Forum: HATs and other add-ons
Topic: Pimoroni LiPo SHIM aka Zero LiPo - how to switch off
Replies: 7
Views: 1185

Re: Pimoroni LiPo SHIM aka Zero LiPo - how to switch off

Thanks, I'll try it. It would be great to have a schematic drawing for it... I asked Pimoroni - they are normally very good at answering.
by przemof
Sun Nov 11, 2018 9:24 am
Forum: HATs and other add-ons
Topic: Pimoroni LiPo SHIM aka Zero LiPo - how to switch off
Replies: 7
Views: 1185

Pimoroni LiPo SHIM aka Zero LiPo - how to switch off

I have Pimoroni Zero LiPo installed on pi zero W - all works great (except high pitch noise when battery is almost discharged). The Pimoroni web page [1] says: "The EN pin can be pulled to ground to cut the power output from LiPo SHIM." I guess EN pin is the same as board pin 7 or BCM 4? So I need t...
by przemof
Fri Nov 09, 2018 4:12 pm
Forum: Beginners
Topic: [SOLVED] init.d script problem
Replies: 0
Views: 116

[SOLVED] init.d script problem

I'm trying to get boot splashscreen on piTFT. In order to diagnose why it's not showing up I added some ls/lsmod redirected to a file to the script, but it doesn't work. Script started from command line works fine. Started by systemctl doesn't work, but no error. Any ideas? pi@raspberrypi:~ $ system...
by przemof
Fri Nov 09, 2018 3:14 pm
Forum: Advanced users
Topic: spidev implementation
Replies: 5
Views: 216

Re: spidev implementation

I'm just curious - did you test different rpis or it's test on a single board?
by przemof
Thu Nov 08, 2018 8:16 am
Forum: Beginners
Topic: Temperature controlled python code
Replies: 9
Views: 508

Re: Temperature controlled python code

About formatting: https://pyformat.info/ Experiment with interactive python and you'll get it quickly: $ python3 Python 3.6.5 (default, Mar 29 2018, 18:20:46) [GCC 8.0.1 20180317 (Red Hat 8.0.1-0.19)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> temp = '12.3456...
by przemof
Thu Nov 08, 2018 12:05 am
Forum: Beginners
Topic: Temperature controlled python code
Replies: 9
Views: 508

Re: Temperature controlled python code

In your original code you have try: but no except: and you have unfinished 'h20temp = ' outside of the while loop - it should be inside. Add some time delay in the loop like, time.sleep(1) or it will use 100% of CPU. Pseudocode: while True: measure temperature do something with gpio based on the mea...
by przemof
Wed Nov 07, 2018 11:59 pm
Forum: Beginners
Topic: Temperature controlled python code
Replies: 9
Views: 508

Re: Temperature controlled python code

First I'd suggest to go through a basic python tutorial - that will make your task much easier. 1. Get the function gettemp and copy it to your gpio code. 2. In the 'while' loop call the gettemp function. it returns temperature, so: id = '28-0417c207b8ff' temp = gettemp(id) Returning temperature as ...
by przemof
Fri Nov 02, 2018 6:16 pm
Forum: Python
Topic: BMP280, testers needed
Replies: 25
Views: 1941

Re: BMP280, testers needed

Kalman filter simulator in libreoffice attached.
Real pressure data + simulation of step change to show how the filter reacts to a sudden change. Red line - my settings for bmp280, yellow line: smooth measurement, but the filter reacts slowly to a sudden change (high inertia).
by przemof
Fri Nov 02, 2018 5:26 pm
Forum: Python
Topic: BMP280, testers needed
Replies: 25
Views: 1941

Re: BMP280, testers needed

Tweak Q and R. It's all about finding balance between smooth results and speed of the reaction. I need bmp280 to cycling, so I need quick reaction to calculate altitude change, but for weather monitoring I'd go for very smooth results. If you use my kalman filter code you can setup 3 filters for the...
by przemof
Fri Nov 02, 2018 1:29 pm
Forum: Python
Topic: BMP280, testers needed
Replies: 25
Views: 1941

Re: BMP280, testers needed

Thanks again for testing. I use the kernel approach (thanks, DougieLawson !) and with catching those 2 errors seems to be bulletproof: try: with open('/sys/bus/iio/devices/iio:device0/in_pressure_input', 'r') as press: self.pressure = float(press.read()) * 1000.0 with open('/sys/bus/iio/devices/iio:...
by przemof
Wed Oct 24, 2018 8:58 am
Forum: Python
Topic: BMP280, testers needed
Replies: 25
Views: 1941

Re: BMP280, testers needed

Use dmesg. I had address problem that was fixed with:

Code: Select all

dtoverlay=i2c-sensor,addr=0x77,bmp280
Use i2cdetect -y 1 to check it the sensor is there.
by przemof
Mon Oct 22, 2018 11:15 am
Forum: Python
Topic: BMP280, testers needed
Replies: 25
Views: 1941

Re: BMP280, testers needed

There is nothing in /sys/bus/iio/devices, I guess I have communication problem. Edit: dmesg show this: [ 10.122270] 1-0076 supply vddd not found, using dummy regulator [ 10.122375] 1-0076 supply vdda not found, using dummy regulator [ 10.191302] bmp280: probe of 1-0076 failed with error -121 Just t...
by przemof
Sun Oct 21, 2018 7:53 pm
Forum: Python
Topic: BMP280, testers needed
Replies: 25
Views: 1941

Re: BMP280, testers needed

Oversampling settings are in the tree and looks like I could change them, but they are set by default to what I need. There are also 2 more parameters that BMP280 allows to set (t_standby - time between measurements and IIR filter) that are not exposed to the user space by the kernel driver. Anyway ...

Go to advanced search