From owner-freebsd-arm@FreeBSD.ORG Sat Aug 30 00:51:24 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 00F029F1 for ; Sat, 30 Aug 2014 00:51:23 +0000 (UTC) Received: from mail-we0-x236.google.com (mail-we0-x236.google.com [IPv6:2a00:1450:400c:c03::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D140110F for ; Sat, 30 Aug 2014 00:51:23 +0000 (UTC) Received: by mail-we0-f182.google.com with SMTP id w62so2878846wes.41 for ; Fri, 29 Aug 2014 17:51:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=0Bx5zh+d+ecMGH0Wg98JxT3LFXEJeu1507S/iTbwe78=; b=zGlw51+cT4AFRILrIFW9DOPdqTgm/dwGf6brtwqlMnlIg7q8xqaGXhVjo0EVHQvf3c 0VawXVvGBK3mdnIW9uWJ2lDKyaKjGXiBJ3tYuBDqvbFTBpqMNZJDcfXf40LihImUfhbv KFjjvYsNK3AEHDfS2CJdJmvIsyAqcO2BGnvAYOEK7v5e3KuACG3ybxisGRhqTcObty0E uG+11bYkJhVHaEiUl3Kq+asgWUaG24i3XoXFtNBS8HBw1/SC9rZkXuaBU1OzBvrWtvBQ kf8VidiS7nwfL9pcHn+tbqRk+ylcLzPYg/9AIOhX2d5KXwAnH1MYU1/Dco3y2D8NGoxi dHdg== MIME-Version: 1.0 X-Received: by 10.180.104.42 with SMTP id gb10mr7233958wib.65.1409359881476; Fri, 29 Aug 2014 17:51:21 -0700 (PDT) Received: by 10.217.93.133 with HTTP; Fri, 29 Aug 2014 17:51:21 -0700 (PDT) In-Reply-To: References: <5D802942-2D0F-4324-8212-C2871EEB6327@FreeBSD.org> <01562FB1-32C6-45AF-AB77-5BB80526E18C@FreeBSD.org> <53F8FED8.6030409@freebsdbrasil.com.br> <3949AF9C-B5BD-44E8-A049-21F26B8B6B9A@freebsdbrasil.com.br> <411C643B-BC46-494E-919B-39098FB87EEA@freebsdbrasil.com.br> Date: Fri, 29 Aug 2014 21:51:21 -0300 Message-ID: Subject: Re: HC-SR04 and FreeBSD From: Evandro Nunes To: Luiz Otavio O Souza Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "freebsd-arm@freebsd.org" , Rui Paulo X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Aug 2014 00:51:24 -0000 hello luiz, it looks promissing! i will try it by the weekend thank you very much it seems like a begining for a libary, or at least an examples collection, a sonar sensor utility, a relay which you helped me before, the temperature sensor patrick mentioned and you seem to have it working... I guess they are the basic and popular stuff On Fri, Aug 29, 2014 at 3:07 PM, Luiz Otavio O Souza wrote: > Okay, so i got my hands on one HC-SR04 and got it working quite > easily. Two consecutive GPIO readings takes from 15 to 30 usec which > gives a good precision for this case (readings above 116 usec). > > I written a simple C program to program the GPIO pins, trigger the > sensor and read back the duration of echo pulse, it give me good > readings using the datasheet formula, so i'm happy with it. Build it > with: cc -o hc-sr04 hc-sr04.c > > I'm using the wiring suggested at (voltage divisor on echo pin): > > https://www.modmypi.com/blog/hc-sr04-ultrasonic-range-sensor-on-the-raspberry-pi > > The trigger and echo pin is connected to pins 2 and 3 respectively. > The module is powered from DGND and VDD_5V. > > This maybe a good candidate to be on Wiki. > > Luiz >