Enable Raspberry Pi's internal pull-up resistors? - android-things

Is there a way to enable Raspberry Pi's internal pull-up resistors using Android Things?
EDIT: I filed a feature request -> https://code.google.com/p/android/issues/detail?id=233630

As of current release (DP2), there is no Peripheral I/O API to dynamically configure pull/down resistor on Android Things.
However has pointed in the release notes and the BCM2835 documentation, the Raspberry Pi 3 has internal pull-up (3.3V) resistor configured by default on the following pins, when configured as input with Gpio.setDirection:
BCM4
BCM5
BCM6

This is now available through the android things console:

First you should read this link for base knowlege.Pull-up resistors is hardware, it make uncertain voltage to 1 or 0 for pin!

Related

Using Coral Dev Board as wifi router

Im doing a project with IP cameras and Coral, so I'd like to know is it possible to create a wifi hotspot using only coral. I've tried couple ways, but they ended up to be not working
Coral Dev board uses "Murata LBEE5U91CQ module". And this chip does support dual mode network topology (AP + STA). Please see the details at : https://wireless.murata.com/type-1cq.html.
Driver is nl80211 and AP is supported so standard Linux tools can be used. Generally this is accomplished with hostapd, you can see an example configuration here: https://nims11.wordpress.com/2012/04/27/hostapd-the-linux-way-to-create-virtual-wifi-access-point/. That being said, hostapd lets you configure many more modes that will enable. The maximum data rate will vary wildly based on your configuration, but the device can support 802.11n with two antennas so up to 300 Mbps may be possible. Run 'iw list' for more info on capabilities.
Note: both hostapd and iw need to be installed via apt.

Working with PiCAN + raspberry pi 3 running windows IoT Core

I want to connect the PiCAN with my raspberry pi3 running windows IoT Core. I think I need a universal driver for the mcp2515 to work with the windows in Pi. I already tried using the instructions given in https://developer.microsoft.com/en-us/windows/iot/docs/driverdeployment to deploy the driver given in https://github.com/AustinWise/Mcp2515Can . But I got stuck in the instructions. I hope someone has already done this and maybe can help me with it? Did anyone successfully use this CAN board with Raspberry Pi (windows iot core)?
Thank you :)
Is a driver required in the first place?
Short answer is No.
Although a device driver is preferred, such work is not officially or community done yet.
The benefit you get from developing a device driver might include:
Native OS support for PiCAN board.
Create your create the custom IoT image, and deploy it to Microsoft store.
Possible performance improvements
others…
However, in order to develop an device driver, you need to follow the WDK framework. If you are comfortable with picking up new stuff, go ahead and try it out. You might need to refer to the linux source driver code for WDK driver developing.
If your purpose is to get the board working, you don’t need to get yourself into all these troubles.
In fact, you only need to get the SPI controller and GPIO controller, open the SPI device and initialize GPIO interrupt pin like Mcp2515Can does.
But, even after enabling the SPI, I couldn't receive anything on the
Raspberry Pi.
First, you can use Raspbian and turn on the CAN driver support to verify that you got all the wirings right. Here is the user guide you can reference.
If you can rule out the possibility of hardware failures, step into your C# code to troubleshoot the software.
Good luck.

Test OBD iOS App without using vehicle

Currently, I am working on an iOS App using OBD device. How can I test it without using a vehicle.
You'll either need to purchase a simulator, which can be upwards of $300-400, or you could setup a bench ECU.
You should be able to find an ECU in a junkyard for $20-40 with the connector then you just need to wire it to an OBD2 port and a 12V for power. No messing around with creating testing classes, you'll be dealing with real world implementations.
You can either, as one commenter suggested, write a class that implements a common device interface and provides mock data, or use a hardware simulator like this one
The problem with iOS is that BT OBD adapters will not work, only BT-LE.
I took the following approach:
OBDSim has a TCP fork that lets it run using a TCP channel (note that this is different from -g Socket - this does not create a TCP channel for communication)
I compiled this fork and it works great. I run it on OS X using obdsim -T 5000 -g Cycle which runs it onTCP port 5000
Next up,there is a fork of node-blueooth-obd package which added an option to make it work over TCP as well. You can find the fork here
Finally, you can use ionic & cordova to use this forked library and communicate with a TCP based OBD simulator - see an example here
This setup is great for testing, and you should be able to swap OBDsim with WiFi ODB adaptors like OBDlink from Scantool

looking for alternative solution than IPFW for slowing down an internet connection

