DIY Speech Recognition using Raspberry PI & CMU Sphinx

This article is good but it doesn’t mention downloading, building and installing pocketsphinx, only sphinxbase.

https://medium.com/@ranjanprj/for-some-time-now-i-have-been-thinking-really-hard-to-build-a-diy-study-aid-for-children-which-uses-17ce90e72f43

I got it working after following the additional instructions here:

https://cmusphinx.github.io/wiki/tutorialpocketsphinx/

Networking with Retrofit

6.1 Retrofit basics

Retrofit (https://square.github.io/retrofit) is a library written by Square, which makes working with HTTP(S) APIs a breeze.

You define an interface in Kotlin, which specifies the REST connection to the server.  REST is a way to communicate with servers in an idiomatic way. You can then use this interface and a class you create of the HTTP response, to get back a Kotlin object, which you can then use in your code.

One example of REST is performing a GET request for a list of items.  Another would be performing a DELETE on an item object.

6.2 Retrofit set up

In your build.gradle, in the app folder, in the dependencies section, place the following:

implementation ‘com.squareup.retrofit2:retrofit:(insert latest version)

You can find the latest version by visiting this page:

https://github.com/square/retrofit/releases

In a Kotlin file put the following code in a file called MyService:

interface MyService {

  @GET(“users/{user}/items”)

  fun listItems(@Path(“user”) String user): Call<List<Item>>

}

You can set up and retrieve data in the following way:

val retrofit= new Retrofit.Builder()

.baseUrl(“https://api.example.com/”)

    .build();

val service = retrofit.create(MyService.class);

val items = service.listItems(“john”);

Although this is quick and easy, it isn’t the only option for data transfer in Kotlin. You could also use only OKHttp (https://square.github.io/okhttp/) to interact with REST services and get back a response string and then parse the JSON manually, or Picasso (https://square.github.io/picasso/ ) to load images into ImageViews easily. Picasso and OKHttp can be used in conjunction with Retrofit.

6.2 Retrofit Interceptors

In case you want to see what connections are being made behind the scenes, you can add an interceptor to Retrofit.  You can also use interceptors to add global headers to your request.

Register an interceptor by calling addInterceptor() on OkHttpClient.Builder:

val client = OkHttpClient.Builder()

       .addInterceptor(LoggingInterceptor())

       .build()

After configuring your OKHttp client, you can tell Retrofit to use that client:

val retrofit = Retrofit.Builder()

       .baseUrl(“https://api.example.com/”)

       .client(client)

       .build()

In a new Kotlin file called LoggingInterceptor.kt place the following code. 

class LoggingInterceptor : Interceptor {

  

   val TAG = “LoggingInterceptor”

  

   @Throws(IOException::class)

   override fun intercept(chain: Interceptor.Chain): Response {

       val request = chain.request()

       val t1 = System.nanoTime()

       Log.i(TAG,

           String.format(

               “Sending request %s on %s%n%s”,

               request.url(), chain.connection(), request.headers()

           )

       )

       val response = chain.proceed(request)

       val t2 = System.nanoTime()

       Log.i(TAG,

           String.format(

               “Received response for %s in %.1fms%n%s”,

               response.request().url(), (t2 – t1) / 1e6, response.headers()

           )

       )

       return response

   }

}

Now your responses will include the URL and time it took to receive the response.

Navy Confirms UFO Videos Posted by Blink 182 Rocker Are Real and Should Not Have Been Released

Controlling a motor with an encoder with an Arduino

I ordered this motor:

uxcell DC 12V 7RPM 50Kg.cm Self-Locking Worm Gear Motor with Encoder and Cable, High Torque Speed Reduction Motor

https://www.amazon.com/gp/product/B078J521TG

I have an Arduino Uno and a 12 Volt battery supply from 8 AA batteries from my previous project.


I found a few tutorials:

Tutorial for DC Gear Motor With Encoder

https://www.instructables.com/id/Tutorial-for-DC-Gear-Motor-With-Encoder/

Tutorial for Monster Motor Shield VNH2SP30

https://www.instructables.com/id/Monster-Motor-Shield-VNH2SP30/

This new motor is slower but has more torque than the motors I used in my last attempt at an autonomous robot.

The older motors had

Torque: 30 N*cm

According to Wolfram Alpha that’s:

3.059 kgf cm kilogram-force centimeters.

This new motor has 50Kg.cm.

I ordered a few items on Ebay:

NEW MEGA 2560 R3 Development Board CH340G ATMEGA 2560 Kit USB Cable For Arduino

1pcs Dual VNH2SP30 Stepper Motor Driver Module Monster Moto Shield Replace L298N

3/4/5/6/12mm Rigid Flange Coupling Motor Guide Shaft Coupler Metal Bearing Seat( 142461587108 )

Specification: 8mm

Quantity: 4