Go to advanced search

by shadetree01010100
Mon Feb 05, 2018 6:31 pm
Forum: Python
Topic: RS-485 communication Python
Replies: 18
Views: 11601

Re: RS-485 communication Python

I forgot about the rs485 class, yes I think it will make your life much easier, give it a try. And yes, that is how you set serial options, looks like you've got it!
by shadetree01010100
Fri Feb 02, 2018 6:22 pm
Forum: Python
Topic: RS-485 communication Python
Replies: 18
Views: 11601

Re: RS-485 communication Python

I can hazard a guess, but without being able to play with your IO myself I'm really shooting in the dark: remember that x=d2.read(d2.inWaiting()) is a blocking call, so your program will wait here until some data is received. Furthermore, I believe that inWaiting is called before read, and will retu...
by shadetree01010100
Thu Feb 01, 2018 9:57 pm
Forum: Python
Topic: How to read Video likes/views stats with Youtube API?
Replies: 2
Views: 2606

Re: How to read Video likes/views stats with Youtube API?

Thanks for posting a follow up!

In the future, I would suggest getting familiar with the official API docs. They can be quite large and overwhelming, but here is the page with the info you needed: https://developers.google.com/youtube/v3/docs/videos
by shadetree01010100
Thu Feb 01, 2018 9:50 pm
Forum: Advanced users
Topic: Sharing of Ethernet Port (USB) between two raspberry pi
Replies: 3
Views: 506

Re: Sharing of Ethernet Port (USB) between two raspberry pi

I'm not sure that I understand what you want to do, You want each Pi to have two ethernet interfaces, where the second one is the USB adapter on the other Pi?
by shadetree01010100
Thu Feb 01, 2018 9:31 pm
Forum: Troubleshooting
Topic: LoRA USB Help
Replies: 3
Views: 479

Re: LoRA USB Help

I have to ask this question first: baud/data/parity/stop are set correctly in minicom? Can you elaborate on "slightly scrambled"? Is your data ASCII text, and/or are there unprintable bytes in there? If you're dealing with bytes instead of text, you'll have a much happier time if you enable hex disp...
by shadetree01010100
Thu Feb 01, 2018 9:14 pm
Forum: Python
Topic: Python and button
Replies: 2
Views: 459

Re: Python and button

As pcmanbob said, it sounds like you've encountered bounce . Luckily, you're not the first one, and there are many, many ways to debounce an input like this. If you have some free time, this is a very informative read: http://www.ganssle.com/debouncing.htm I have to disagree about increasing the sle...
by shadetree01010100
Tue Jan 30, 2018 10:53 pm
Forum: Python
Topic: Capturing and emailing temp alerts
Replies: 3
Views: 788

Re: Capturing and emailing temp alerts