I need to slow down (simulate bad) internet connection, I found some documentation where it was achieved by "ipfw pipe" command , the thing is that in latest MAC OS versions , ipfw was deprecated (and removed)...
I was wondering if there are any alternative to the ipfw API ?
Does anyone know how latest Network Link Conditioner achieves it?
The original previous way which enabled to slow down an internet connection :
sudo ipfw pipe 1 config bw 56Kbit/s delay 200 plr 0.2
and to clear the pipe :
sudo ipfw delete 1
Thanks.
I don't know much about Mac OS (I use Linux myself), but I'll give this a shot.
A bunch of digging established that ipfw seems unavailable, as you say.
I was also unable to find a way to use the Network Link Conditioner from the command line. Everything should be usable from the command line, so that's stupid.
One work around would be to try to access the NLC from within AppleScript. The following will get you started on toggling the NLC:
property thePane : "com.apple.Network-Link-Conditioner"
tell application "System Preferences"
activate
set the current pane to pane id thePane
--delay 2
end tell
---
tell application "System Events"
tell application process "System Preferences"
try
click ((checkboxes of window "Network Link Conditioner") whose description is "enable switch")
on error
click ((checkboxes of window "Network Link Conditioner") whose description is "enable switch")
end try
end tell
end tell
I think that you can run a script from the terminal with osascript <SCRIPT>.
As an alternative, Charles Proxy is a pay-to-use program that can be used to perform throttling, provided you can convince the software you are testing to connect to the proxy's port rather than directly to the internet. Maybe there are free proxy solutions out there somewhere?
Perhaps Squid would work in that regard. SquidMan seems to be an easy-ish way to install it for Mac. It looks as though DelayPools and or Client Bandwidth Limits might be useful for simulating a low speed connection, though I can't find evidence of people having used them for such.
I found several solutions that might work. They come from some old threads, but they might help:
How to simulate slow internet connections on the mac
Apple has made a very handy official tool to slow down the network connections on you Mac for testing purposes.
The Network Link Conditioner preference is a free download from within Xcode (for Lion and later OS). Additionally, iOS has similar function accessible from within Xcode and iOS 6 or later.
How do I simulate a bad Wi-Fi connection on my iPad?
There are a few ways you can do this, depending on your situation:
Move further away from your router. While this may seem a bit obvious, I realize that it isn't always possible while testing/debugging (for example, if you are working on a desktop computer).
Put aluminum foil around the router and/or antenna. This will (partially) block some or all of the radio signals by creating a makeshift Faraday cage. The results you get will depend on the strength of your router signal, distance from the router, and other environmental factors.
Set your router's wireless signal power to a lower setting. The method for doing this is different for each router, so you will have to look at the user guide for instructions on how to do this.
Slow down internet for iOS simulator
You can set the network to slow characteristic by testing on devices. Go to Settings -> Developer Settings -> Network Link Conditioner -> Enable. This is for iPhone/iPad running iOS 6
I don't know if the last one you can still do.
I've used many methods in the past for slowing down network connections, among them:
performing a parallel download of some massive Linux ISO file;
physically pulling out the Ethernet cable (at one point, I actually toyed with the idea of building a push-button device that would sit between two cat5 cables and do this without having to physically disconnect the whole cable).
using ifconfig eth0 down ; sleep 1 ; ifconfig eth0 up.
Hopefully one or more of those methods will help.
If you're looking to slow down your network connection because you're doing testing/profiling work, one option is to get a specific device that can create network latency/noise.
For example Apposite Tech's mini2 WAN emulator allows you to change values for bandwidth and packet loss. You can roll your own device too using something like: http://wanem.sourceforge.net/ . It just depends on your needs, time and budget.

Is there a way to limit processing power and network bandwidth for iPhone Simulator?

Is there a way to limit processing power and network bandwidth for iPhone Simulator?
This question is essentially a CPU and bandwidth limiting tool for specific program on Unix. Any recommendations...?
As for network/bandwidth limitations, there's a really good tool called Network Link Conditioner included with XCode nowadays. Possible to use a number of presets as well as setting up your own configurations.
You can also check out:
How do I simulate a slow internet connection (Edge/3g) on a mac. Is there a Firefox plugin?
UPDATE: Note that the Network Link Conditioner (as of iOS6) is available from the Settings > Developer menu on your iPhone (if it's marked as Use for development).
To limit your bandwidth, you can try using http://mschrag.github.com/. It's a preference pane which helps you simulate several bandwidth configurations (Edge, 3G, etc).
You could try using nice: http://unixhelp.ed.ac.uk/CGI/man-cgi?nice
At least that will help with the CPU problem.
You can use cpulimit to limit the CPU usage in term of percentage.
UPDATE: Read this discussion to know how to configure iptables to limit bandwidth per process.
You could use the osx firewall to do this :
sudo ipfw add 1 pipe 1 ip from any to me src-port 80
sudo ipfw pipe 1 config bw 40KByte/s
Edit : it seems that the simulator use local ipv6 address, and ip6fw doesn't manage pipe and bandwidth limit. I've edited my code to be sure that localhost v4 (127.0.0.1) address is used.

Resources