Here is a really quick stab at your code. This should check the temperature once per minute, and if the current temperature is more than 10°F from the mean of temp_buffer, send_mail will be called. def check_temp(): temp = sensor.readTempC() * 1.8 + 32 temp_buffer.append(temp) if temp - mean(temp_bu...
by shadetree01010100
Mon Jan 29, 2018 4:23 pm
Forum: Assistive technology and accessibility
Topic: Snore to non-snore detector.
Replies: 3
Views: 7844

Re: Snore to non-snore detector.

This sensor breakout isn't too expensive, and may simplify the task of quantifying sound in general: https://www.sparkfun.com/products/12642
by shadetree01010100
Mon Jan 29, 2018 4:09 pm
Forum: Python
Topic: very absurd problem with if
Replies: 6
Views: 768

Re: very absurd problem with if

I think piglet nailed it, since it's printing 2 but not evaluating to "2", what's probably happening is you're comparing a string to an integer. >>> 2 == 2 True >>> 2 == "2" False Remove the quotes around "2" and try again. rant: for any new projects, you should really be using Python3. https://www....
by shadetree01010100
Wed Jan 24, 2018 5:45 pm
Forum: Python
Topic: name is not defined in a class
Replies: 15
Views: 3246

Re: name is not defined in a class

You need to call it like self.after(50, self.readSerial()) No. See previous answer. PeterO Ah, you are correct, I assumed that the after() method wanted the return value of his method, not a callable. In either case, the code he posted above still was not referencing self.readSerial, and that's the...
by shadetree01010100
Wed Jan 24, 2018 5:39 pm
Forum: Python
Topic: Neuronet & power regulation
Replies: 4
Views: 559

Re: Neuronet & power regulation

This certainly sounds like an ANN could be trained for the task, I think I've done something similar. Do you have any experience with machine learning? You may find that modifying your PID parameters based on subject's mass (probably accounting for surface area and coefficients of your material) cou...
by shadetree01010100
Wed Jan 24, 2018 5:31 pm
Forum: Python
Topic: PIP, how the hell do you batch upgrade.
Replies: 5
Views: 559

Re: PIP, how the hell do you batch upgrade.

There are some good ideas in this stack overflow thread: https://stackoverflow.com/questions/272 ... s-with-pip but they're all command-line based, not sure if that's really what you want.
by shadetree01010100
Wed Jan 24, 2018 5:26 pm
Forum: Python
Topic: name is not defined in a class
Replies: 15
Views: 3246

Re: name is not defined in a class

You need to call it like self.after(50, self.readSerial())
by shadetree01010100
Wed Jan 24, 2018 4:46 pm
Forum: Python
Topic: mcp42X1.h to python
Replies: 1
Views: 290

Re: mcp42X1.h to python

I've never used this chip before, but found this datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/22060a.pdf page 47 describes the 16bit packets to be sent over SPI to control the device. Looking at your code, your set_value function is sending a 0-padded binary string of an integer value,...
by shadetree01010100
Wed Jan 24, 2018 4:11 pm
Forum: Python
Topic: AMS812 Pressure sensor IO error with Python
Replies: 5
Views: 776

Re: AMS812 Pressure sensor IO error with Python

I think you should only need to replace 0x78 with 0x3C in your Python code. Do you see a device at 0x3C in i2cdetect? You can also use 0x78 >> 1 in your code instead of 0x3C , the Python interpreter will shift the bits for you at run time, allowing you to keep the same address in your code as what's...
by shadetree01010100
Tue Jan 23, 2018 11:36 pm
Forum: Python
Topic: How to read I2C values with python smbus from BQ27441 (battery fuel gauge)
Replies: 4
Views: 4966

Re: How to read I2C values with python smbus from BQ27441 (battery fuel gauge)

it looks like writing is working fine, but it's not liking what you're trying to write into 0x60 BlockDataChecksum(): 0x60 UNSEALED Access: This byte contains the checksum on the 32 bytes of block data read or written. The least-significant byte of the sum of the data bytes written must be complemen...
by shadetree01010100
Tue Jan 23, 2018 9:10 pm
Forum: Assistive technology and accessibility
Topic: Need timer/ phone dialer help
Replies: 3
Views: 7788

Re: Need

Here's a project on hackster.io that's similar, using a motion sensor for input instead of a button: https://www.hackster.io/drew-noolas/ras ... sor-aed9db
by shadetree01010100
Tue Jan 23, 2018 7:01 pm
Forum: Beginners
Topic: Need Advice About the API : best choice depend on my requirement
Replies: 1
Views: 219

Re: Need Advice About the API : best choice depend on my requirement

This sounds like a great project, and you have a good idea of the sensors you'll need. The integration of machine learning is a high goal, and certainly attainable depending on what, exactly, you want the machine to learn! Your application reminds me of this workshop, maybe you can get some ideas he...
by shadetree01010100
Mon Jan 22, 2018 11:49 pm
Forum: Python
Topic: How to assign hysteresis/Schmitt trigger to an Input?
Replies: 9
Views: 1805

Re: How to assign hysteresis/Schmitt trigger to an Input?

I've never been able to improve the behavior of the built-in Schmitt triggers, often finding that the hysteresis doesn't quite perform as I expected, and have instead used programmed solutions, similar to what you described.
by shadetree01010100
Mon Jan 22, 2018 11:05 pm
Forum: Python
Topic: Help with smart security camera CODE comments
Replies: 2
Views: 550

Re: Help with smart security camera CODE comments

One of the great things about Python is that it can be self-documenting, meaning that comments are not needed because they only repeat the information contained in already human-readable code. Because of this you really won't find any code that's fully annotated, nor anyone interested in doing it. E...
by shadetree01010100
Mon Jan 22, 2018 10:50 pm
Forum: AIY Projects
Topic: voicekit branch installation, help needed
Replies: 4
Views: 787

Re: voicekit branch installation, help needed

Code: Select all

cd ~/AIY-projects-python/
git checkout voicekit
if you don't already have git installed:

Code: Select all

sudo apt-get install git
by shadetree01010100
Mon Jan 22, 2018 10:28 pm
Forum: Python
Topic: Fingerprint comparison
Replies: 9
Views: 1908

Re: Fingerprint comparison

OpenCV may be a good resource for you to get familiar with, since this is fundamentally a computer vision problem. This thread may help get your started: http://answers.opencv.org/question/6364 ... form/#6370
by shadetree01010100
Mon Jan 22, 2018 10:08 pm
Forum: Python
Topic: How to read I2C values with python smbus from BQ27441 (battery fuel gauge)
Replies: 4
Views: 4966

Re: How to read I2C values with python smbus from BQ27441 (battery fuel gauge)

in the linked datasheet, 3.1 Data Memory Parameter Update Example , tells us that the device has two bus addresses, 0xAA and 0xAB. Note that your pi is not going to work with address 0xAB, the actual address is 0x55 (addresses above 0x77 must be shifted one bit to the right). So using SMBus you want...
by shadetree01010100
Mon Jan 22, 2018 9:45 pm
Forum: Python
Topic: AMS812 Pressure sensor IO error with Python
Replies: 5
Views: 776

Re: AMS812 Pressure sensor IO error with Python

You're sure that nothing shows up when you run i2cdetect -y 1? When you see an address above 0x77, what's actually happening is the Pi and chip are disagreeing on how to handle the "extra" address bit (I2C address are 7 bits, plus one for read/write). The solution is, when faced with an address grea...
by shadetree01010100
Fri Oct 13, 2017 4:53 pm
Forum: General discussion
Topic: Switching (and wiring) a relay from Python
Replies: 23
Views: 4318

Re: Switching (and wiring) a relay from Python

These Songle relays are coming on so many boards these days that I guess you really have to wait and see what arrives! It looks like what you have already has most of my circuit on board, and it is intended to be triggered by +5V to the S pin. The problem, as @davidcoton mentioned, is that your 3.3V...

Go to advanced search